Free Download: CMD to PowerShell Guide for AD

New Years ResolutionSkip the treadmill. Learn PowerShell.

Hi folks. It's your friendly, neighborhood PFE again. In order to avoid the long lines to buy a treadmill the first week of January I thought I would save you some time and give you an easier New Years Resolution… Learn PowerShell.

It's time to part with "blankie".

For years many of us have relied on trusty command line utilities like PING, IPCONFIG, and REPADMIN. Some of us are still hanging on to those instead of embracing the brave new world of PowerShell.

In an effort to assist with the transition and to introduce some of the cool new cmdlets in PowerShell v3 I have created a free reference guide showing how the old meets the new. For example, instead of PING try the PowerShell cmdlet Test-Connection, instead of NSLOOKUP use Resolve-DNSName, instead of GPUPDATE use Invoke-GPUpdate.

The guide attached at the bottom of this blog post contains four packed pages of PowerShell pleasure for your perusing.

Why?

Why would someone want to use PowerShell instead of command line utilities? There are several reasons:

  1. Command line utilities often give us the data we want, but it is flat text that requires parsing to do anything else with it. Have you ever scripted a command line PING and tried to find the result? Yeah, I have, and it's a pain. Now with PowerShell you can simply reference the ping result properties coming back to easily get the actual data involved.
  2. Is your favorite command line utility always available? When you would RDP to a server back in the day you had no idea if the adminpak.msi or the Windows Resource Kit was installed. Now you know that PowerShell is always there on Windows Server 2008 R2 and above.
  3. PowerShell cmdlets mostly use the same syntax. You no longer have to figure out what the right switch is for the remote computer name. Now it is always "-ComputerName".
  4. PowerShell is not just the future, it's now. Version 1 was released five years ago. Now all of the Microsoft server products use PowerShell. Windows 8 and Server 2012 now have thousands of cmdlets at your finger tips.

Free Download

While studying the new 2012 cmdlets in preparation for conference talks last summer I created a quick cheat sheet for PowerShell equivalence to REPADMIN and DNSCMD. The other day I sat down and expanded this to include a raft of familiar utilities:

REPADMIN DCPROMO CSVDE NETDOM NLTEST GPUPDATE GPRESULT

DSGET DSQUERY DSADD DSMOD DSRM DSMOVE DSACLS

DNSCMD NSLOOKUP PING IPCONFIG NETSTAT

This guide will get you off and running to convert any old batch files you still have lying around or hiding in scheduled tasks.

Four pages. Really?

Yes. I know that sounds like a lot to learn, but the good news is I can't remember them all either. I work for Microsoft, and I still use Show-Command, Get-Command, and Get-Help on a daily basis. That's why we put those cmdlets in the box. With over 2,400 cmdlets now there's a good chance we've got you covered for anything you need. If not, let us know on the Connect site.

There are so many command line utilities out there that I had to limit my focus to those related to Active Directory. Hopefully this post will inspire others in the community to compile similar guides for their technologies.

Disclaimer

I created this guide based on my personal knowledge of the tools and the help text that they print. In other words this is not a top secret guide published by Microsoft product groups, and I have not tested every single entry. Some of these will require you to use Get-Help to explore the capabilities. I built this by hand in Excel, so you may be able to find some gaps in the list. If you find any omissions or corrections please send them my way, and I'll update the document.

Enjoy. Happy New Year!

 

photo credit: eccampbell via photopin cc

PowerShell Cmd Line Conversion Guide AD.pdf