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. 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 …

  5. 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 …

  6. How to start a process as a separate process tree? - PowerShell Help ...

    Apr 29, 2024 · A background job with Start-Job with a script block Call the process with Start-Process with -Wait and -NoNewWindow and the -Redirect IO parameters Write your IO to a file and poll data …

  7. Try/Catch Question - PowerShell Help - PowerShell Forums

    Nov 8, 2023 · In PowerShell, you can indeed nest try/catch/finally blocks, and there is no specific limit to how many levels of nesting you can have. Each try block can contain multiple catch blocks and a …

  8. 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 …

  9. 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 …

  10. 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 …