/build/static/layout/Breadcrumb_cap_w.png

Move machine to specific OU - K2000

Hi,

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 4 years ago

Answers (2)

Answer Summary:
Posted by: Channeler 4 years ago
Red Belt
1

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

Comments:
  • Thanks Channeler, this worked like a charm - kace_admin 4 years ago
Posted by: Ziggi 4 years ago
Blue Belt
0

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


Comments:
  • What format should the username be? domain\username or just username - SMal.tmcc 4 years ago
    • It worked with just Username, I believe. Long time since I used it though. PowerShell all the way. - Ziggi 4 years 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 4 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