Forum Discussion
Looking for insight #1
Discovering some of these things is simply a case of pot luck - unless you're willing to sit down and progressively read the documentation on docs.microsoft.com.
Most of the "interesting" articles are the ones from the online help, but a bit easier to navigate since it's all laid out for you, ala the one about common parameters (for which EA is shorthand for the ErrorAction common parameter.)
Although you've already found the answer, "-EA 0" translates to "-ErrorAction:SilentlyContinue".
I personally have beef with rampant shorthand unless you're doing basic ad hoc work from the command line that nobody else will ever read.
I feel that anything longer-lasting should be self-evident and self-documenting, but then I'm also an old geezer, so your mileage with others will vary.
Cheers,
Lain
Actually, it's crude, but you can actually dynamically pull a list of parameters and any aliases defined for them:
Get-Command -Name "Remove-Variable" | ForEach-Object { $_.Parameters.GetEnumerator() | ForEach-Object { $_.Value }| Select-Object -Property Name, Aliases }
You'd just change the name of the commandlet to whatever it is you're keen to look up the parameters for.
Cheers,
Lain
- MNtobarSep 09, 2022Copper Contributor
Thanks for the "crude". I don't suppose there is an alias for it??? ;-). :-P(I guess I could create my own.)
Being "old geezer" myself I agree. I find it slightly amusing that they created this very verbose language, which is great for self-documenting, but then got tired of all the typing so made alias a possibility. I am still on the "why is this so complicated" side of the learning curve, but I kind of get it. I am not good at typing, so I will never be a fan of PowerShell purity. I long for my days of UNIX. "cd, cat, ls, yacc, awk, …". (And I get the irony of how confusing things can be when you don't know what they mean. 🙂