Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

PowerShell Direct failures usually come down to an unsupported host or guest, a VM that is not ready, missing host or guest permissions, invalid guest credentials, or an unhealthy integration service. Check the exact error first, then follow the matching branch below. PowerShell Direct connects from the local Hyper-V host to a supported Windows guest; it does not require guest networking or remote-management settings.

Check the prerequisites before changing settings

  • Supported Windows versions: Microsoft documents Windows 10 or later, or Windows Server 2016 or later, for both the Hyper-V host and guest. For an older VM, use VMConnect or a network connection instead. See Microsoft’s PowerShell Direct guidance.
  • Local, running VM: The VM must be on the same Hyper-V host where you run the command, powered on, and have at least one configured user profile. Let Windows finish booting; a startup prompt or other input requirement can block the connection.
  • Host authorization: Your host account must be a Hyper-V administrator.
  • Guest authentication: You must provide a valid account from inside the guest. Host administrator rights do not automatically grant guest administrator access.
  • PowerShell version: PowerShell Direct requires PowerShell 5 or later. If the cmdlets do not recognize -VMName or -VMId, check the host version and PowerShell version.

PowerShell Direct works regardless of guest network configuration or remote-management settings, so changing WinRM or firewall settings is not a prerequisite.

Match the error to the fix

-VMName or -VMId is not recognized

Check the host Windows build and PowerShell version. Run these commands in the host session:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
[System.Environment]::OSVersion.Version
$PSVersionTable.PSVersion

Confirm that the host supports PowerShell Direct and that PowerShell’s major version is 5 or later. If you are using a PowerShell environment that lacks the Hyper-V cmdlets, run the command from an appropriate host environment.

#1 Best Overall
Sale
PowerShell for Sysadmins: Workflow Automation Made Easy
  • Book - powershell for sysadmins: workflow automation made easy
  • Language: english
  • Binding: paperback

“A remote session might have ended”

First verify that the VM exists and is running, the guest Windows version is supported, and startup has completed. A guest waiting for input or unable to boot can cause this message. On older host builds 10240–12400, Microsoft also documents this wording as a general error, so it does not identify a single cause.

New-PSSession fails

Apply the VM-state, guest-version, and boot checks above. If the guest’s PowerShell Direct service appears hung, connect through VMConnect, sign in to the guest, and run:

Restart-Service -Name vmicvmsession

Microsoft documents a separate persistent-session issue on older builds: omitting -Credential could crash the guest service. When creating a persistent session, pass guest credentials explicitly rather than assuming that issue explains every failure.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

“Parameter set can’t be resolved”

Do not use -RunAsAdministrator for a VM connection. That option applies to containers; for a VM, authenticate with a guest account using -Credential or the credential prompt.

“The credential is invalid”

Check the username and password for an account in the guest, and confirm that Windows has booted and the account exists. If you are using the built-in Administrator account, make sure it is enabled.

The VM name does not resolve

Confirm that the VM is registered on this local host and that your host account is a Hyper-V administrator. List the host’s VMs and their state with:

Get-VM

Check the Hyper-V PowerShell Direct service

The guest service used for PowerShell Direct is vmicvmsession, displayed as Hyper-V PowerShell Direct Service. Inspect Hyper-V integration services from the guest with:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Get-Service -Name vmic* | FT -AutoSize

For the service to work, Integration Services must be enabled in Hyper-V and running in the guest. Microsoft’s Integration Services guidance explains that guest-side service status alone is not the whole picture: a service disabled in Hyper-V may not function, and Hyper-V may restart a service stopped only inside the guest. Check or change enablement using Hyper-V’s integration-service controls on the host.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose the right connection command

Open an interactive shell

Use Enter-PSSession with the VM name or ID. Supply credentials for an account in the guest when prompted:

Enter-PSSession -VMName "MyVM"
# Or:
Enter-PSSession -VMId "<VM-GUID>"

Exit-PSSession

Run one command or a script

Use Invoke-Command for a script block or a file path. Authenticate with guest credentials:

Invoke-Command -VMName "MyVM" -Credential (Get-Credential) -ScriptBlock { Get-Service }
# Or run a script file:
Invoke-Command -VMName "MyVM" -Credential (Get-Credential) -FilePath "C:ScriptsCheckGuest.ps1"

Keep a session or copy files

Persistent PowerShell Direct sessions are documented for Windows builds 14280 and later. Create one with explicit guest credentials, use it for remote commands or file transfer, then remove it when finished:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
$cred = Get-Credential
$session = New-PSSession -VMName "MyVM" -Credential $cred

Copy-Item -Path "C:ScriptsCheckGuest.ps1" -Destination "C:ScriptsCheckGuest.ps1" -ToSession $session
# To copy a file back from the guest:
Copy-Item -Path "C:Logsguest.log" -Destination "C:Logsguest.log" -FromSession $session

Remove-PSSession $session

When the guest is too old or unavailable

If the guest does not meet Microsoft’s documented Windows version requirement, or cannot be brought to a usable running state, use VMConnect or connect over a network instead. Microsoft’s supported guest operating systems list provides broader compatibility context, including notes that some older guests require separately installed or upgraded Integration Services: supported Windows guest operating systems for Hyper-V.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.