在Windows Server 2012中使用PowerShell添加和刪除Windows角色和功能非常方便,但是在windows 8.1上啟用和禁用Windows選項卻略顯雞肋。
比如Get-WindowsOptionalFeature獲取當前所有的Windows功能選項:
代碼如下:
PS> Get-WindowsOptionalFeature -Online | select * -First 1
FeatureName : Microsoft-Hyper-V-All
State : Enabled
Path :
Online : True
WinPath :
SysDrivePath :
RestartNeeded : False
LogPath : I:/Windows/Logs/DISM/dism.log
ScratchDirectory :
LogLevel : WarningsInfo
Microsoft-Hyper-V-All到底是什么?是不是下圖中的Windows功能對話框中的Hyper-V,還是Hyper-V管理平臺。如果能有一個英文的FeatureName和下圖中本地化名稱對應(yīng)就好了。
PowerShell獲取Windows功能選項
幸好WMI中的Win32_OptionalFeature可以做到這一點:
代碼如下:
Get-WmiObject -Class Win32_OptionalFeature |
Select Name,Caption |
ConvertTo-Html
輸出結(jié)果為:
Name | Caption |
---|---|
Microsoft-Hyper-V-All | Hyper-V |
Microsoft-Hyper-V-Tools-All | Hyper-V 管理工具 |
Microsoft-Hyper-V | Hyper-V 平臺 |
Microsoft-Hyper-V-Management-Clients | Hyper-V GUI 管理工具 |
Microsoft-Hyper-V-Management-PowerShell | Windows PowerShell 的 Hyper-V 模塊 |
Printing-Foundation-Features | 打印和文件服務(wù) |
Printing-Foundation-LPRPortMonitor | LPR 端口監(jiān)視器 |
Printing-Foundation-LPDPrintService | LPD 打印服務(wù) |
Printing-Foundation-InternetPrinting-Client | Internet 打印客戶端 |
FaxServicesClientPackage | Windows 傳真和掃描 |
ScanManagementConsole | 掃描管理 |
LegacyComponents | 舊版組件 |
DirectPlay | DirectPlay |
SimpleTCP | 簡單 TCPIP 服務(wù)(即 echo、daytime 等) |
SNMP | 簡單網(wǎng)絡(luò)管理協(xié)議(SNMP) |
WMISnmpProvider | WMI SNMP 提供程序 |
Windows-Defender-Default-Definitions |
學習交流
熱門圖片
猜你喜歡的新聞
猜你喜歡的關(guān)注
新聞熱點 2020-05-28 23:13:17
2020-05-28 23:09:45
2020-05-28 23:04:03
2020-05-28 23:02:21
2020-05-25 21:14:52
2020-05-25 21:13:17
疑難解答 圖片精選 |