What started with the Configure your Server wizard and the introduction of Server Roles in Microsoft Windows 2000 Server, resulted in the tangible value of the Initial Configuration Tasks wizard (oobe.exe) and the Server Manager (servermanager.msc) in Windows Server 2008 and Windows Server 2008 R2.
Now, as I pointed out in Part 1, not all Server Manager functionality is available when you point it to a remote host. For these scenarios, and for repetitive tasks, you can use PowerShell.
PowerShell
One of the strong points of Windows Server 2008 R2 is the availability of PowerShell cmdlets, useable for managing most aspect of the Windows Server Operating System and built-in Roles and Features.
PowerShell Modules
Through the use of PowerShell modules, functionality can be added. The available modules are: (in alpabetical order)
Module | Server Role / Feature |
ActiveDirectory | Active Directory Domain Services |
ADRMS ** | Active Directory Rights Management Services |
AppLocker ** | AppLocker |
BestPractices ** | Best Practices Analyzer |
BitsTransfer * | Background Intelligent Transfer Service |
FailoverClusters | Failover Clustering |
GroupPolicy | Group Policy Management |
NetworkLoadbalancingClusters | Network Load Balancing |
PSDiagnostics * | PowerShell Diagnostics |
RemoteDesktopServices | Remote Desktop Services |
ServerManager ** | Server Manager |
TroubleshootingPack ** | Windows Troubleshooting Wizards |
Internet Information Services | WebAdministration |
* Available by default in Windows Server 2008 R2
** Available by default, but not in Server Core installations
Of interest to this blogpost is the ServerManager PowerShell Module. Let’s start by importing the module to our PowerShell with the one-liner below:
Import-Module ServerManager
Now, you can use the three cmdlets hidden inside this module:
- Add-WindowsFeature
- Get-WindowsFeature
- Remote-WindowsFeature
PowerShell Remoting
Just like the Server Manager MMC Snap-in (servermanager.msc) is able to remotely manage servers, PowerShell know the same trick. This can be useful for the scenarios (described in Part 1) where you cannot use the GUI.
For instance, the following code snippet can be used to remotely add the DNS Server role to a Full installation of Windows Server 2008 R2 (specified with RemoteServer):
Invoke-Command -computername RemoteServer -scriptblock {
Import-Module ServerManager
Add-WindowsFeature DNS
}
Concluding
Even though Server Manager in Windows Server 2008 R2 lacks some features when remotely managing Windows Server 2008 R2 installations, PowerShell Remoting can be used to fill in the blanks.
Further reading
Server Management in Windows Server 2008 R2
What's New in Server Manager
Windows Server 2008 R2's Improved Management Console
Server Manager for Windows Server Core 2008 R2
Why You Need Windows Server 2008 R2
Managing Windows Server 2008 R2 using PowerShell
574 Reasons Why We Are So Proud and Optimistic About W7 and WS08R2
More PowerShell in R2 tricks
Login