Yesterday I did some work on VMware VDI.
I had a problem with the clones joining the 2003 domain.
The joining fails for 5% of the new cloned Win XP machines.
VMware VDI uses sysprep to rename, join domain, etc.
The sysprep inf file is generated by a customization specification.
Also in the customization specification I had a small afterjob that
moves the computer account to the right AD container (I used the Dsmod utility),
this afterjob also failed in 5% of the cases.
I decided to do some scripting.
The script to join the domain I already had, I only had to add 2 parts:
- Something to remove the script after running (because it contains admin credentials)
- Something to reboot the machine after running the job
For the destruction of the script after running I found this code:
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile(Wscript.ScriptFullName)
Set objFSO = Nothing
Cut and paste this code at the end of your script.
Normally the script code is parsed before running so there should be no File Locking problem removing the script.
Tomorrow I will post the completed script with:
- Join domain
- Add the right container
- Remove the script file
- Reboot the machine
Happy scripting.
Best regards,
Dirk Adamsky – Deludi BV
[adrotate group="3"]
