Quantcast
Channel: Windows Server 2012 – The Wiert Corner – irregular stream of stuff
Viewing all articles
Browse latest Browse all 53

Different ways for installing Windows features on the command line – Peter Hahndorf

$
0
0

If course you can configure Windows Optional Features using the GUI as for instance explained at [Wayback/Archive] How to manage Windows 10’s many ‘optional features | Windows Central.

However, I prefer command-line management.

About the only post doing the comparison of command-line mangement options I could find about is [Wayback/Archive] Different ways for installing Windows features on the command line – Peter Hahndorf and hopefully will be further updated in the future. It is dated 2015, but has been updated until at least Windows Server Nano.

I added one, and then rewrote the tool-set availability table in the post into this:

  • winget
  • *-WindowsCapability
  • *-WindowsOptionalFeature
  • *-WindowsFeature
  • dism.exe
  • pkgmgr.exe
Vista+2008 Win7 2008 R2 Win8.* 2012 R* Win10 2016 Nano Source
*-WindowsOptionalFeature * * * * * Dism module
*-WindowsCapability * * ? Dism module
*-WindowsFeature * * ServerManager module
winget.exe * *
dism.exe * * * * * * * %SystemRoot%\System32
pkgmgr.exe * * * * * * * * %SystemRoot%\System32

On modules: [Wayback/Archive] PowerShell 7 module compatibility – PowerShell | Microsoft Docs / [Wayback/Archive] PowerShell-Docs/module-compatibility.md at staging · MicrosoftDocs/PowerShell-Docs

MODULE LIST
Module name Status Supported OS
Dism Natively Compatible Windows Server 1903+
Windows 10 1903+
ServerManager Natively Compatible Windows Server 1809+
Windows 10 1809+ with Rsat.ServerManager.Tools
See notes below

ServerManager module

This module has some minor compatibility issues with formatted output in PowerShell 7. For example, the Get-WindowsFeature cmdlet returns the proper object with all properties, but the default display formatting makes some properties appear to be empty. The actual values are available in the object properties using Select-Object or by direct member access.

Note that not all tool can perform all kinds of installations, for instance:

Some more details on the various tool sets are below. I included [Wayback/Archive] SS64 Command line reference reference next to [Wayback/Archive] Developer tools, technical documentation and coding examples | Microsoft Docs as SS64 documents more commands and better “See also” links.

*-WindowsCapability

Part of the PowerShell [Wayback/Archive] DISM Module | Microsoft Docs available as of Windows 10 1903+ and Windows Server 2016 1903+.

*-WindowsOptionalFeature

Part of the PowerShell [Wayback/Archive] DISM Module | Microsoft Docs available as of Windows 8 and Windows Server 2012.

This is also documented in [Wayback/Archive] Add or hide optional apps and features on Windows devices – Windows Application Management | Microsoft Docs

*-WindowsFeature

Part of the PowerShell [Wayback/Archive] ServerManager Module | Microsoft Docs available as of Windows Server 2012 (available as of Windows 10 1809+ only if Rsat.ServerManager.Tools is installed).

winget.exe

Available as of Windows 10 2004+

Just like in the UI, on the CLI you also often need to accept source agreement terms (once per source) or package agreement terms (once per package). Via [Wayback/Archive] winget accept terms commandline switch – Google Search I found:

At the time of writing, there was no way to install Microsoft Store applications through winget without having a Microsoft Store account. When trying you get the error “no store account found“. Direct download from the store does not require such an account. See these links:

Also at the time of writing there was no official PowerShell PackageManagement Module support for winget, but there is:

More on the PowerShell PackageManagement structure at [Wayback/Archive] windows – PowerShell Package Management – Repository vs Provider vs Source – Stack Overflow

And most API calls in [Wayback/Archive] PackageManagement Module – PowerShell | Microsoft Docs (few are in [Wayback/Archive] PowerShell commands – PowerShell – SS64.com):

dism.exe

Available as of Windows 7 and Windows Server 2008 R2.

pkgmgr.exe

Available as of Windows Vista and Windows Server 2008.

Other commands

–jeroen


Viewing all articles
Browse latest Browse all 53

Trending Articles