Advertisement
Guest User

Untitled

a guest
Apr 30th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. $nodes = @("nim-win1-4.asvigneshad.local","nim-win2-5.asvigneshad.local","nim-win3-3.asvigneshad.local","nim-win4-1.asvigneshad.local","nim-win5-5.asvigneshad.local")
  2. $username = "asvigneshad\administrator"
  3. $password = "Password"
  4. $secstr = New-Object -TypeName System.Security.SecureString
  5. $password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}
  6. $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr
  7. For ($i=0; $i -lt $nodes.Length; $i++) {
  8. $sess = New-PSSession -Credential $cred -ComputerName $nodes[$i]
  9. Enter-PSSession $sess
  10. $script = "./tmp.dsh"
  11. "delete shadows all" | Set-Content $script
  12. diskshadow /s $script
  13. Remove-Item $script
  14. Exit-PSSession
  15. Remove-PSSession $sess
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement