I have a windows 10 system on which I created some windows 7 virtual machines. The VMs are created in Hyper-V.
I want to run remote commands on them, but when I run command:
" Invoke-Command -VMName <vmName> -ScriptBlock {powershell.exe -ExecutionPolicyBypass <ps1_script>} -Credential $cred",
I get this error:
'An error has occurred which Windows PowerShell cannot handle. A remote session might have ended. + CategoryInfo : OpenError: (IE8Win7:String) [], PSRemotingDataStructureException + FullyQualifiedErrorId : PSSessionStateBroken'.
Do you have any idea what it might be?
I want to mention that the virtual machine is for windows 7, it does the same for windows 8, and if I use the virtual machine for windows 10, the same command works perfectly.
After running the command, it seems to crash for a few seconds and then give the aforementioned error.