Link to home
Start Free TrialLog in
Avatar of janhoedt
janhoedt

asked on

Remove/rejoin computer to domain via Powershell script?

Hi,

I need to revert to an ESXI vmware snapshot of a vm all the time.
Regularely I get the message "trust relationship between this workstation and the domain failed".
I need to remove it from the domain, reboot add it to the domain reboot what is ennoying.

Please advise howto do this in an easier way, via Powershell or other?

J.
Avatar of Peter Hutchison
Peter Hutchison
Flag of United Kingdom of Great Britain and Northern Ireland image

Use the Add-Computer command:
e.g.
$name = $Env:ComputerName
$cred = Get-Credential
Add-Computer -WorkgroupName WORKGROUP -ComputerName $name
Add-Computer -Domain domain-name -Credential $cred -ComputerName $name
Avatar of janhoedt
janhoedt

ASKER

Ok, but howto do this remotely?
ASKER CERTIFIED SOLUTION
Avatar of GG VP
GG VP
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial