Tuesday, May 12, 2009

“Get” and Powershell

Sometimes you forget some cool features and remember them after months or event years…

This happened to me few times already with powershell.

So I wanted to share a simply trick I run into by accident. GET is optional in Powershell :)

Therefore you don’t need to write Get-WmiObject (in interactive session), you can use WmiObject without verb.

And it applies to your functions also:

PS C:\> function get-dog {Write-Host "Dog returned"}
PS C:\> get-dog
Dog returned
PS C:\> dog
Dog returned
PS C:\>

No comments: