You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I kept getting this error message on powershell and was wondering what it could be from:
PowerShell 7.5.0
\System.Management.Automation.Internal.Host.InternalHost.UI.RawUI: C:\Users\Eino\Documents\PowerShell\Microsoft.PowerShell_profile.ps1:2
Line |
2 | if (\System.Management.Automation.Internal.Host.InternalHost.UI.RawUI …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The term '\System.Management.Automation.Internal.Host.InternalHost.UI.RawUI' is not recognized as a name of a
| cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was
| included, verify that the path is correct and try again.
Loading personal and system profiles took 681ms.
So I went to my favorite brainless assistant (chatgpt) for answers, and the fix was to edit Microsoft.PowerShell_profile.ps1 from this:
# Begin XPipe Fix - ensure profile runs only in interactive sessions
if (\System.Management.Automation.Internal.Host.InternalHost.UI.RawUI -and \System.Management.Automation.Internal.Host.InternalHost.Name -eq "ConsoleHost") {
#f45873b3-b655-43a6-b217-97c00aa0db58 PowerToys CommandNotFound module
Import-Module -Name Microsoft.WinGet.CommandNotFound
#f45873b3-b655-43a6-b217-97c00aa0db58
}
# End XPipe Fix
to this:
# Begin XPipe Fix - ensure profile runs only in interactive sessions
if ($host.UI.RawUI -and $host.Name -eq "ConsoleHost") {
# f45873b3-b655-43a6-b217-97c00aa0db58 PowerToys CommandNotFound module
Import-Module -Name Microsoft.WinGet.CommandNotFound
# f45873b3-b655-43a6-b217-97c00aa0db58
}
# End XPipe Fix
And viola - no more error message when powershell opens. I suggest this fix or something like it be applied to fix the error at the source.
The text was updated successfully, but these errors were encountered:
Yeah, that is a bit unfortunate that some powershell modules don't perform this check by themselves. The only alternative would be to just not load any profile for non-interactive sessions, but that would also not be ideal
I tried to fix this in https://github.com/xpipe-io/xpipe-ptb by just not running the profile in non-interactive mode. You can try whether it works for you now even without the adjustment to the profile file
I kept getting this error message on powershell and was wondering what it could be from:
So I went to my favorite brainless assistant (chatgpt) for answers, and the fix was to edit Microsoft.PowerShell_profile.ps1 from this:
to this:
And viola - no more error message when powershell opens. I suggest this fix or something like it be applied to fix the error at the source.
The text was updated successfully, but these errors were encountered: