Command works on one host but not another
Documentation: Microsoft Learn
Work the problem
Two hosts disagree
Fictional case: Get-Command finds the command on Host A but not Host B. Both hosts can reach the same network resources.
Reasoning notebook
Record the evidence that supports your answer and the check you would run next. Your notes stay in this browser — nothing is uploaded.
Why it happens
Two hosts built at different times drift in ways nothing announces: a different PowerShell version, a module present in one version and older or absent in the other, and a module path that includes an extra directory on one machine. A cmdlet can also exist in both places with a parameter that only arrived in a later module release.
Check this first
What to look for
Command discovery depends on the local session and installed modules. Compare those before investigating the command’s eventual network operation.
Working through it
- Print $PSVersionTable on both hosts and compare PSVersion along with PSEdition.
- Compare $env:PSModulePath, since an extra entry is often where the working host is finding what the other cannot.
- Run Get-Module -ListAvailable for the module in question on each and compare the version numbers returned.
- Check Get-Command for the specific cmdlet and compare the reported Version and Source on each host.
- Confirm the execution policy and any constrained language mode, either of which can fail a script for reasons unrelated to modules.
Avoiding it next time
Verify the repair: Start a clean session on Host B and confirm Get-Command resolves the intended source and version.