Hi,
i'm trying to execute a script in a VM after deploying a vApp. The script will set the autologon to enable because we need that function to perform some other actions before we join the domain.
I have enabled the vApp VM Guest OS Customization ("Enable Guest Customization", "Change SID", "Password Reset") and i have used William Lams script provided here, http://blogs.vmware.com/vsphere/2012/06/using-a-guest-customization-script-to-tell-when-vappvm-is-re... in the Guest OS Customization script section as the base.
I have tried both:
@echo off
if "%1%" == "precustomization" (echo Do precustomization tasks ) else if "%1%" == "postcustomization" ( c:\script\script.bat)
and
@echo off
if "%1%" == "precustomization" ( echo Do precustomization tasks ) else if "%1%" == "postcustomization" ( cmd /c reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d "1" /f
cmd /c reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d "Administrator" /f
cmd /d reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultDomainName /t REG_SZ /d "localhost" /f
shutdown /r)
The first example points to a file, c:\script\script.bat, locally on the VM. If i use Williams script without modification the vm-is-ready file is created.
The customscript.bat is created in one folder under C:\Windows\Temp\ on the Windows VM with the content as described above but it seems like it is never being executed
Any help appreciated.
Thanks
We debugged this offline, so just to summarize findings so far:
Theory:
There are several things here.
4) while debugging this kind of stuff always start from doing it manually on a clean VM (run sysprep.exe from command-line, run registry update commands) and check that it succeeds before trying to mess with VCD
5) we didn't debug registry updating issue, I'll put that on my TODO list
//Andrii
when running the below script from the script section in the vAPP VM Guest OS Customization section:
if "%1%" == "precustomization" (
The file c:\windows\temp\pre.txt is created.
Just because i haven't turned off the echo it will echo everything in the file to the log file
echo. Further down in the log file i see:
12/05/2012 21:49:57 Executing command=cmd /c C:\Windows\TEMP\vmw54F2.tmp\customscript.bat postcustomization
12/05/2012 21:49:57 Command execution succeeded, command output:
C:\Windows\TEMP\vmw54F2.tmp>if "postcustomization" == "precustomization" (echo 1>c:\windows\temp\pre.txt )
C:\Windows\TEMP\vmw54F2.tmp>if "postcustomization" == "postcustomization" (
cmd /c reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d "1" /f
cmd /c reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d "Administrator" /f
cmd /c reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultDomainName /t REG_SZ /d "localhost" /f
)
The operation completed successfully.
The operation completed successfully.
The operation completed successfully.
The above last three lines indicates that the registry entries was successfully added to the registry but they are not present.
If i run the cmd /d reg add command the registry is updated as expected.
I can also see the messages in the "sysprep.tiff" file during the sysprep customization. Is that something to be worried about?
No error or warning messages in the sysprep log.
Anyone?
Dear Sender:
Thank you for your email.
I will be on training by Wednesday, Thursday and Friday afternoons. During this specific time frames i will have limitedd access to phone and email, please expect a brief delay in my reponding.
Regards
GR
i also updated the unattended.xml file in the vCloud Director VM as shown below:
<settings pass="oobeSystem">
The bold text is added to the file.
In the vApp VM Guest OS Customization i have activated the "Enable guest customization", "Change SID" and "Password Reset". For the "Password Reset" configuration i specified the same password as in the unattended.xml file.
The registry entry is not present this time either and autologon still does not work.
We debugged this offline, so just to summarize findings so far:
Theory:
There are several things here.
4) while debugging this kind of stuff always start from doing it manually on a clean VM (run sysprep.exe from command-line, run registry update commands) and check that it succeeds before trying to mess with VCD
5) we didn't debug registry updating issue, I'll put that on my TODO list
//Andrii