Hyper-V remote command

Bruno BERNARDI 1 Reputation point

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]: /api/attachments/7065-remotewin8error.png?platform=QnA

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
25,487 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dave Patrick 342.1K Reputation points MVP

    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.


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