
To join a PC to an Active Directory domain, run the following PowerShell script locally: $dc = "ENTERPRISE" # Specify the domain to join. The most common task is joining a computer to a domain controller. In Microsoft Windows Server 2012 and later, this module is enabled by default. In Microsoft Windows Server 2008 R2, you need to enable this module by running the following command: Import-Module ActiveDirectory (Alternatively, you can right-click on the PowerShell ISE icon and choose the “Run as administrator” option.) Type in the administrator’s password when prompted.īefore you can work with AD and its objects, you need to import the Active Directory module for Windows PowerShell. Start the PowerShell ISE tool with administrator privileges by pressing “Windows+R” and entering “runas /profile /user:Administrator PowerShell_ISE” in the Run window. PowerShell ISE is the best tool for working with PowerShell scripts. Rename a Computer and Join It to a Domain.

Remove Stale Computer Accounts in Active Directory with PowerShell.Create Computer Accounts from a CSV File.Remove a Computer from a Domain with PowerShell.In all, you’ll learn how to use PowerShell to perform the following computer account management tasks: Free Guide: Windows PowerShell Scripting Tutorial.
