Powershell Join Domain In Specific Ou
The script will prompt for a username and password before it joins.
Powershell join domain in specific ou. Powershell add computer domainname yourdomainhere ydh credential domain username oupath ou yourou ou yourou dc yourdc dc yourdc you can copy and paste into notepad to modify for you. You can use powershell add computer domainname domain cred domain administrator passthru oupath ou xxx dc domain dc domain replace the parameters with you re domain values. When you join a computer to the domain it will by default go the computers folder.
Etc but if this is too difficult to do then i could do with a drop down. It is best practice to move the computers from the default folder to a different ou. If the script fails it will generate an error.
Idealy i would like to use ps to join the domain like you have listed but based on the first 3 letters of the computer name typed in join specific ous for instance if your name name was par1234 join the paris ou if the computer name was aus1234 join the australian ou. I haven t tried creating a batch file but it could possibly work. 3 users can choose their own ou for their domain join process so admin doesn t need to move thier computer objects to specific ou after domain join.
Thankfully we can automate this with powershell when we join the computers to the domain. Your going to be using powershell. 2 prompt for username password to join to domain no need to put username pass with the script file.
I am not saying that this is what you should do there s probably more elegant way to do it but we have 100 success and never talked about since then. Join computer to domain with specified computer name and ou. The final step of the bat is to delete the ps1.
Posted on february 25 2019 by computer tech blog. The bat calls a ps1 containing credentials info that join the computer to the domain in the right ou. The one i liked most the reason why i wrote this script xp.