Tactical Advice

Unleash the Automation Force with Windows PowerShell

If you haven't started using PowerShell yet to manage your Windows servers, you should.
Unleash the Automation Force with Windows PowerShell
Credit: iStockphoto/ThinkStockPhotos

Businesses everywhere are looking to save money, and technology can help spend resources wisely. By automating the configuration, management and monitoring of Windows Servers, companies can decrease the time IT workers spend on manual maintenance.

Manual administration of servers is slow and prone to error. Automation on the other hand, once it's been thoroughly tested, makes for fast and reliable management. Do you want your business to be more agile? If so, start using PowerShell to manage your servers.

PowerShell’s Improved Automation Capabilities

The new 3.0 version of PowerShell included in Windows 8 and Windows Server 2012 includes new features that make automation more flexible, manageable and resilient.

For example:

  • PowerShell Workflow lets you create workflows to execute long-running tasks. These tasks can then be interrupted and restarted, repeated as needed or executed in parallel for more efficient server administration.
  • PowerShell Scheduled Jobs lets you run PowerShell jobs according to a predefined schedule or when an event occurs on the server.
  • Disconnected Sessions lets you start a PowerShell script or command on a remote computer and then disconnect from the computer while the task continues to run. If needed, you can reconnect to it from the same or a different computer without affecting the running command or script.
  • Delegated Administration lets you allow users with nonadministrative credentials to execute PowerShell scripts or commands that require administrative credentials.

These new features help make PowerShell automation easier to use and implement in different scenarios.

PowerShell Scripting Is Easier

PowerShell 3.0 is much easier to learn and use than previous PowerShell versions. For example, say you want to collect CPU usage and virtual memory used for all Windows processes that have "dfs" in their process name. In PowerShell 2.0 you had to do it like this:

PowerShell screenshot

Now, look how much easier the syntax for this command is in PowerShell 3.0:

PowerShell version 3.0

The old dollar sign-dot-underscore was one of the strange syntax features that often discouraged people from learning previous versions of PowerShell. But strangeness aside, it was also hard to type. With PowerShell 3.0 you don't need to use that construct, which makes PowerShell 3.0 scripts easier to write and read.

PowerShell Works from Anywhere

Have you ever been offsite and gotten an alert on your smartphone or notebook that one of your servers needs an intervention? It would be nice if you could fire up PowerShell on your mobile device and remotely perform the task. Consider your wish granted, because using Windows Server 2012, you can set up a gateway on the firewall of your corporate network that lets you run PowerShell commands remotely from any device that has Internet connectivity and a web browser.

This awesome new feature is called PowerShell Web Access, and its PowerShell command-line in the browser lets you run scripts and commands directly on remote computers. And don’t worry about security because PowerShell Web Access uses the HTTPS protocol for all of its activity. Here's a simplified diagram of how it works:

PowerShell diagram

PowerShell Is the Future

It's clear from the direction Microsoft products have been heading recently that the future of Windows platform administration is PowerShell. For example, many of the latest graphical user interface tools for managing Windows servers are actually GUI shells that leverage PowerShell commands under the hood to perform your management actions.

A built-in example of this is the Active Directory Administrative Center (ADAC) in Windows Server 2012, which not only executes PowerShell commands from chosen menu options but also includes a PowerShell History Viewer that lets you view the PowerShell commands used to perform selected menu actions.

For example, the screenshot below shows the PowerShell commands executed when I used ADAC to create a new user named Karen Berg in the Seattle Users organizational unit of the corp.contoso.com domain in a test environment I set up for a book I was writing:

ADAC users

In this PowerShell History Viewer I can copy these commands to the clipboard and use them to create a script for automating the bulk creation of users in Active Directory. By seeing how ADAC formats these commands, I can quickly learn more about the syntax of various PowerShell cmdlets like New-ADUser, Set-ADAccountPassword and so on.

In essence, PowerShell History Viewer is both a rapid-development tool that makes scripting easier and a learning tool that helps users master PowerShell syntax.

Where Can I Learn More?

A good starting point for learning more about PowerShell is the Windows PowerShell Survival Guide in the TechNet Wiki. This wiki covers everything from where to find useful guides and videos to how to make sure your PowerShell scripts are secure.

For more information about the new features in PowerShell 3.0, see the What's New in Windows PowerShell 3.0 topic on TechNet.

Another good place to learn about the new simplified syntax in PowerShell 3.0 is Ed Wilson's article in his Hey, Scripting Guy! Blog. MVP Keith Hill also has an excellent article about this in his blog.

If you want to use PowerShell Web Access, you can learn how to deploy it using the procedure on this TechNet page. MVP Anil Erduran also illustrates a walkthrough of installing and using PowerShell Web Access on his blog.

Finally, PowerShell 3.0 is also available for Windows 7 SP1, Windows Server 2008 R2 SP1 and Windows Server 2008 SP2. To get PowerShell 3.0 on these down-level platforms, simply install the Windows Management Framework 3.0 from the Microsoft Download Center.

Sign up for our e-newsletter

About the Author

Mitch Tulloch

Mitch Tulloch

Mitch Tulloch is a Microsoft Most Valuable Professional and lead author of the Windows 7 Resource Kit from Microsoft Press. You can follow him on Twitter at @MitchTulloch or friend him on Facebook at http://www.facebook.com/mitchtulloch.


Heartbleed: What Should Your... |
One of the biggest security vulnerabilities has almost every user and every industry...
Why Businesses Need a Next-G... |
Devices investigate patterns that could indicate malicious activity.
Review: HP TippingPoint S105... |
Next-generation firewall can easily replace a stand-alone intrusion prevention system....


The New Backup Utility Proce... |
Just getting used to the Windows 8 workflow? Prepare for a change.
How to Perform Traditional W... |
With previous versions going unused, Microsoft radically reimagined the backup utility in...
5 Easy Ways to Build a Bette... |
While large enterprises have the resources of an entire IT department behind them, these...

Infrastructure Optimization

Businesses Must Step Careful... |
Slow and steady wins the race as businesses migrate IT operations to service providers,...
Why Cloud Security Is More E... |
Cloud protection services enable companies to keep up with security threats while...
Ensure Uptime Is in Your Dat... |
Power and cooling solutions support disaster recovery and create cost savings and...


Securing the Internet of Thi... |
As excitement around the connected-device future grows, technology vendors seek ways to...
How to Maximize WAN Bandwidt... |
Understand six common problems that plague wide area networks — and how to address them.
Linksys Makes a Comeback in... |
The networking vendor introduced several new Smart Switch products at Interop this week.

Mobile & Wireless

Mobility: A Foundational Pie... |
Other technologies rely on mobile computing, which has the power to change lives, Lextech...
Now that Office for iPad Is... |
After waiting awhile for Microsoft’s productivity suite to arrive, professionals who use...
Visualization Can Help Busin... |
Companies need to put their data in formats that make it consumable anytime, anywhere.

Hardware & Software

Review: HP TippingPoint S105... |
Next-generation firewall can easily replace a stand-alone intrusion prevention system....
New Challenges in Software M... |
IT trends such as cloud, virtualization and BYOD pose serious hurdles for software...
Visualization Can Help Busin... |
Companies need to put their data in formats that make it consumable anytime, anywhere.