Relatively new to this sort of thing but I’m having a problem with Powershell that after hours of troubleshooting I cannot resolve. I’m unable to execute commands like ipconfig
, whoami
, ping
, etc. in a normal or admin powershell window. When I try to run them straight up (e.g., type in ipconfig
I get an error:
ipconfig : The term 'ipconfig' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ ipconfig
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (ipconfig:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
When I run the commands with the full path (e.g., & C:WindowsSystem32ipconfig.exe
), PS runs them in a new window that opens and then immediately closes.
This came up as I was trying to set up SSH for Home Assistant I’m running on a Raspberry Pi. I can connect, I just can’t do it with ssh username@IP
, which sent me down a powershell rabbit hole.
Everything that’s wrong in PS works fine in the command prompt. I could probably ignore this but I’d like to fix it – being new to this sort of thing, I want to try to limit the number of things that can go wrong and I feel like having a broken powershell is a bad foundation.
I’m on Windows 11, PS version 5.1. Everything else in my system seems to be working fine. This problem persists across both my personal and work account, and when running PS with no profile (-NoProfile
).
I feel like it could be something to do with my PATH variables. I ran PS C:\Users\<user>> $env:PATH -split ';'
, which gave me this list of variables:
C:Windowssystem32
C:Windows
C:WindowsSystem32Wbem
C:WindowsSystem32WindowsPowerShellv1.0
C:WindowsSystem32OpenSSH
C:WindowsSystem32
C:Windowssystem32
C:Windows
C:WindowsSystem32Wbem
C:WindowsSystem32WindowsPowerShellv1.0
C:WindowsSystem32OpenSSH
C:Users<user>AppDataLocalProgramsPythonPython312Scripts
C:Users<user>AppDataLocalProgramsPythonPython312
C:Users<user>AppDataLocalMicrosoftWindowsApps
ANY help would be greatly appreciated — this is driving me nuts. Thanks in advance.
Here’s what I’ve tried:
- Checked execution policy, which is set to
RemoteSigned
- Verified
System32
is present in PATH - Checked for issues with Powershell profiles, reset the profile, tried running with no profile.
- Verified PS was set to
FullLanguage
- Ran commands with full path – this is where they opened then immediately closed.
- Checked System32 permissions.
- Verified filetype associations for .exe are correct.
- Checked for an alias for any of the commands that won’t won’t work.
- Attempted to repair powershell with
Install-Module -Name PowerShellGet -Force -AllowClobber
This asked me if I wanted to install NuGet, I said yes, and then after that everything working — until I closed and tried in a new PS window. - Ran
sfc /scannow
and DISM, repaired issues. - Checked for malware and tried with the firewall off.
Tyler Holbrook is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.