Contributor
Contributor

Windows 10 2015 LTSB VM

I am deploying a Windows 10 2015 Enterprise LTSB VM from a template and am having issues with configuring the VM after deployment.

The VM Deploys just fine but configuration thereafter is not working.

I am sure my workflow is correct as I am using it at the same time to deploy some Windows Server 2012 R2 Standard VM's and they work just fine.

It may have to do with the additional security on Windows 10 and running remote powershell and powercli scripts

At the moment my template has:

A User that has Administrator privileges

I have set the Execution policy to Bypass (Set-ExecutionPolicy Bypass)

Invoke-VMScript or Copy-VMGuestFile do not work.

Scripts are being executed with the Administrator user

Examples of failing commands are:

$st = 'TZUtil /s ' + '"' + $Using:timezone + '"'

Invoke-VMScript -VM $vmname -ScriptType Powershell -Guestuser $guestuser -GuestPassword $guestpass -ScriptText $st

$st = "mkdir c:\Build"

Invoke-VMScript -VM $vmname -ScriptType Powershell -GuestUser $guestuser -GuestPassword $guestpass -ScriptText $st

#Copy the VMInfo file to the VM

Copy-VMGuestFile -VM $vmname -LocalToGuest -Source C:\Build\VMInfo.ps1 -Destination C:\Build -GuestUser $guestuser -GuestPassword $guestpass

Anyone got any ideas?

Thanks

0 Kudos
3 Replies
Leadership
Leadership

I suspect you might be having an issue with UAC on the target OS.

There are a couple of options:

  • make sure UAC is disabled
  • make sure you have psexec installed in the template, then use Invoke-VMScript to run the commands via psexec


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Contributor
Contributor

I turned off UAC and no difference. Would really like to use the code I have without adding the need for PSExec if you think it is at all possible?

Surely others are deploying windows 10 machines and having similar issues, but I don't see a lot of traffic on this topic.

Thanks

0 Kudos
Contributor
Contributor

OK got it. When W10 is deployed Administrator account is disabled. Added a runonce command in the OS Customization spec as "net user Administrator /Active:yes" and all works.

Maybe this will help someone

RunOnce.jpg

Thanks

0 Kudos