Donnerstag, 29. März 2018

Computer shows domain but is not in ActiveDirectory

So while installing some of our clients i came across a new Problem.
The Computers are joined automatically via script to into the Domain where then a Computer Account for each client gets created.

Well at least should.

Some clients seem to not create a Computerobject in the AD while others do.
The Problem is if you are running the Domain Join Script again it will return that the Client already is a Member of the Domain.

Since i had some time today at work i could invest in this i searched the Web for a Solution to Unjoin the Domain and join the Client into the Workgroup which is possible via GUI but apparently not via netdom / Powershell.

Thanks to a Post from Rems @ www.petri.com I came across this post:

https://www.petri.com/forums/forum/windows-scripting/general-scripting/66141-remove-pc-from-domain-without-being-connected-to-dc?p=444547#post444547

In order to get it working my script looks like the following

 start /B /W wmic.exe /interactive:off ComputerSystem Where "Name='%computername%'" Call UnJoinDomainOrWorkgroup FUnjoinOptions=0
start /B /W wmic.exe /interactive:off ComputerSystem Where "Name='%computername%'" Call JoinDomainOrWorkgroup name="WORKGROUP"

After that i reboot the Computer with our Deployment Console and let it join the Domain again which works like a Charm.


Hope i can help someone else with this.


Kind Regards,

Patrick

Keine Kommentare:

Kommentar veröffentlichen