SHARE
TWEET

Untitled

a guest Sep 17th, 2019 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $credential = Get-Credential
  2.  
  3. $Computers = Get-Content computers.txt
  4.  
  5. Foreach ($computer in $computers) {
  6. $scriptblock = {
  7. Invoke-Command -ComputerName $args[0] -ArgumentList $credential -ScriptBlock {
  8.     Start-Process -Credential $using:credential -FilePath "\\networkpath\setup.exe" -ArgumentList "/q","/x","/L C:\windows\logs\Uninstall.txt"
  9.     Start-Process -Credential $using:credential -FilePath "\\networkpath\setup.exe" -ArgumentList "/q","/L C:\windows\logs\Install.txt"
  10. }
  11. }
  12. Start-Job -ScriptBlock $scriptblock -ArgumentList $computer, $credential
  13. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top