Remotely move a computer from one domain to another with powershell
# Define the target computer name$computerName = “COMPUTERTOMOVE”# Create a PSCredential object for Old Domain$usernameOld = “THISOLDDOMAIN\THISDOMAINADMINUSER”$passwordOld = ConvertTo-SecureString “THISPASSWORD” -AsPlainText -Force$credentialOld = New-Object System.Management.Automation.PSCredential($usernameOld, $passwordOld)# Create a PSCredential object for New Domain$usernameNew = “THATNEWDOMAIN\THATDOMAINADMINUSER”$passwordNew = ConvertTo-SecureString “THATPASSWORD” -AsPlainText -Force$credentialNew = New-Object System.Management.Automation.PSCredential($usernameNew, $passwordNew)# Test WS-Man connectivityTest-WsMan -ComputerName $computerName# DO ITInvoke-Command -ComputerName $computerName -Credential $credentialOld […]
You must be logged in to post a comment.