Reading Time: < 1 minute

Last night I was trying to quickly set up several Windows Server 1709 virtual guests for Lab purposes and the Server Configuration Tool is time-consuming! For this reason, I used PowerShell Direct from the Hypervisor to connect to these guests and fire up some scripts to quickly configure my environment. One of the tasks inside my scripts was a simple but time-consuming task if you use the classic method, domain join operation.

The following PowerShell cmdlets will do the trick.

# Join computer/server to Active Directory.
Add-Computer -Domain "nameofthedomain" -Restart

# Disjoin computer/server from Active Directory.
Add-Computer -Workgroup "nameoftheworkgroup" -Restart

Thanks for reading my blog!

Feel free to drop your comment or question below.