Useful powershell commands

I’ve been using Powershell more often the last year and a half. Looking back almost all of my Powershell adventures start with the same few commands:

get-command

When I’m looking for a cmdlet to perform an action I use get-command to find suitable cmdlets.  For example get-command *move*  will list all cmdlets with move somewhere in their name.

get-help

Quite obvious, this shows the help page of the powershell cmdlet you provide as a parameter. Using get-help with -examples will provide you with (usually) helpful examples to get you on the right track. Using the -full parameter shows you all the help content for the cmdlet right away.

invoke-command

Invoke-command allows you to execute a (single) command on local or a remote machine. I use this to fire off commands to one or more single computers. Important to me is the -filepath parameter which allows me to point to a local script and execute it on the remote machine(s).

enter-pssession

This allows you to enter an interactive powershell-session on a remote machine allowing you to execute all kind of commands as if you are using a local shell session. Compare it with the ssh shell common in Unix/Linux world.

Yes it is true, in the end Microsoft re-invents Unix. This doesn’t take anything away from the fact that Powershell is a welcome addition to the tools available for administering Windows systems.