Powershell Sample Cmdlets – One-liners with a Punch!

Managing and troubleshooting Windows Clients and Servers is what Powershell is all about. And, the quickest way to get started is by learning a few simple Powershell cmdlets. Powershell cmdlets are short one-line commands that are specifically designed to help IT Professionals with their day to day tasks. There are a only a handful of cmdlets in a default installation of Powershell 1.0 (more can be added by installing additional cmdlet providers). To find out which cmdlets ship in Powershell 1.0, simply type “get-command” into your Powershell command prompt. Then, you can use “get-help” to learn more about each individual cmdlet. There! Now you know your first two cmdlets! You’re off and running.

If you have been to one of my TechNet Events lately, you’ve seen some cmdlets in action. Some examples of what Powershell cmdlets can do include:

  1. List the hotfixes on the local or remote computer.

  2. Browse the registry hive in a command prompt interface.

  3. Find your BIOS version, CPU speed (as well as current clock speed), and physical memory information.

  4. Find ALL of the scheduled tasks that run on Windows, including the ones that are hidden in the GUI.

  5. Install a software package on a Remote Machine. (BTW, modify the cmdlet into a slightly more advanced Powershell script file, and you could automate software installation on 1000’s of machines at once.)

  6. Query free disk space from local or remote machines.

  7. Query Network Adapter details from local or remote machines.

  8. MUCH, MUCH more.

To start using the attached sample cmdlets:

  1. Install Powershell 1.0

  2. Download and extract PowershellSampleCmdlets.zip.

  3. Copy and paste any of the non-commented lines (i.e. any line without a “#” in front of it) into your Powershell command prompt.

  4. Watch the results!

Be careful! Some of the cmdlets may do things you do not want, like stop necessary services, so run them at your own risk. To mitigate the risk, the dangerous cmdlets have -confirm switches, so you will be prompted before any bad stuff happens, but that’s all the warning you’ll get. 


Comments (1)