Last active
June 12, 2017 16:09
-
-
Save milesgratz/d848710cd67d398c5245e8b472accb56 to your computer and use it in GitHub Desktop.
Custom function to start Invoke-Command "jobs" on remote systems
This file contains 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
Function Run-CustomFunction { | |
param($ComputerName) | |
# Create a job for tracking results | |
Start-Job -Name $ComputerName -ScriptBlock { | |
# Run the command on the remote Computer | |
Invoke-Command -ComputerName $args[0] -ScriptBlock { | |
Get-ChildItem "C:\Temp" | |
} | |
} -ArgumentList $ComputerName | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment