Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Exampe - Invoke-Multithread
#http://www.bryanvine.com/2015/06/powershell-script-invoke-multithread.html
#ScriptBlock: function declaration with function name on the last line without the -ComputerName parameter
$SB = {
Function Check-WindowsServer{
param(
[string[]]$ComputerName
)
foreach ($server in $ComputerName){
if(Test-Path "\\$server\c$\windows"){
Write-Output "Is a Windows Server"
}
else{
Write-Output "Is NOT a Windows Server"
}
}
}
Check-WindowsServer}
Invoke-Multithread -ComputerName (Get-Content .\myserverlist.txt) -ScriptBlock $SB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.