Idera nSoftware Compellent

Bug when using parameter with alias cmdlet ...

rated by 0 users
This post has 13 Replies | 2 Followers

Top 50 Contributor
Posts 7
Max Trinidad Posted: 03-13-2009 10:19 AM

I normally tend to use the alias for the get-help cmdlet "Help".  Then, I notice when selecting the paramater, such as "-Detailed" is showing with brackets "-{Detailed}".  I wasn't expecting it.

So, its coming up with: 

PS C:\> help dir -{Detailed}

Instead of:

PS C:\> help dir -Detailed

Top 10 Contributor
Posts 209

It does not do this here.

Can you publish the signature of your help function? It seems it is not the default help function. Like:

 

function help ( ...   {

Thx!

 

 

Top 50 Contributor
Posts 7

I'm not using any custom function, just the Get-Help alias "help" already provided in PowerShell.  I can provide a screen shot but I don't see the option to do this.  This behavior doesn't happened when using Get-Help.  BTW, I'm using the Beta in Windows XP SP3.

Also, the same issue was happening with V2.1.0.19,  I tested this older Beta I had installed on my Windows 7 VM.

Thanks

Top 10 Contributor
Posts 69
Microsoft MVP
Top Contributor

Max, are you using PSCX?  If so then you may have an expanded help function.

Does "gcm help | fl definition" have anything interesting in it?  I know on my system i have an alias and function, so check to see if you have a funny alias you didn't realize was involved.

Top 50 Contributor
Posts 7

Hi Hal,

I typed the command "gcm help | fl definition" in both Microsft PowerShell console and the Beta.  The results looks idenical.

Sorry to ask... is there any way to copy/past an image in here?

Smile

Top 10 Contributor
Posts 69
Microsoft MVP
Top Contributor

Dude, we are talking about a scripting language.  Paste the code.  :)

But if you must, you can insert images using the insert media (film strip icon) buton...

Top 50 Contributor
Posts 7

For some reason I can't find what's going on with my physical machine and my Virtual Machine.  They both having the same symptoms.  But, I can always resolved to the Get-Help cmdlet which will work in my case.

:)

Top 10 Contributor
Posts 209

Reproduced on Win7.

It is a PS V2 incompatibility with the new way functions can declare parameters. This is why you only get the symptoms with the help function and not when using the cmdlet get-help.

We'll fix that momentarily. Thanks for bringing it up. There are tons of little things that need to be taken care of in PS V2.

Cheerio

Tobias

 

Top 10 Contributor
Posts 209

@Max:

CTRL+P will copy the current console content to the clipboard in a number of formats including HTML. Depending on where you paste this, it may or may not work fine.

@HAL:

Do you have suggestions for me on how to make the screen shot HTML more "portable"? You sent some suggestions a little while ago which I tried to implement... 

Top 10 Contributor
Posts 69
Microsoft MVP
Top Contributor

Tobias,

First, fix the magenta issue.  

Second, you could maybe make a Copy as Html menu item.  In other words, if I use ctrl-P and paste into this forum, I will always get the plain text because that's the only type of clipboard data the browser allows.  But if you store the html code itself in the clipboard...

 

Top 10 Contributor
Posts 209

The magenta issue can't be fixed easily because magenta is the color powershell uses as default background. Internally, it then changes the color to the blue we all know and love.

The problem on XP is that Microsoft hasn't implemented the APIs yet to read the *adjusted* console color so the HTML uses the color it *thinks* the console is using.

So to fix this, open the console properties and choose a different color. Or would you rather have me use a black color on XP systems if the current one is magenta?

Top 10 Contributor
Posts 69
Microsoft MVP
Top Contributor

I don't understand what you mean by choosing a different color.  The blue I want *is* already selected in the console properties. Always has been...

But to answer your question, I will *never* want to see magenta, I don't thjink anyone would, but black would work 95% of the time unless someone has really played around a lot with their console colors.

Top 10 Contributor
Posts 209

ok, will change to black on XP then.

Just so you understand why it is magenta:

Open powershell.exe, then open console properties. You will notice that MS powershell uses MAGENTA background color and then changes it to its pleasant blue via API.

On XP, there are no APIs for us developers to discover whether someone like powershell.exe has actually changed the console color. All we can do on XP is read the selected console background color which happens to be magenta.

That's why on XP, you see magenta. But I agree, it should be black or maybe I will even replace the magenta color by default with PowerShells blue instead.

Top 10 Contributor
Posts 69
Microsoft MVP
Top Contributor

Tobias Weltner:

Open powershell.exe, then open console properties. You will notice that MS powershell uses MAGENTA background color and then changes it to its pleasant blue via API.

Not on my system.

Page 1 of 1 (14 items) | RSS
Copyright 2010 PowerShell.com. All rights reserved.