Error in PowerShell Help

“help excel” or “help *excel” or "help excel yields

Line |
64 | $help = Get-Help @PSBoundParameters
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Command gcloud config config-helper --force-auth-refresh --format=json failed with error: ‘gcloud’ is not recognized as an internal or external command,
operable program or batch file.

Any ideas?

I’m running Windows 11 Pro on a Dell Precision laptop, PS 7.4, Visual Studio Code.

I’m not able to reproduce. I also didn’t know you could just type ‘help’ to run get-help, looks like it’s an actual function. TIL :smiley:

  1. Does the same thing happen using Get-Help? what about as a one-off command? It seems like you are running it as part of a script, based on your error, but you state the way the question is worded it seems like you’re just running help excel, so i’m a bit confused.
  2. Is this part of a larger script? If so, can you share, and any particular reason you are running this in a script? Generally running help commands aren’t done as part of scripts. Also it seems like it’s complaining about gcloud not being a recognized command. Are you sure that’s not the source of your issue? I feel like I’m missing some context. To rule out the gcloud being the source of the error I’d suggest referencing the full path in your script, or updating your environmental system variable (likely path) to include the folder to where gcloud is.

I am new to PowerShell. I am following along in the book “Learn PowerShell in a Month of Lunches” and I am trying different commands. I got the error above while experimenting. It acts as if I do not have the Google Cloud module loaded but I do.

Hey Paul,

Please review my previous post, I am pretty sure if you try my answer it’ll fix the issue. I’ll go into a bit more detail below. If it doesn’t you have to provide the details I asked for.

I don’t think your issue is powershell, though you potentially have an alias set for help or perhaps you’ve defined a function for help that overrides the default behavior. That’s the first thing I’d look into. Additionally whatever is being called is trying to run the gcloud command and that executable isn’t in your system path variable. A quick google search suggests this might be part of the gcloud CLI : Install the gcloud CLI | Google Cloud CLI Documentation

So I think it’s throwing the error that it can’t find gcloud. This isn’t really PowerShell related. You can do either of the things I suggested:

  1. Use the full path in your command or
  2. add the folder path to the system path. Looks like the default path might be C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin. I tested this, and it works:

So please do add that path (or whatever path you used for the install) and try it again (you need to relaunch PS)

Is it possible you’ve set up an alias for help that isn’t calling Get-Help? It looks like help might be running a script instead of Get-Help.

What’s the output of:

Get-Alias help

This works for any Get-* cmdlet. I think it’s a bit of strange design decision because while it makes sense for something like Get-Help. It’s not at all intuitive to just type ChildItem or ActiveDirectory -filter *

There’s definitely something different about help though.

Get-Command Help returns a function while Get-Command ChildItem doesn’t and instead errors out… help seems to be defined as a function and ultimately operates similar to Get-Help. However it is not get-help and actually calls it, from what I can see. It has a scriptblock property and the script/definition there’s some things I’ve rarely seen like forwarding help to a different target, and in the code itself it actually calls Get-Help @PSBoundParameters. Pretty Interesting.

Obviously adding a wild card before ChildItem would make it work and return a cmdlet. While typing ChildItem as you suggested works, `Help’ is definitely defined as a function by default. In any case, It’s definitely best practice to avoid.

Yeah, this is interesting. It is a proxy for Get-Help, its main advantage is that it pipes the content to more (on Windows) and less on Linux:

Help is a function that pipes Get-Help to a function named more, which is a wrapper for the executable file in Windows. In the PowerShell console, help provides one page of help at a time. In the ISE, it works the same way as Get-Help. My recommendation is to use the help function instead of the Get-Help cmdlet since it provides a better experience and it’s less to type.

1 Like

Nice find, my google-fu was failing when I was trying to learn about it. Thanks for sharing!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.