K2000 3.6 Task Engine: Join Domain
As I hadn't yet become too familiar with the KACE software in general, I had quite some issues with the postinstallation tasks when deploying new machines after upgrading the K2000 to version 3.6. Browsing through the knowledge base and the users' questions and answers I managed to solve almost everything.
The only problem I am still not able to solve is the task to join the domain. In the old K2000 version the preconfigured 'Example: Join Domain' Postinstallation Task would work without any errors.
How does this task need to be modified? I already tried adding "cscript" in the command line of the task because of the .vbs file like so:
cscript join_domain.vbs <my domain> <admin user> <admin password> <primary dns IP (optional)>
But the task would still keep failing. Is there anything to be changed within the .vbs file itself?
Thank you!
Answers (2)
I have run into this issue. Nothing in the VBS needs to be changed. Are you taking out the <> of the command line section? It should look like this
Correct
cscript join_domain.vbs domain.org administrator youradminpasswordhere 192.168.1.200
Incorrect
cscript join_domain.vbs <domain.org> <administrator> <youradminpasswordhere> <192.168.1.200>
Obviously change the appropriate areas to your settings. Example below. Works like a charm for me.
Hi!
So I commented on this before, but I'll go ahead and paste my answer. Basically if you're deploying Vista or later don't do cscript, it's legacy and complicated... If you just want to do the domain joining then skip the rename part.
Don't forget that you have to reboot each time, so auto admin login should at least be set to three times if you rename, or two times if you only want to do the domain join.
(1st for the Task Engine, second time to come back from the domain join).
Best regards
Adam
-------------------------------------------------------------------------------
If youre deploying 8.1 then you should really stop using VB-script IMHO, both for computer renaming and domain joining.
Why? VB script is uggly (again IMHO), and hard to use (let the flaming begin :-) ). Also WSName is not supported nor developed any more.
PowerShell is the way to go, super easy, super clean and there’s an abundance of info on Google for this.
Computer rename (Use K2 3.6 and tick that this requires a reboot in the post install task):
Bat file:
powershell.exe -nologo -executionpolicy bypass -noprofile -file ".\ComputerRename.ps1"
ComputerRename.ps1, (I'm pulling the servicetag and put it in the computername, which I find useful, edit as you like) (Google it and you'll find infinite ideas on this, WMI is your friend):
$serial=Get-WMIObject -Class Win32_Bios | select -expand "SerialNumber"
$NewName="ws-"+ $serial
$ComputerInfo = Get-WmiObject -Class Win32_ComputerSystem
$ComputerInfo.Rename($NewName)
Zip those and run the bat in a post deployment task.
Domain Join (Again, use K2 3.6 and tick that this requires a reboot in the post install task)
I use ksleep.exe to let everything settle down after the reboot. Had some issues on sites with no DC locally prior to using that, but it can surley be omitted in ideal conditions.
Bat file:
ksleep.exe 10
powershell.exe -nologo -executionpolicy bypass -noprofile -file ".\jd.ps1"
jd.ps1:
$domain = "domainname"
$password = "pwd for a user account that can add computers to domains" | ConvertTo-SecureString -asPlainText -Force
$username = "$domain\accountname"
$credential = New-Object System.Management.Automation.PSCredential($username,$password)
$ouPath="OU=Computers,OU=My OU,DC=my,DC=domain"
add-computer -Credential $credential -DomainName $domain -OUPath $ouPath
Zip those and run the bat in a post deployment task.
Lastly as someone surely will point out looking at the documentation for "add-computer" actually it seems that it supports renaming and joining in one swoop. I haven't got that working in win 7 after upgrading to the latest version of the management tool, but it might work in 8/8.1 .
Also, everything in this post is stolen from others, so any credit is to everyone else... :-)
Comments:
-
Hello,
instead of ksleep.exe I think is possible to use this command in PowerShell:
Start-Sleep -s 10
Thanks for the PowerShell script!
Regards,
Marco - StockTrader - StockTrader 8 years ago