zoukankan      html  css  js  c++  java
  • IIS下的身份验证方式管理

    设置、查看身份验证方式

     1 #导航到某站点下:
     2 cd IIS:SitesDemoSiteDemoApp
     3 
     4 #启用站点test01下的Windows身份验证
     5 Set-WebConfigurationProperty -filter /system.webServer/security/authentication/windowsAuthentication -name enabled -value true -PSPath IIS: -Location test01
     6 
     7 #启用站点default web site下应用程序pswa的Windows身份验证
     8 Set-WebConfigurationProperty -filter /system.webServer/security/authentication/windowsAuthentication -name enabled -value true -PSPath IIS: -Location 'default web site/pswa'
     9 
    10 #禁用站点MySite下的匿名身份验证
    11 Set-WebConfiguration system.webServer/security/authentication/anonymousAuthentication -PSPath IIS: -Location MySite -Value @{enabled="False"}
    12 
    13 #启用Form身份验证
    14 $config = (Get-WebConfiguration system.web/authentication 'IIS:sitesDefault Web Site')
    15 $config.mode = "Forms"
    16 $config | Set-WebConfiguration system.web/authentication
    17 
    18 #为MySite添加身份NTLM和Negotiate身份验证方式
    19 Add-WebConfiguration -Filter system.webServer/security/authentication/windowsAuthentication/providers -PSPath IIS: -Location MySite -Value NTLM
    20 Add-WebConfiguration -Filter system.webServer/security/authentication/windowsAuthentication/providers -PSPath IIS: -Location MySite -Value Negotiate
    21 
    22 
    23 #查看已安装的身份验证方式
    24 Get-WebConfiguration -filter /system.webserver/security/authentication -PSPath iis:
    25 
    26 #查看站点test01下的windowsAuthentication身份验证方式
    27 Get-WebConfiguration -filter /system.webServer/security/authentication/windowsAuthentication -pspath iis: -Location test01 |select *
    28 #同上(只是路径写法不同)
    29 Get-WebConfiguration -filter /system.webServer/security/authentication/windowsAuthentication 'iis:sites	est01' |select *

    设置站点身份验证方式:

    1 Set-WebConfigurationProperty -Filter system.webServer/security/authentication/anonymousAuthentication `
    2                               -PSPath MACHINE/WEBROOT/APPHOST `
    3                               -Location 'Default Web Site' `
    4                               -Name Enabled `
    5                               -Value $true

    检查某个站点/应用程序下的身份验证方式是否已启用

    方法一:

    1 $siteName = "test01"
    2 $authentications=Get-WebConfiguration  -filter "system.webServer/security/authentication/*"  -PSPath "IIS:Sites$siteName"
    3 $authentications | % {$_ |Select ItemXPath,enabled}

    方法二(笨方法):

    #定义站点名称
    $site = "test01"
    Import-Module WebAdministration
    #获取所有已安装的身份验证方式
    $auths = Get-WebConfiguration -filter /system.webserver/security/authentication -PSPath IIS: 
    $authnames = $auths.Sections.name 
    Foreach ($auth in $authnames)
        {
        $authall = $auths.ItemXPath  + "/" + $auth
        #查看站点下每个身份验证是否启用
        Get-WebConfiguration -filter $authall -pspath IIS: -Location $site|select ItemXPath,Enabled
        }

    IIS PowerShell 管理命令:http://technet.microsoft.com/en-us/library/ee790599.aspx

  • 相关阅读:
    Call KernelIoControl in user space in WINCE6.0
    HOW TO:手工删除OCS在AD中的池和其他属性
    关于新版Windows Server 2003 Administration Tools Pack
    关于SQL2008更新一则
    微软发布3款SQL INJECTION攻击检测工具
    HyperV RTM!
    OCS 2007 聊天记录查看工具 OCSMessage
    CoreConfigurator 图形化的 Server Core 配置管理工具
    OC 2007 ADM 管理模板和Live Meeting 2007 ADM 管理模板发布
    Office Communications Server 2007 R2 即将发布
  • 原文地址:https://www.cnblogs.com/dreamer-fish/p/3986314.html
Copyright © 2011-2022 走看看