About 50 results
Open links in new tab
  1. Run a script block using powershell 5?

    Jun 12, 2023 · Hello, All my code is running in powershell 7, but I have subsection of a script that needs to run under powershell 5. I would like to know is there is an elegant way to run a script block from a …

  2. How to use Invoke-Command to pass logged in ... - PowerShell Forums

    Apr 6, 2016 · I want to use Invoke-Command to execute a script block on a remote computer, where the script block needs to access a network file share while executing on the server side.

  3. How to run string block as powershell code

    Oct 4, 2020 · I wanted to make sure you understood it’s not a scriptblock as you show it. When I run this this script block above as a code, Fact 2. Taking your here-string and running it as suggested does …

  4. ValidateScript for Beginners – PowerShell.org

    May 21, 2013 · In the script block, “$_†represents the parameter value. If a parameter takes a collection (more than one) of objects, “$_†represents each value in the collection, which is …

  5. Using Local Functions in a Scriptblock with Existing Code - PowerShell

    Jan 18, 2016 · When you are wanting to run code remotely, it's common to do this via the use of Invoke-Command (though other options exist, such as through Start-Job for example). The biggest downfall …

  6. Cannot Paste blocks of code into Windows Terminal - PowerShell Forums

    May 6, 2020 · Below is a screen shot of what I’m trying to explain. PowerShell is in blue. PowerShell in Windows Terminal is in Black, Notepad to the right with the simple write-host block of text. As you …

  7. Start-Job using variables - PowerShell Help - PowerShell Forums

    Mar 6, 2019 · Easy one for some gurus. I’m trying to replace an existing Windows script with a powershell equivalent to run across multiple files and folders and execute scripts with sequencing …

  8. Help with passing arguments with Invoke-Command (I am using ...

    Feb 27, 2019 · You don’t need to use the call operator (&), just remove the quotes. If you are executing only that script in scriptblock. You can use -FilePath parameter of Invoke-Command. Instead of …

  9. Best way to exit a script on a specific condition. - PowerShell Forums

    Nov 15, 2018 · I have a small script I’m working on to check for locked AD accounts, and then optionally unlock them. One of the first checks is to see how many accounts are currently locked. If there are …

  10. Passing variables as arguments in powershell script

    Oct 4, 2022 · Have problems passing variables as arguments when running start-job in powershell script. This is an example script to shed light on the nature of the problem. A script like this: param …