/build/static/layout/Breadcrumb_cap_w.png

Looking for k2000 "Join Domain" powershell script............

I was recently checking out the KKE archive and saw this being referred to and was hoping someone could pass this along


0 Comments   [ + ] Show comments

Answers (2)

Answer Summary:
Posted by: dugullett 10 years ago
Red Belt
3

I use this. This will attempt to join a specific OU. If the record already exists in that OU it will join the domain.

$domain= "domain.org"

$password= "<user password>" | ConvertTo-SecureString -asPlainText -Force

#enter user account that will be used to join domain

$user= "$domain\<user>"

$cred= New-Object System.Management.Automation.PSCredential($user,$password)

#edit for OU path

$oupath = 'OU=Laptops,OU=Workstations,DC=domain,DC=ORG'

#add computer to OU

Add-Computer -domainname $domain -oupath $oupath -Credential $cred -ErrorAction silentlycontinue

#add computer to domain

Add-Computer -DomainName $domain -Credential $cred

Comments:
  • Save this as .ps1. Upload it as an app post install. Use this as your command line (assuming you name it domain.ps1).

    powershell.exe -nologo -executionpolicy bypass -noprofile -file domain.ps1 - dugullett 10 years ago
    • I just tried this on the K2000 version 3.6.98680 and it fails with an error of "The system cannot find the file specified".

      Do I need to zip up powershell.exe with the domain.ps1 file? Do I need to put domain.ps1 in " "? - edwimb 10 years ago
      • Zip it up w/ a .bat file that has that same command line. Add it to a post install, and enter then name of the .bat in your command line. - dugullett 10 years ago
      • Zip what up? The powershell.exe and the .bat file, or just the command in a bat file? - edwimb 10 years ago
      • You should save this powershell script as a .ps1. The create a .bat file that has the command line below. Zip those two up together.

        powershell.exe -nologo -executionpolicy bypass -noprofile -file <name of your script>.ps1 - dugullett 10 years ago
      • I added this in a zip file with the domain.ps1 file I edited and the command worked. However, the machine was not moved to the OU specified in the script. The machine remained in the OU it was in prior to running the script. - edwimb 10 years ago
      • That's how I have it set. - dugullett 10 years ago
      • So when mr_jimmyjames said "Just to clarify, "if the record DOES exist already", it will still join the intended OU?" the answer is no, it will not. - edwimb 10 years ago
      • Correct. If you see my reply to that question. If it exists already in an OU it will rejoin that one. If not, it will join the one you specify. - dugullett 10 years ago
      • I also see in your reply where you said "Yes." when you should have said "No."... This was a waste of time for me because of that. - edwimb 10 years ago
      • Sorry. When I said "Keeping the existing record in the OU" I probably should have said "Keeping the existing record in the OU"? - dugullett 10 years ago
      • No that part is fine, but you may want to learn what yes and no mean. - edwimb 10 years ago
  • Just to clarify, "if the record DOES exist already", it will still join the intended OU? - mr_jimmyjames 10 years ago
    • Yes. If it's a brand new machine it will join the OU first. If it's a machine being reimaged it will try to join the OU, realize there's a record there, and then just join the domain. Keeping the existing record in the OU. - dugullett 10 years ago
  • Cool, thanks! - mr_jimmyjames 10 years ago
  • Would anyone know how to couple this with wsname to get the PC named/renamed and joined to the domain? - toucan911 10 years ago
    • I would use WSName as a separate post install ran before this one. You may have to add a reboot in between the two using the post install task converter. I personally do not use the WSNAME anymore since our naming standards are very unique.

      http://www.itninja.com/blog/view/k2000-postinstall-task-converter - dugullett 10 years ago
Posted by: SMal.tmcc 10 years ago
Red Belt
1

I use the join domain vbs script provided by kace to join my machines to the domain, but here are some PS examples

http://letitknow.wordpress.com/2011/02/12/domain-join-using-powershell-v2-0-part-i/

http://blogs.technet.com/b/heyscriptingguy/archive/2012/02/29/use-powershell-to-replace-netdom-commands-to-join-the-domain.aspx?Redirected=true


Comments:
  • Thanks, I do appreciate it. - mr_jimmyjames 10 years ago
  • I read of few of your posts regarding imaging w/k2000 and would like to say well done. That said, I was hoping you can offer some guidance/assistant/wisdom, as I'm new to the imaging process, I've been using mostly scripted installs. I'm sort of pressed for time, otherwise, I would watch the KBE's, read the tutorials, of course ITNinja, etc... My email is jharting96@gmail if you are willing to assist a n00b that is just starting out and in a hurry, if not, I understand.. Thanks in Advance - mr_jimmyjames 10 years ago
    • I post my email on the site under my profile to help other's. I have had others email my gmail account and we opened a chat session to help walk them though a problems quickly and send them some of my support files for imaging. Just got back from 10 days supporting the Reno Air Races so still getting caught up, I am on PST and should have time tomorrow to get in touch with you around 7:30-8:00 am my time. - SMal.tmcc 10 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ