Move machine to specific OU - K2000


I am looking to add a newly imaged machine to a specific OU using script provided here - https://indigomountain.co.uk/2013/06/25/kace-join-domain-and-ou/ . This will be done as part of domain join and a post install task

I am using the following script:

cscript join_domain_and_OU.vbs redgrave.local username password DNS Server  OU=Windows,OU=Computers,OU=MyBusiness,DC=redgrave,DC=local

Task goes through without an error but does not add machine to domain or OU. Am I missing something?

1 Comment   [ + ] Show comment
  • And What is the return code from Windows??

    When the task fails it should be right there. - Channeler 1 year ago

Answers (2)

Answer Summary:
Posted by: Channeler 1 year ago
Red Belt

You could use a PowerShell Post install task, to join directly to into the OU you want, just edit the first three lines with your data. Save it as PS1 file , and create a new Powershell Post Install task, attach the PS1 file.

$domain= "DOMAIN.COM"
$password= "PASSWORD" | ConvertTo-SecureString -asPlainText -Force 
$user= "$domain\USER" 
$cred= New-Object System.Management.Automation.PSCredential($user,$password) 
$oupath = "CN=Computers,DC=DOMAIN,DC=COM" 
Add-Computer -domainname $domain -oupath $oupath -Credential $cred -ErrorAction silentlycontinue
Add-Computer -DomainName $domain -Credential $cred

  • Thanks Channeler, this worked like a charm - kace_admin 1 year ago
Posted by: Ziggi 1 year ago
Blue Belt

You should try it without the DNS Server. If I remember rightly it used to cause some issues with the vb script.

  • What format should the username be? domain\username or just username - SMal.tmcc 1 year ago
    • It worked with just Username, I believe. Long time since I used it though. PowerShell all the way. - Ziggi 1 year ago
  • Thanks Ziggi for your reply. But I dropped the vbscript in favor of the Powershell script and so have not tested the dropping of DNS server - kace_admin 1 year ago

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login


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