Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Add a Computer to a Domain Using PowerShell on Windows

Adding a computer to a domain is a common task for system administrators managing Windows environments. This process can be streamlined using PowerShell, a powerful scripting language included with Windows. The Add-Computer cmdlet is specifically designed for this purpose, allowing you to join a computer to a domain or workgroup efficiently.

Understanding the Add-Computer Cmdlet

The Add-Computer cmdlet is a part of the PowerShell module that helps in adding local or remote computers to a domain or workgroup. It can also be used to remove a computer from a domain or workgroup. This cmdlet is particularly useful for automating the process in large environments.

Prerequisites

  1. Administrator Privileges: Ensure you have administrative rights on the local computer.
  2. Domain Credentials: You need a user account with the necessary permissions to add a computer to the domain.
  3. Network Connectivity: The computer must be able to communicate with the domain controller.

Example: Adding a Computer to a Domain

Below is a step-by-step guide on how to use the Add-Computer cmdlet to add a computer to a domain.

Step 1: Open PowerShell

  • Click on the Start menu.
  • Type PowerShell.
  • Right-click on Windows PowerShell and select "Run as administrator".

Step 2: Use the Add-Computer Cmdlet

Execute the following command in the PowerShell window:

Add-Computer -DomainName "YourDomainName" -Credential (Get-Credential) -Restart
  • -DomainName: Specifies the domain you want to join.
  • -Credential: Prompts for domain credentials. A dialog box will appear asking for a username and password with the necessary permissions.
  • -Restart: Restarts the computer after joining the domain.

Step 3: Enter Credentials

When prompted, enter the domain username and password. This account must have the rights to add computers to the domain.

Step 4: Verify Domain Membership

After the computer restarts, you can verify that it has joined the domain:

  1. Right-click on "This PC" or "Computer" on the desktop or in File Explorer.
  2. Select "Properties".
  3. Under "Computer name, domain, and workgroup settings", check the domain name.

Additional Options

  • -OUPath: Specify the Organizational Unit (OU) in which to place the computer account.
  • -PassThru: Returns an object representing the computer.

Troubleshooting

  • Network Issues: Ensure the computer can resolve the domain name and communicate with the domain controller.
  • Permissions: Verify that the account used has the necessary permissions to join computers to the domain.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.