Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $Username = [Environment]::UserName
- $Password = $($PassBox1.text)
- $Pass = convertTo-SecureString -AsPlainText $Password -Force
- $SecureString = $Pass
- $MySecureCreds = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Username,$SecureString
- $Servers = "Server1","Server2","Server3","Server4"
- $Servers | %{Invoke-Command -ComputerName $_ -ScriptBlock{Get-Service -Name "n4cluster"} -Credential $MySecureCreds}
- $MessageBox1.AppendText( ($Servers | foreach {$_ + "`n" } ) )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement