Powershell and Windows 11

Jim Harbert 0 Reputation points

In Windows 11 Pro 22H2 running PowerShell v5.1.22621.2506, I'm seeing issues when running PowerShell commands. For example, I run the copy-item command and PowerShell says it is an invalid command. I close PowerShell and open it again and the copy-item command successfully runs. I have never encountered this issue in Windows 10.

Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,888 questions
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,290 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Hania Lian 10,931 Reputation points Microsoft Vendor


    1. Check the PowerShell configuration file.

    Run to see the contents of the current profile: Get-Content $PROFILE

    Look for any commands that might interfere with or load modules that might override the default behavior.

    1. Test in a new user profile.

    Create a new user profile and test if the issue persists. This can help determine if the issue is specific to your current user profile.

    1. Review the event log.

    Check the Windows event log for any related errors or warnings that may provide more clues.

    1. Reset PowerShell settings.

    As a last resort, you can reset the PowerShell settings to their defaults. Note that this will remove any customizations you have made. Use the following command:

    Remove-ItemProperty -Path "HKCU:\Software\Microsoft\PowerShell\1\PowerShellEngine" -Name "*"

    Hope this helps.

    Best Regards,

    Hania Lian


    If the Answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments