Reputation: 4369
I am running the PowerShell ISE on a Windows Server 2012 r2 machine. When I run the following:
Get-WindowsCapability
I get the following error:
Get-WindowsCapability : The term 'Get-WindowsCapability' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1
- Get-WindowsCapability
+ CategoryInfo : ObjectNotFound: (Get-WindowsCapability:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Am I missing a PowerShell package? How do get this feature working?
Thanks, JohnB
Upvotes: 3
Views: 21702
Reputation: 11
This command seems not to be available in Windows Server 2012. For a list of all available commands, see Deployment Image Servicing and Management (DISM).
Upvotes: 1
Reputation: 13567
Get-WindowsCapability
is a cmdlet from the DISM
module.
DISM was deployed natively with Server 2012 R2, but depending on the version of PowerShell or other configuration settings (like where your Windows partition is setup or image specific customizations), sometimes we find that we need to import the module before using it, like so:
Import-Module DISM
#or, to see which commands are in the module
Import-Module DISM -Verbose
If this fails, double check that it wasn't removed somehow. For instance, does it appear when you run the following?
Get-Module DISM -ListAvailable
If it doesn't appear, then it seems the module was removed and maybe the Windows component. No worries, we can get it back with the module too by installing the Windows Automated Deployment Kit (ADK), found here.
Update: you may find the module under this path as well
C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\
.
The module file to import would be under the x86\DISM
folder or x64\DISM
, and named dism.psm1
Upvotes: 1