hi guys
i am trying to activate a windows vm using the invoke vmscript powercli command
cmd /c slmgr / ato works fine when i run it from a dos command but when i call this via a script then the script just hangs
I have also tried to put the command above in a batch file locally on the system and just use invoke vmscript to run the batch file but that just hangs also
any idea what i am missing ?
$test = "cmd /c slmgr/ato"
Invoke-VMScript -Scripttype bat -ScriptText $test -VM $vm -GuestUser administrator -GuestPassword -------
Can you try forcing a non-GUI run, like
cscript c:\windows\system32\slmgr.vbs
instead of just slmgr ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Did you check if all of the prerequisites for Invoke-VMScript are there ?
See Will Invoke-VMScript work ?
Note that some of the requirements have change in newer PowerCLI and vSPhere releases.
But that script should give you a start where to look.
There might be hints in the vmware.log that is to be found in the VM's folder.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
apologies, i should have mentioned that i have many other commands working as part of this invoke-vmscript command
I am joining them using && in the script text
When you have only the problematic command in the CMD file, does it also hang ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
yep, script just stays there for ages doing nothing
when i have the script only containing things like disk labelling etc then it works fine
Can you try forcing a non-GUI run, like
cscript c:\windows\system32\slmgr.vbs
instead of just slmgr ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
at least that comes back with an error "invalid combination of command parameters"
so i ran cscript c:\windows\system32\slmgr.vbs /ato and it said "activating windows , run slui.exe 0x2a 0x80072ee7 to display the error text (says this on the machine im running script from, not on the destination vm)
I am doing this on a test vm without internet access so i reckon this could work with internet access
i will test in a few days and post the results
thanks
this worked great, thanks