$pc = "PCName"
$user = "Administrator"
$pass = cat C:\securestring.txt | convertto-securestring
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist "$pc\$user",$pass
$domain = "Domain"
$user2 = "Administrator"
$pass2 = cat C:\securestring2.txt | convertto-securestring
$domcred = new-object -typename System.Management.Automation.PSCredential -argumentlist "$domain\$user2",$pass2
Remove-Computer -Computer $pc -UnjoinDomainCredential $domcred -LocalCredential $cred -Workgroup workgroup -PassThru -Force -restart
Monday, June 30, 2014
PowerShell - Remove/Unjoin Computer from domain
Labels:
PowerShell,
Windows 7
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment