Last active
June 8, 2023 18:46
-
-
Save JohnL4/2b4636b68cc26e2041df2dd439ff87df to your computer and use it in GitHub Desktop.
How to send arguments to Invoke-Command (using a parameterized script block) to invoke a command on a remote server (PS Remoting)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The key is a parameterized script block. | |
$expected = Invoke-Command -ComputerName $Machine -script { | |
param($path) Get-ChildItem $path -rec | Measure-Object -prop length -sum } -args $CubePath |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment