APP01 is a running Windows Server 2025 VM on a local Hyper-V host. PowerShell Direct is working for the VM, but APP01 has no network connectivity. An administrator has an elevated Windows PowerShell console on the host and valid guest credentials.
Which command opens an interactive PowerShell prompt inside APP01?
Why
Enter-PSSession with VMName starts an interactive session through PowerShell Direct. The guest does not need network connectivity for this connection.
- Not correct:
New-PSSession -VMName 'APP01'. New-PSSession creates a persistent session in the background. Creating that session does not enter its interactive prompt. - Correct:
Enter-PSSession -VMName 'APP01'. The VMName parameter selects PowerShell Direct, and Enter-PSSession opens an interactive session inside the VM. - Not correct:
Invoke-Command -VMName 'APP01' -ScriptBlock { hostname }. This runs one command through PowerShell Direct and then closes its connection. It does not open an interactive prompt. - Not correct:
Enter-PSSession -ComputerName 'APP01'. The ComputerName form uses network PowerShell remoting. APP01 is unreachable through that connection method in this scenario.
Source