Installing Windows Features and Optional Components such as Group Policy Management and Active Directory PowerShell module using Advanced Installer
We've recently been having problem with installing Windows Server features using Advanced Installer.
Whilst AdvancedInstaller does come with a useful Windows Features section this has slowly degraded over time - the filter textbox is broken and finding the features in the list in near impossible combined with some options not being available for Windows desktop operating systems but for servers or vice-versa.
This has been exacerbated by Microsoft having multiple user interfaces
- Server Manager (Windows Server only)
- Server Manager PowerShell (Windows Server only)
- Windows Features in Control Panel (Desktop only and deprecated)
- Optional Features in Settings (Desktop and Server but missing functionality on the server)
- Win32_OptionalFeature WMI class (Deprecated)
- Get-WindowsOptionalFeature DISM (Doesn't work when feature needs to be downloaded)
- Get-WindowsCapability DISM (Works when feature needs to be downloaded, available from Windows Server 2016 onwards)
Some more information on the cmdlets is discussed in detail on this site
https://woshub.com/install-rsat-feature-windows-10-powershell/
So this leaves you with MANY overlapping technologies and a complete mess.
The solution we opted for was to run an Inline PowerShell script in Advanced Installer.
The script must be configured to run as 64bit
The inline PowerShell custom action first checks if the machine is a server - the SKU of 175 is checked on all our installs because "Windows 10 Enterprise multi-session" reports as a server when it's actually a version of Windows 10 hacked to operated as a full RDP session host.
We then use the Server Manager module if the machine is a server, or Install-WindowsCapability if not.
#
Gets whether the machine is a server.
Function Get-IsServer
{
$domainRole = (Get-CimInstance -ClassName "Win32_ComputerSystem").DomainRole;
$sku = (Get-CimInstance -ClassName "Win32_OperatingSystem").OperatingSystemSKU;
return ($domainRole -eq 2 -or $domainRole -eq 3 -or $domainRole -eq 4 -or $domainRole -eq 5) -and $sku -ne 175;
}
#
Install for server operating systems.
if (Get-IsServer)
{
Import-Module "ServerManager";
Add-WindowsFeature "RSAT-AD-PowerShell"
Add-WindowsFeature "RSAT-DFS-Mgmt-Con"
Add-WindowsFeature "GPMC"
return;
}
#
Installs the specified Windows capability.
Function Install-WindowsCapability
{
[CmdletBinding()]
param(
[Parameter()]
[System.String] $Name
)
process
{
$capabilityInstalled = (Get-WindowsCapability -Online -Name $Name).State -eq "Installed";
if ($capabilityInstalled) { return; }
Add-WindowsCapability -Online -Name $Name;
}
}
#
Install for destop operating systems.
Install-WindowsCapability "Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0";
Install-WindowsCapability "Rsat.FileServices.Tools~~~~0.0.1.0";
Install-WindowsCapability "Rsat.GroupPolicy.Management.Tools~~~~0.0.1.0";
Why not check out our Group Policy Audit and Documentation Tool?
Comments
Post a Comment