Active Directory

How to join computer to domain through powershell

Domain joining refers to the process of connecting a computer or device to a specific domain in a Windows network environment. In a domain-based network, a domain controller manages user accounts, security policies, and network resources. By joining a domain, a computer becomes a member of that domain and gains access to shared resources and centralized authentication services provided by the domain controller.

A domain can be joined or left in two different ways. You can add and remove computers using the netdom or powershell commands.

The online way

Join a domain. If the machine you wish to connect has you logged in

C:\> netdom join ECXCHDFS01 /domain:Windowstechno.local /UserD:Make-ds-a /PasswordD:****

Join a workgroup and leave the domain. Even if you don’t have the authority to remove the computer object from the domain, the /force option disconnects the machine from the domain. There is still the domain computer object.

c:\> netdom remove %computername% /domain:your.OldADDomain.net /force

The Powershell way

Join computer to domain through powershell

  • Login to sever via local admin and run the below commands. 
PS C:\> Add-computer Asia-pac.WindowsTechno.local -Credential Vipan.Kumar-DS-A

      How-to-Join-system-with-domain-from-command-line

  • Hit Enter

      How-to-Join-system-with-domain-from-command-line-1

  • To join the system with the domain, enter the credentials for the domain admin account.

      How-to-Join-system-with-domain-from-command-line-2

  • To make domain join and policies effective, restart the server.
  • To check whether domain joining was successful or not, log in using a domain account.

       

  •       We are able to login to server via domain account.

        How-to-Join-system-with-domain-from-command-line-4

  •  Just run the sconfig command to get the below details.

      Server-Details

Remove from Domain and join a workgroup.

PS C:\> Remove-computer -ECXCHDFS02 yourWorkgroup

Additionally, we have a video below that demonstrates the same. Do not forget to check this.

So, that’s all in this blog. I will meet you soon with next stuff. Have a nice day!!!

Recommended content

How to Check the Active Directory Database Integrity

Disabling and Enabling the Outbound Replication

DFS Replication Service Stopped Replication

What is Strict Replication Consistency

The replication operation failed because of a schema mismatch between the servers involved

Troubleshooting ad replication error 8418 the replication operation failed because of a schema mismatch between the servers

How to export replication information in txt file

Repadmin Replsummary

Enabling the outbound replication

Disabling and enabling replication on schema master domain controller

How to enable strict replication consistency

How to prevent lingering objects replication in active directory

AD replication process overview

How to force active directory replication

Change notification in replication process

How to check replication partner for a specific domain controller

dcdiag test replications

Guys please don’t forget to like and share the post.Also join our WindowsTechno Community and where you can post your queries/doubts and our experts will address them .

You can also share the feedback on below windows techno email id.

If you have any questions feel free to contact us on admin@windowstechno.com also follow us on facebook@windowstechno to get updates about new blog posts.

How useful was this post?

Click on a star to rate it!

As you found this post useful...

Follow us on social media!

Was this article helpful?
YesNo

Vipan Kumar

He is an Active Directory Engineer. He has been working in IT industry for more than 10 years. He is dedicated and enthusiastic information technology expert who always ready to resolve any technical problem. If you guys need any further help on subject matters, feel free to contact us on admin@windowstechno.com Please subscribe our Facebook page as well website for latest article. https://www.facebook.com/windowstechno
Back to top button