question

BrunoBERNARDI-0441 avatar image
0 Votes"
BrunoBERNARDI-0441 asked ·

Hyper-V remote command

Hello. I am using Hyper-V Manager V 10.0.18362.1 and I try to automate Antivirus update on each VM. I manage to do it on Windows 10 virtuals machines with powershell by using Enter-PSSession and Invoke-Command. But I don't manage on Windows 7 and 8.1 virtuals machines. I meet these errors : ![7065-remotewin8error.png][1] Could you tell me why I have these errors only on Windows 7 and Windows 8.1 Virtuals Machines ? My code is this one : $cred= New-Object System.Management.Automation.PSCredential($login, $securePassword ) $VMName = 'RDITS_Win8_32_fr' function Update-VM($VMName, $VMcred) { Invoke-Command -VMName $VMName -ScriptBlock {Import-Module PSWindowsUpdate -Force} -Credential $VMcred Invoke-Command -VMName $VMName -ScriptBlock {Get-WUServiceManager} -Credential $VMcred #Invoke-Command -VMName $VMName -ScriptBlock {Add-WUServiceManager -ServiceID 7971f918-a847-4430-9279-4a52d1efe18d -Confirm:$false} -Credential $VMcred Invoke-Command -VMName $VMName -ScriptBlock {Add-WUServiceManager -ServiceID 9482f4b4-e343-43b6-b170-9a65bc822c77 -Confirm:$false} -Credential $VMcred Invoke-Command -VMName $VMName -ScriptBlock {Get-WUInstall -MicrosoftUpdate -AcceptAll -AutoReboot} -Credential $VMcred } Start-VM -VMName $VMName Start-Sleep -Seconds 20 Enter-PSSession -VMName $VMName -Credential $cred if($VMName.Contains("_32")) { Invoke-Command -VMName $VMName -ScriptBlock {start "C:\Program Files\McAfee\VirusScan Enterprise\mcupdate.exe"} -Credential $cred } else { Invoke-Command -VMName $VMName -ScriptBlock {start "C:\Program Files (x86)\McAfee\VirusScan Enterprise\mcupdate.exe"} -Credential $cred } if($VMName.Contains("_win10")) { Update-VM $VMName $cred } Exit-PSSession Stop-VM -VMName $VMName regards [1]: /answers/storage/attachments/7065-remotewin8error.png

not-supported
remotewin8error.png (34.4 KiB)
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

DSPatrick avatar image
0 Votes"
DSPatrick answered ·

QnA currently supports the products listed in right-hand pane (more to be added) Better to reach out to subject matter experts in dedicated forums over here.


https://social.technet.microsoft.com/Forums/windows/en-US/home?forum=winserverpowershell


(please don't forget to mark helpful replies as answer)


· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.