Windows Admin Center - Installing extensions using Powershell

To support me, you can subscribe to the channel, share and like the videos, disable your ad blocker or make a donation. Thank you!

Hello,

I find it quite time consuming to have to install Windows Admin Center extensions from the interface and Powershell does it easily. I use this script when demonstrating Windows Admin Center, it allows me to add a list of extensions quickly.

# WAC server name.
$ServerName = 'srv1'
# Import the WAC module (present on the workstation with WAC).
# This may require remote Powershell
# Enter-PSSession -ComputerName $ServerName
Import-Module "$env:ProgramFiles\windows admin center\PowerShell\Modules\ExtensionTools"
# WAC address
$WAC = "https://$ServerName/"
# List of extensions (to be adapted to your needs)
$extensions = 'microsoft.security',
'msft.iis.iis-management',
'msft.sme.active-directory',
'msft.sme.cluster-creation',
'msft.sme.containers',
'msft.sme.dhcp',
'msft.sme.dns',
'msft.sme.failover-cluster',
'msft.sme.file-explorer',
'msft.sme.hyperv',
'msft.sme.software-defined-data-center',
'msft.sme.storage-migration',
'msft.sme.storage-replica',
'msft.sme.system-insights',
'msft.sme.windows-update',
'msft.sdn.acls',
'msft.sdn.logical-network',
'msft.sdn.vgw-network-connection',
'msft.sme.apps-and-features',
'msft.sme.certificate-manager',
'msft.sme.dev-guide',
'msft.sme.device-manager',
'msft.sme.event-viewer',
'msft.sme.firewall',
'msft.sme.local-users-groups',
'msft.sme.monitor',
'msft.sme.network-controller',
'msft.sme.network-settings',
'msft.sme.packetmon',
'msft.sme.powershell-console',
'msft.sme.process-viewer',
'msft.sme.registry-editor',
'msft.sme.remote-desktop',
'msft.sme.roles-features',
'msft.sme.scheduled-tasks',
'msft.sme.sdn-monitoring',
'msft.sme.service-viewer',
'msft.sme.server-manager',
'msft.sme.storage'
# List the extensions (the ID is the value to be reused to add your extension to my code)
Get-Extension $WAC | Select-Object -Property id, description
# List uninstalled extensions
Get-Extension $WAC | Where-Object {$_.status -eq 'Available' } | Select-Object -Property id, description
# Note: Partially functional, old versions of modules are sometimes listed here
# Example: msft.sme.hyperv version 2.59.0 is listed as 'Available' even though I have version 2.65 installed.
# Install extensions
# Note that I don't bother to check whether the extensions are installed
# As the list of uninstalled/installed extensions doesn't seem reliable, I'll let the installation do the thinking for me
$extensions | ForEach-Object -Process { Install-Extension -GatewayEndpoint $wac -ExtensionId $_ }

Related links