Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $UserName = "IPAddressusername"
- $Password = ConvertTo-SecureString "password" -AsPlainText -Force
- $psCred = New-Object System.Management.Automation.PSCredential($UserName, $Password)
- $s = New-PSSession -ComputerName IPAddress -Credential $psCred
- $sysprep = 'C:WindowsSystem32SysprepSysprep.exe'
- $arg = '/generalize /oobe /shutdown /quiet'
- $sysprep += " $arg"
- Invoke-Command -Session $s -ScriptBlock {$sysprep}
- $sysprep = 'C:WindowsSystem32SysprepSysprep.exe'
- $arg = '/generalize /oobe /shutdown /quiet'
- 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