在Windows Server 2012中使用PowerShell添加和刪除Windows角色和功能非常方便,但是在windows 8.1上啟用和禁用Windows選項卻略顯雞肋。
比如Get-WindowsOptionalFeature獲取當前所有的Windows功能選項:
FeatureName : Microsoft-Hyper-V-All
State : Enabled
Path :
Online : True
WinPath :
SysDrivePath :
RestartNeeded : False
LogPath : I:/Windows/Logs/DISM/dism.log
ScratchDirectory :
LogLevel : WarningsInfo

PowerShell獲取Windows功能選項
幸好WMI中的Win32_OptionalFeature可以做到這一點:
| 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 | 打印和文件服務 |
| Printing-Foundation-LPRPortMonitor | LPR 端口監視器 |
| Printing-Foundation-LPDPrintService | LPD 打印服務 |
| Printing-Foundation-InternetPrinting-Client | Internet 打印客戶端 |
| FaxServicesClientPackage | Windows 傳真和掃描 |
| ScanManagementConsole | 掃描管理 |
| LegacyComponents | 舊版組件 |
| DirectPlay | DirectPlay |
| SimpleTCP | 簡單 TCPIP 服務(即 echo、daytime 等) |
| SNMP | 簡單網絡管理協議(SNMP) |
| WMISnmpProvider | WMI SNMP 提供程序 |
| Windows-Defender-Default-Definitions | |
| Windows-Identity-Foundation | Windows Identity Foundation 3.5 |
| MicrosoftWindowsPowerShellV2Root | Windows PowerShell 2.0 |
| MicrosoftWindowsPowerShellV2 | Windows PowerShell 2.0 Engine |
| DirectoryServices-ADAM-Client | Active Directory 輕型目錄服務 |
| Internet-Explorer-Optional-amd64 | Internet Explorer 11 |
| NetFx3 | .NET Framework 3.5 (包括 .NET 2.0 和 3.0) |
| IIS-WebServerRole | Internet Information Services |
| IIS-WebServer | 萬維網服務 |
| IIS-CommonHttpFeatures | 常見 HTTP 功能 |
| IIS-HttpErrors | HTTP 錯誤 |
| IIS-HttpRedirect | HTTP 重定向 |
| IIS-ApplicationDevelopment | 應用程序開發功能 |
| IIS-NetFxExtensibility | .NET Extensibility 3.5 |
| IIS-NetFxExtensibility45 | .NET Extensibility 4.5 |
| IIS-HealthAndDiagnostics | 運行狀況和診斷 |
| IIS-HttpLogging | HTTP 日志 |
| IIS-LoggingLibraries | 日志工具 |
| IIS-RequestMonitor | 請求監視器 |
| IIS-HttpTracing | 跟蹤 |
| IIS-Security | 安全性 |
| IIS-URLAuthorization | URL 授權 |
| IIS-RequestFiltering | 請求篩選 |
| IIS-IPSecurity | IP 安全 |
| IIS-Performance | 性能功能 |
| IIS-HttpCompressionDynamic | 動態內容壓縮 |
| IIS-WebServerManagementTools | Web 管理工具 |
| IIS-ManagementScriptingTools | IIS 管理腳本和工具 |
| IIS-IIS6ManagementCompatibility | IIS 6 管理兼容性 |
| IIS-Metabase | IIS 元數據庫和 IIS 6 配置兼容性 |
| WAS-WindowsActivationService | Windows Process Activation Service |
| WAS-ProcessModel | 進程模型 |
| WAS-NetFxEnvironment | .NET 環境 |
| WAS-ConfigurationAPI | 配置 API |
| IIS-HostableWebCore | Internet Information Services 可承載的 Web 核心 |
| IIS-CertProvider | 集中式 SSL 證書支持 |
| IIS-WindowsAuthentication | Windows 身份驗證 |
| IIS-DigestAuthentication | 摘要式身份驗證 |
| IIS-ClientCertificateMappingAuthentication | 客戶端證書映射身份驗證 |
| IIS-IISCertificateMappingAuthentication | IIS 客戶端證書映射身份驗證 |
| IIS-ODBCLogging | ODBC 日志記錄 |
| IIS-StaticContent | 靜態內容 |
| IIS-DefaultDocument | 默認文檔 |
| IIS-DirectoryBrowsing | 目錄瀏覽 |
| IIS-WebDAV | WebDAV 發布 |
| IIS-WebSockets | WebSocket 協議 |
| IIS-ApplicationInit | 應用程序初始化 |
| IIS-ASPNET | ASP.NET 3.5 |
| IIS-ASPNET45 | ASP.NET 4.5 |
| IIS-ASP | ASP |
| IIS-CGI | CGI |
| IIS-ISAPIExtensions | ISAPI 擴展 |
| IIS-ISAPIFilter | ISAPI 篩選器 |
| IIS-ServerSideIncludes | 服務器端包含 |
| IIS-CustomLogging | 自定義日志 |
| IIS-BasicAuthentication | 基本身份驗證 |
| IIS-HttpCompressionStatic | 靜態內容壓縮 |
| IIS-ManagementConsole | IIS 管理控制臺 |
| IIS-ManagementService | IIS 管理服務 |
| IIS-WMICompatibility | IIS 6 WMI 兼容性 |
| IIS-LegacyScripts | IIS 6 腳本工具 |
| IIS-LegacySnapIn | IIS 6 管理控制臺 |
| IIS-FTPServer | FTP 服務器 |
| IIS-FTPSvc | FTP 服務 |
| IIS-FTPExtensibility | FTP 擴展性 |
| MSMQ-Container | Microsoft Message Queue (MSMQ) 服務器 |
| MSMQ-Server | Microsoft Message Queue (MSMQ) 服務器核心 |
| MSMQ-Triggers | MSMQ 觸發器 |
| MSMQ-ADIntegration | MSMQ Active Directory 域服務集成 |
| MSMQ-HTTP | MSMQ HTTP 支持 |
| MSMQ-Multicast | 多播支持 |
| MSMQ-DCOMProxy | MSMQ DCOM 代理 |
| WCF-Services45 | WCF 服務 |
| WCF-HTTP-Activation45 | HTTP 激活 |
| WCF-TCP-Activation45 | TCP 激活 |
| WCF-Pipe-Activation45 | 命名管道激活 |
| WCF-MSMQ-Activation45 | 消息隊列(MSMQ)激活 |
| WCF-TCP-PortSharing45 | TCP 端口共享 |
| WCF-HTTP-Activation | Windows Communication Foundation HTTP 激活 |
| WCF-NonHTTP-Activation | Windows Communication Foundation 非 HTTP 激活 |
| NetFx4-AdvSrvs | .NET Framework 4.5 高級服務 |
| NetFx4Extended-ASPNET45 | ASP.NET 4.5 |
| MediaPlayback | 媒體功能 |
| WindowsMediaPlayer | Windows Media Player |
| Microsoft-Windows-MobilePC-Client-Premium-Package-net | 網絡投影 |
| Microsoft-Windows-MobilePC-LocationProvider-INF | Windows 定位程序 |
| Printing-XPSServices-Features | XPS 服務 |
| RasCMAK | RAS 連接管理器管理工具包(CMAK) |
| RasRip | RIP 偵聽器 |
| MSRDC-Infrastructure | 遠程差分壓縮 API 支持 |
| SearchEngine-Client-Package | Windows Search |
| TelnetClient | Telnet 客戶端 |
| TelnetServer | Telnet 服務器 |
| TFTP | TFTP 客戶端 |
| TIFFIFilter | Windows TIFF IFilter |
| Xps-Foundation-Xps-Viewer | XPS 查看器 |
| WorkFolders-Client | 工作文件夾客戶端 |
| SMB1Protocol | SMB 1.0/CIFS 文件共享支持 |
新聞熱點
疑難解答
圖片精選