Użyj Windows PowerShell, aby zainstalować opcjonalne funkcje

Microsoft Windows jest dostarczany z zestawem tak zwanych opcjonalnych funkcji, które użytkownicy mogą włączać lub wyłączać za pomocą apletu panelu sterowania „Włącz lub wyłącz funkcje systemu Windows”.

W większości przypadków działa to dobrze, ale wymaga otwarcia Panelu sterowania w systemie operacyjnym, chyba że bezpośrednio załadujesz okno Funkcje, wpisując opcjonalne funkcje w menu Start.

Chociaż wystarcza to przez większość czasu, administratorzy mogą również używać programu PowerShell do zarządzania opcjonalnymi funkcjami systemu operacyjnego Windows.

Poniższy przewodnik zawiera przegląd tego, jak to działa w systemie Windows 10. Pamiętaj, że może to nie działać w poprzednich wersjach systemu Windows, takich jak Windows 7.

Windows PowerShell: zainstaluj opcjonalne funkcje

Potrzebujesz podwyższonego programu PowerShell dla następujących poleceń. Naciśnij klawisz Windows, wpisz PowerShell, przytrzymaj klawisz Ctrl i Shift, a następnie naciśnij klawisz Enter, aby otworzyć monit PowerShell z uprawnieniami administratora.

Wymień wszystkie opcjonalne funkcje i ich status

Pierwszą rzeczą, którą możesz chcieć zrobić, przynajmniej gdy dopiero zaczynasz korzystać z polecenia, jest wyświetlenie listy dostępnych funkcji.

Uruchom get-windowsoptionalfeature -online, aby wyświetlić listę wszystkich dostępnych nazw funkcji i ich stanów w systemie komputerowym. Stan jest włączony lub wyłączony.

Uwaga: parametr -online oznacza, że ​​akcje są uruchamiane na bieżącym urządzeniu.

Chociaż można łatwo zidentyfikować niektóre funkcje według nazwy funkcji, nie wszystkie są łatwe.

Poniższa lista pochodzi z wersji Windows 10 Pro 1809

  • FeatureName: Printing-PrintToPDFServices-Features
  • FeatureName: Windows-Defender-Default-Definitions
  • FeatureName: Printing-XPSServices-Features
  • FeatureName: SearchEngine-Client-Package
  • FeatureName: MSRDC-Infrastruktura
  • FeatureName: TelnetClient
  • FeatureName: TFTP
  • FeatureName: TIFFIFilter
  • FeatureName: WorkFolders-Client
  • FeatureName: LegacyComponents
  • FeatureName: DirectPlay
  • FeatureName: Funkcje drukowania - podstawa
  • FeatureName: FaxServicesClientPackage
  • FeatureName: Printing-Foundation-InternetPrinting-Client
  • FeatureName: Printing-Foundation-LPDPrintService
  • FeatureName: Printing-Foundation-LPRPortMonitor
  • FeatureName: SimpleTCP
  • FeatureName: MicrosoftWindowsPowerShellV2Root
  • FeatureName: MicrosoftWindowsPowerShellV2
  • FeatureName: Windows-Identity-Foundation
  • FeatureName: Microsoft-Windows-Subsystem-Linux
  • FeatureName: HypervisorPlatform
  • FeatureName: VirtualMachinePlatform
  • FeatureName: Client-ProjFS
  • FeatureName: NetFx4-AdvSrvs
  • FeatureName: NetFx4Extended-ASPNET45
  • FeatureName: IIS-WebServerRole
  • FeatureName: IIS-WebServer
  • FeatureName: IIS-CommonHttpFeatures
  • FeatureName: IIS-HttpErrors
  • FeatureName: IIS-HttpRedirect
  • FeatureName: IIS-ApplicationDevelopment
  • FeatureName: IIS-NetFxExtensibility
  • FeatureName: IIS-NetFxExtensibility45
  • FeatureName: IIS-HealthAndDiagnostics
  • FeatureName: IIS-HttpLogging
  • FeatureName: IIS-LoggingLibraries
  • FeatureName: IIS-RequestMonitor
  • FeatureName: IIS-HttpTracing
  • FeatureName: IIS-Security
  • FeatureName: IIS-URLAuthorization
  • FeatureName: IIS-RequestFiltering
  • FeatureName: IIS-IPSecurity
  • FeatureName: IIS-Performance
  • FeatureName: IIS-HttpCompressionDynamic
  • FeatureName: IIS-WebServerManagementTools
  • FeatureName: IIS-ManagementScriptingTools
  • FeatureName: IIS-IIS6ManagementCompatibility
  • FeatureName: IIS-Metabase
  • FeatureName: WAS-WindowsActivationService
  • FeatureName: WAS-ProcessModel
  • FeatureName: WAS-NetFxEnvironment
  • FeatureName: WAS-ConfigurationAPI
  • FeatureName: IIS-HostableWebCore
  • FeatureName: IIS-StaticContent
  • FeatureName: IIS-DefaultDocument
  • FeatureName: IIS-DirectoryBrowsing
  • FeatureName: IIS-WebDAV
  • FeatureName: IIS-WebSockets
  • FeatureName: IIS-ApplicationInit
  • FeatureName: IIS-ASPNET
  • FeatureName: IIS-ASPNET45
  • FeatureName: IIS-ASP
  • FeatureName: IIS-CGI
  • FeatureName: IIS-ISAPIExtensions
  • FeatureName: IIS-ISAPIFilter
  • FeatureName: IIS-ServerSideIncludes
  • FeatureName: IIS-CustomLogging
  • FeatureName: IIS-BasicAuthentication
  • FeatureName: IIS-HttpCompressionStatic
  • FeatureName: IIS-ManagementConsole
  • FeatureName: IIS-ManagementService
  • FeatureName: IIS-WMICompatibility
  • FeatureName: IIS-LegacyScripts
  • FeatureName: IIS-LegacySnapIn
  • FeatureName: IIS-FTPServer
  • FeatureName: IIS-FTPSvc
  • FeatureName: IIS-FTPExtensibility
  • FeatureName: WCF-Services45
  • FeatureName: Aktywacja WCF-HTTP45
  • FeatureName: Aktywacja WCF-TCP45
  • FeatureName: WCF-Pipe-Activation45
  • FeatureName: Aktywacja WCF-MSMQ45
  • FeatureName: WCF-TCP-PortSharing45
  • FeatureName: MSMQ-Container
  • FeatureName: MSMQ-Server
  • FeatureName: MSMQ-Triggers
  • FeatureName: MSMQ-ADIntegration
  • FeatureName: MSMQ-HTTP
  • FeatureName: MSMQ-Multicast
  • FeatureName: MSMQ-DCOMProxy
  • FeatureName: Aktywacja WCF-HTTP
  • FeatureName: Aktywacja WCF-NonHTTP
  • FeatureName: IIS-CertProvider
  • FeatureName: IIS-WindowsAuthentication
  • FeatureName: IIS-DigestAuthentication
  • FeatureName: IIS-ClientCertificateMappingAuthentication
  • FeatureName: IIS-IISCertificateMappingAuthentication
  • FeatureName: IIS-ODBCLogging
  • FeatureName: NetFx3
  • FeatureName: SMB1Protocol
  • FeatureName: SMB1Protocol-Client
  • FeatureName: SMB1Protocol-Server
  • FeatureName: SMB1Protocol-Deprecation
  • FeatureName: MediaPlayback
  • FeatureName: WindowsMediaPlayer
  • FeatureName: Microsoft-Windows-NetFx3-OC-Package
  • FeatureName: Microsoft-Windows-NetFx4-US-OC-Package
  • FeatureName: Microsoft-Windows-Client-EmbeddedExp-Package
  • FeatureName: Microsoft-Windows-NetFx3-WCF-OC-Package
  • FeatureName: Microsoft-Windows-NetFx4-WCF-US-OC-Package
  • FeatureName: Containers-DisposableClientVM
  • FeatureName: Microsoft-Hyper-V-All
  • FeatureName: Microsoft-Hyper-V
  • FeatureName: Microsoft-Hyper-V-Tools-All
  • FeatureName: Microsoft-Hyper-V-Management-PowerShell
  • FeatureName: Microsoft-Hyper-V-Hypervisor
  • FeatureName: Microsoft-Hyper-V-Services
  • FeatureName: Microsoft-Hyper-V-Management-Clients
  • FeatureName: HostGuardian
  • FeatureName: Client-DeviceLockdown
  • FeatureName: Client-EmbeddedShellLauncher
  • FeatureName: Client-EmbeddedBootExp
  • FeatureName: Client-EmbeddedLogon
  • FeatureName: Client-KeyboardFilter
  • FeatureName: Client-UnifiedWriteFilter
  • FeatureName: DataCenterBridging
  • FeatureName: DirectoryServices-ADAM-Client
  • FeatureName: Windows-Defender-ApplicationGuard
  • FeatureName: ServicesForNFS-ClientOnly
  • FeatureName: ClientForNFS-Infrastruktura
  • FeatureName: Administracja NFS
  • FeatureName: Kontenery
  • FeatureName: SmbDirect
  • FeatureName: MultiPoint-Connector
  • FeatureName: MultiPoint-Connector-Services
  • FeatureName: MultiPoint-Tools
  • FeatureName: AppServerClient
  • FeatureName: Internet-Explorer-Optional-amd64

Wyświetl informacje o funkcjach

Możesz użyć parametru -featurename Przykład, aby wyświetlić szczegółowe informacje o interesującej Cię funkcji.

Na przykład polecenie get-windowsoptionalfeature -online -featurename NetFx 3 ujawnia, że ​​instaluje on .Net Framework 3.5 w systemie. Istnieje również łącze internetowe, pod warunkiem, że możesz kliknąć, aby wyszukać dodatkowe informacje online.

Włącz lub wyłącz funkcję opcjonalną

Możesz użyć poleceń PowerShell, aby włączyć lub wyłączyć opcjonalne funkcje na komputerze z systemem Windows 10.

Służą do tego polecenia Enable-WindowsOptionalFeature -FeatureName i Disable-WindowsOptionalFeature -FeatureName.

Oto dwa przykłady pokazujące, jak to działa:

  • Enable-WindowsOptionalFeature -Online -FeatureName „NetFx3” -All - To polecenie instaluje program Net Framework 3.5 na komputerze, na którym jest ono uruchomione.
  • Disable-WindowsOptionalFeature -Online -FeatureName „NetFx3” - To polecenie ponownie wyłącza tę funkcję.

Parametr -Wszystkie nakazuje również systemowi Windows zainstalowanie wszelkich zależności. Jeśli więc funkcja nadrzędna jest wymagana do instalacji wybranej funkcji, jest ona również instalowana. Uwaga: Wyłącz nie obsługuje parametru -Wszystkie.

Zasoby

  • Microsoft Technet: Enable-WindowsOptionalFeature
  • Microsoft Technet: Disable-WindowsOptionalFeature
  • Microsoft Technet: Get-WindowsOptionalFeature