微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何通过Powershell启用Windows功能

我需要使用Powershell启用两个Windows功能.但我不知道他们的名字或如何找到他们.

到目前为止,我已经设法安装IIS,并使用脚本发现here停止认应用程序池.

function InstallFeature($name) {
    cmd /c "ocsetup $name /passive"
}
InstallFeature IIS-WebServerRole
    InstallFeature IIS-WebServer
        InstallFeature IIS-CommonHttpFeatures
            InstallFeature IIS-DefaultDocument
            InstallFeature IIS-Directorybrowsing
            InstallFeature IIS-HttpErrors
            InstallFeature IIS-HttpRedirect
            InstallFeature IIS-StaticContent
        InstallFeature IIS-HealthAndDiagnostics
            InstallFeature IIS-CustomLogging
            InstallFeature IIS-HttpLogging
            InstallFeature IIS-HttpTracing
            InstallFeature IIS-LoggingLibraries
        InstallFeature IIS-Security
            InstallFeature IIS-requestfiltering
            InstallFeature IIS-WindowsAuthentication
        InstallFeature IIS-ApplicationDevelopment
            InstallFeature IIS-NetFxExtensibility
            InstallFeature IIS-ISAPIExtensions
            InstallFeature IIS-ISAPIFilter
            InstallFeature IIS-ASPNET
    InstallFeature IIS-WebServerManagementTools 
        InstallFeature IIS-ManagementConsole 
        InstallFeature IIS-ManagementScriptingTools

import-module WebAdministration

Stop-WebAppPool DefaultAppPool

寻找:

Get-WindowsFeature *ASP*
Get-WindowsFeature *activation*

安装:

Add-WindowsFeature NET-Framework-45-ASPNET
Add-WindowsFeature NET-HTTP-Activation
如果您在Windows 2008R2中有一个模块:

导入模块服务器管理器

此模块导出3个cmdlet:Get-WindowsFeature,Add-WindowsFeature和remove-WindowsFeature

所以你可以做一些像get-windowsfeature * frame *列出.net功能,并通过命令安装它添加WindowsFeature网络框架

原文地址:https://www.jb51.cc/windows/371551.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐