We utilize a powercli script to deploy virtual machines (servers) in our environment and have been using this script for the past 2 years without much issue. At the very end of the deployment script I use Invoke-VMScript to install programs and make configuration changes in the registry etc.
A few people on my team use this script and noticed that they are seeing failures now on some Invoke-VMScript commands. Each time it is not necessarily the same part of the script of than it is while running the Invoke-VMScript command.
Here are some examples of the failures and the respective script I am running:
1.
Write-Verbose -Message 'Installing Ivanti' -Verbose
# This scriptblock is used to install Ivanti with the Patch module enabled
$InstallIvanti = 'C:\ServerBuild\Ivanti\IvantiInstall.bat'
Invoke-VMScript -ScriptText $InstallIvanti -VM $Global:VMName -GuestCredential $Global:ConfigCred -ScriptType Bat
2.
Write-Verbose -Message 'Enabling PowerShell Remoting' -Verbose
# This scriptblock is used to enable PS Remoting
$EnablePSRemoting = 'Enable-PSRemoting -force'
Invoke-VMScript -ScriptText $EnablePSRemoting -VM $Global:VMName -GuestCredential $Global:ConfigCred -ScriptType Powershell
3.
This script has been run on Windows 7 and Windows 10 and the same errors seem to happen.
Any help with troubleshooting would be greatly appreciated.
Thanks,
James