VMware Cloud Community
PMPM789
Enthusiast
Enthusiast

template update failing

Hello Team 

i am trying to update Template(windows) with powershell script .Its working fine with 2019 DC ,2012(DC and strd)  but failing for 2016 DC and standard and 2019 standard version saying error 

Invoke-VMScript : 3/23/2021 4:10:34 AM Invoke-VMScript A general system error occurred: vix error codes = (3016, 0).

At C:\Scripts\ Standard.ps1:29 char:1
+ Invoke-VMScript -ScriptType PowerShell -ScriptText "Install-WindowsUp ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Invoke-VMScript], SystemError
+ FullyQualifiedErrorId : Client20_VmGuestServiceImpl_GetProcessOutputInGuest_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.InvokeVmScript

 

This is the script i am using .

"Invoke-VMScript -ScriptType PowerShell -ScriptText "Install-WindowsUpdate -AcceptAll -AutoReboot" -VM TMPL".

 

i did try with "Invoke-VMScript -ScriptType PowerShell -ScriptText "Get-WUInstall –WindowsUpdate -AcceptAll -AutoRe boot" -VM TMP" but still the same .

 

i have WindowsUpdate component installed and PowerShell version 5

0 Kudos
6 Replies
LucD
Leadership
Leadership

Can you run any PowerShell cmdlet on those VMs via Invoke-VMScript?
Try for example running Get-Service on those VMs.


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

0 Kudos
PMPM789
Enthusiast
Enthusiast

seems like no 

 

 C:\Users\Administrator> Invoke-VMScript -ScriptType PowerShell -ScriptText "Install-WindowsUpdate -AcceptAll -AutoReboot"
Invoke-VMScript : The term 'Invoke-VMScript' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Invoke-VMScript -ScriptType PowerShell -ScriptText "Install-WindowsUp ...
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Invoke-VMScript:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\Administrator> Get-Service Invoke-VMScript
Get-Service : Cannot find any service with service name 'Invoke-VMScript'.
At line:1 char:1
+ Get-Service Invoke-VMScript
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Invoke-VMScript:String) [Get-Service], ServiceCommandException
+ FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.Commands.GetServiceCommand

0 Kudos
LucD
Leadership
Leadership

Where did you run this?
On your station or in the Guest OS of the target VM?


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

0 Kudos
PMPM789
Enthusiast
Enthusiast

on the Template/VM

0 Kudos
PMPM789
Enthusiast
Enthusiast

same script working for 2012 dc and stnd and 2019 DC,its not working only for 2016 dc and stand and 2019 standard versions

0 Kudos
LucD
Leadership
Leadership

When you are running this inside the Guest OS, you shouldn't be using Invoke-VMScript.
I just asked to run a PowerShell session in there, and in that session run a PS cmdlet.


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

0 Kudos