PowerShell Gallery contains lots of modules that you can add to a Windows Server deployment to make it easier to manage. In this article, I’ll cover a few of the ones I’ve found most useful over the years when it comes to managing Windows Server.
Before you can install any of these modules, you need to install the NuGet package provider with:
Install-PackageProvider -Name NuGet -Force
The next step is to install the PowerShellGet for module installation using:
Install-Module -Name PowerShellGet -Force
Or, if you have it already installed, ensure that it is up to date with:
Update-Module -Name PowerShellGet
You can learn more about PowerShellGet at: https://docs.microsoft.com/en-us/powershell/module/powershellget/?view=powershell-7.1?WT.mc_id=modinfra-24781-orthomas
Now that you’ve got the necessary bits in place, here are the five modules I recommend:
1: PSWindowsUpdate.
Use this module to manage Windows Updates from PowerShell (functionality that I’m endlessly surprised isn’t there in the base operating system). Especially useful if you’re working with Server Core machines and you don’t want to use sconfig.cmd to install software updates.
Install using:
Install-Module -Name PSWindowsUpdate
Notable cmdlets include:
- Add-WUServiceManager
- Enable-WURemoting
- Get-WindowsUpdate
- Get-WUApiVersion
- Get-WUHistory
- Get-WUInstallerStatus
- Get-WUJob
- Get-WULastResults
- Get-WURebootStatus
- Get-WUServiceManager
- Get-WUSettings
- Invoke-WUJob
- Remove-WindowsUpdate
- Remove-WUServiceManager
- Set-WUSettings
- Update-WUModule
- Set-PSWUSettings
- Reset-WUComponents
- Get-WUOfflineMSU
You can learn more about this module at: https://www.powershellgallery.com/packages/PSWindowsUpdate/2.2.0.2
2: Package Management
Use this module to install software packages using PowerShell in a manner reminiscent of apt-get or Chocolatey.
Install using:
Install-Module -Name PackageManagement
Notable cmdlets include:
-
Find-Package
-
Get-Package
-
Get-PackageProvider
-
Get-PackageSource
-
Install-Package
-
Import-PackageProvider
-
Find-PackageProvider
-
Install-PackageProvider
-
Register-PackageSource
-
Set-PackageSource
-
Unregister-PackageSource
-
Uninstall-Package
-
Save-Package
You can learn more about this module at:
https://docs.microsoft.com/en-us/powershell/module/packagemanagement/?view=powershell-7.1?WT.mc_id=modinfra-24781-orthomas
3. PSLogging
Use this module to manage log files for PowerShell scripts.
Install using:
Install-Module -Name PSLogging
Notable cmdlets/functions:
- Start-Log
- Write-LogInfo
- Write-LogWarning
- Write-LogError
- Stop-Log
- Send-Log
You can learn more about this module at: https://www.powershellgallery.com/packages/PSLogging/2.5.2
4. Invoke-CommandAs
This module allows you to invoke commands as a specific user or as system on either the local or remote computers through ScheduleTask.
Install using:
Install-Module -Name Invoke-CommandAs
Notable cmdlets/functions
- Invoke-CommandAs
You can learn more about this module at:
https://www.powershellgallery.com/packages/Invoke-CommandAs/3.1.6
5.0 IISAdministration
This module allows you to manage Internet Information Server using PowerShell.
Install using:
Install-Module -Name IISAdministration
Notable cmdlets/functions
- Get-IISAppPool
- Start-IISCommitDelay
- Stop-IISCommitDelay
- Get-IISSite
- Remove-IISSite
- New-IISSite
- Stop-IISSite
- Start-IISSite
- Get-IISConfigSection
- Get-IISConfigCollection
- Get-IISConfigCollectionElement
- New-IISConfigCollectionElement
- Remove-IISConfigCollectionElement
- Remove-IISConfigElement
- Clear-IISConfigCollection
- Get-IISConfigElement
- Get-IISConfigAttributeValue
- Remove-IISConfigAttribute
- Set-IISConfigAttributeValue
- Get-IISServerManager
- Reset-IISServerManager
- Get-IISCentralCertProvider
- Set-IISCentralCertProvider
- Set-IISCentralCertProviderCredential
- Clear-IISCentralCertProvider
- Disable-IISCentralCertProvider
- Enable-IISCentralCertProvider
- Enable-IISSharedConfig
- Disable-IISSharedConfig
- Export-IISConfiguration
- Get-IISSharedConfig
- Get-IISSiteBinding
- Remove-IISSiteBinding
- New-IISSiteBinding
You can learn more about this module at: https://www.powershellgallery.com/packages/IISAdministration/1.1.0.0