Guest User

Untitled

a guest
Sep 3rd, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. $UserName = "IPAddressusername"
  2. $Password = ConvertTo-SecureString "password" -AsPlainText -Force
  3. $psCred = New-Object System.Management.Automation.PSCredential($UserName, $Password)
  4. $s = New-PSSession -ComputerName IPAddress -Credential $psCred
  5.  
  6. $sysprep = 'C:WindowsSystem32SysprepSysprep.exe'
  7. $arg = '/generalize /oobe /shutdown /quiet'
  8. $sysprep += " $arg"
  9.  
  10. Invoke-Command -Session $s -ScriptBlock {$sysprep}
  11.  
  12. $sysprep = 'C:WindowsSystem32SysprepSysprep.exe'
  13. $arg = '/generalize /oobe /shutdown /quiet'
  14. Invoke-Command -Session $s -ScriptBlock {param($sysprep,$arg) Start-Process -FilePath $sysprep -ArgumentList $arg} -ArgumentList $sysprep,$arg
Add Comment
Please, Sign In to add comment