animind - Fotolia

Get started Bring yourself up to speed with our introductory content.

4 PowerShell modules every IT pro should know

Find out how to use four of the most popular PowerShell community modules in the PowerShell Gallery to help better manage your data center and automate certain tasks.

The PowerShell community is vibrant, with many of its developers contributing new cmdlets and scripts to the open source PowerShell Core and creating PowerShell modules that automate data center processes and management.

The majority of community modules are found on PowerShell's central repository, PowerShell Gallery. However, IT pros can also find modules or scripts on GitHub.

PSWindowsUpdate module

Deploying Windows updates with code is never an easy task, but the PSWindowsUpdate module can help. This module enables you to view update installation history and pending updates, uninstall updates, install local updates and install updates remotely.

One of the especially useful cmdlets in PSWindowsUpdate is Get-WULastResults, which retrieves the last result of a Windows update search and installation status.

Get-WULastResults

The Get-WUInstall cmdlet installs updates and can even filter for specific update categories and knowledge base (KB) updates. This example installs the KB4034658 update:

Get-WUInstall

PoshWSUS module

PoshWSUS is a module for managing the still-popular Windows Server Update Services. With this module, you can search updates installed on the WSUS server, approve or decline updates and change WSUS configurations.

There is a handy way to automate declining Windows preview updates. This example queries the WSUS server for any updates that contain the string "Preview of" that are not already declined and pipes that to Deny-PoshWSUSUpdate.

Deny-PoshWSUSUpdate

Another great task to automate with WSUS is to synchronize updates from Microsoft's servers to your internal WSUS server. You can accomplish this with the Start-PoshWSUSSync cmdlet:

PoshWSUSSync

PowerShell also enables you to easily combine cmdlets into scripts. You might, for example, sync WSUS and then set your system to decline any updates.

Carbon module

Carbon is a popular module -- and for good reason. It's a module created for many different tasks. Carbon interacts with users, websites, certificates, services, host files, file permissions and other areas in Windows.

One unique cmdlet is Get-CProgramInstallInfo, which is the equivalent of using Programs and Features in the Windows GUI.

The example below shows how to get information on a local Google Chrome installation. In this example, you can see useful information, such as the install date, language, installation source and uninstall string. Note the uninstall string is the command used to uninstall the software from the system.

Get-CProgramInstallInfo

Many applications require you to install the .NET framework on a system. With Carbon, you can use the Test-CDotNet cmdlet to see if you've installed version 2 or version 4.

Test-CDotNet

NTFSSecurity module

Though PowerShell has native support for working with NTFS file permissions, the NTFSSecurity module provides a more user-friendly and intuitive approach.

A common piece of information an IT administrator needs to know is the effective permission for a user on a file or folder. The effective permission is the result of group membership of a user, inherited permissions, nested groups and denied permissions.

Here is how the Get-NTFSEffectiveAccess cmdlet finds the effective permission of the local path c:\temp:

Get-NTFSEffectiveAccess

Another common task is setting ownership on a file or folder with NTFS. Here, the c:\temp folder is set to have "Dan" as the owner. Then, you can use Get-NTFSSOwner to display the current owner.

Set-NTFSOwner

There are more than 3,000 modules in the PowerShell Gallery, and the PowerShell community continues to publish methods to use PowerShell for automation.

Chances are, if you need to interact with a data center system, there is a PowerShell module available. Installing community modules is as simple as using the Install-Module PowerShell cmdlet.

Dig Deeper on Data center server infrastructure and OSes

Join the conversation

1 comment

Send me notifications when other members comment.

Please create a username to comment.

Which PowerShell modules do you find most useful?
Cancel

-ADS BY GOOGLE

SearchWindowsServer

SearchServerVirtualization

SearchCloudComputing

Close