The Ten Cmdlets

It seems appropriate, at this point in Windows PowerShell’s life, to really focus on the important things that we should remember every time we open the shell. These are the things that make PowerShell powerful, and the things that are too easily forgotten and overlooked – but which can really save a lot of time. With that – and tounge in cheek – here goes:

I, PowerShell, am your Tool, who brought you out of repetitive administrative tasks, out of the house of manual labor. You shall have no other shells before me.

I. You shall make for yourself an Execution Policy, and you shall set it with Set-ExecutionPolicy. You policy shall be considered, and wise, and above all safe for all earth.

II. You shall not read through lists of data yourself; instead thou shalt use Where-Object to reduce thy lists to just those item which thou needest most.

III. You shall place your lists into the order most needful to thee and thy kin, using Sort-Object.

IV. Thou shalt reach out to remote computers and manage them, and they shall render management information unto you, by using Get-WMIObject.

V. Thou shalt navigate all forms of storage equally, using Get-ChildItem and Set-Location.

VI. Thou shalt honor thy credentials and keep them safe, and use only Get-Credential to save them into a variable.

VII. Thou shalt instantiate COM components when need arises, and thou shalt use New-Object with the -comObject parameter to do so.

VIII. Thou shalt debug thy scripts when they go wrong, and Set-PSDebug will make this easier.

IX. Graphical dialogs thou shalt not use; instead, thou shalt use Read-Host to accept input from the command-line.

X. Thou shalt type as little as possible, for typing takes too much time. Thou shalt use Set-Alias to make longer cmdlet names into shorter ones.

If you’re using these ten (well, eleven) cmdlets, then you’re really using PowerShell. Anything less is just… well… a sin.

 

Technorati tags: ,

del.icio.us tags: ,