设置、查看身份验证方式

 #导航到某站点下:
cd IIS:\Sites\DemoSite\DemoApp #启用站点test01下的Windows身份验证
Set-WebConfigurationProperty -filter /system.webServer/security/authentication/windowsAuthentication -name enabled -value true -PSPath IIS:\ -Location test01 #启用站点default web site下应用程序pswa的Windows身份验证
Set-WebConfigurationProperty -filter /system.webServer/security/authentication/windowsAuthentication -name enabled -value true -PSPath IIS:\ -Location 'default web site/pswa' #禁用站点MySite下的匿名身份验证
Set-WebConfiguration system.webServer/security/authentication/anonymousAuthentication -PSPath IIS:\ -Location MySite -Value @{enabled="False"} #启用Form身份验证
$config = (Get-WebConfiguration system.web/authentication 'IIS:\sites\Default Web Site')
$config.mode = "Forms"
$config | Set-WebConfiguration system.web/authentication #为MySite添加身份NTLM和Negotiate身份验证方式
Add-WebConfiguration -Filter system.webServer/security/authentication/windowsAuthentication/providers -PSPath IIS:\ -Location MySite -Value NTLM
Add-WebConfiguration -Filter system.webServer/security/authentication/windowsAuthentication/providers -PSPath IIS:\ -Location MySite -Value Negotiate #查看已安装的身份验证方式
Get-WebConfiguration -filter /system.webserver/security/authentication -PSPath iis:\ #查看站点test01下的windowsAuthentication身份验证方式
Get-WebConfiguration -filter /system.webServer/security/authentication/windowsAuthentication -pspath iis:\ -Location test01 |select *
#同上(只是路径写法不同)
Get-WebConfiguration -filter /system.webServer/security/authentication/windowsAuthentication 'iis:\sites\test01' |select *

设置站点身份验证方式:

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

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

方法一:

 $siteName = "test01"
$authentications=Get-WebConfiguration -filter "system.webServer/security/authentication/*" -PSPath "IIS:\Sites\$siteName"
$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

IIS下的身份验证方式管理的更多相关文章

  1. asp.net中常用的几种身份验证方式

    转载:http://www.cnblogs.com/dinglang/archive/2012/06/03/2532664.html   前言 在B/S系统开发中,经常需要使用"身份验证&q ...

  2. 第15课-数据库开发及ado.net-数据库介绍,主键,外键,启动数据库,数据库身份验证方式,建表,分离数据库

    第15课-数据库开发及ado.net 数据库介绍,主键,外键,启动数据库,数据库身份验证方式,建表,分离数据库 1.  学习方法 2.  多涨见识 3.  比自己强的人一起,学习更强:比自己更聪明的人 ...

  3. Azure Service Bus 中的身份验证方式 Shared Access Signature

    var appInsights=window.appInsights||function(config){ function r(config){t[config]=function(){var i= ...

  4. MySql8.0+全新身份验证方式

    我们在安装MySql8.0+的版本时MySql将会询问我们是否选择全新的身份验证方式,如下图 ⒈第一个是MySql推荐我们使用的强密码加密模式来进行身份验证 MySql8支持基于SHA256改进的更强 ...

  5. Windows XPSP3通过网络级身份验证方式连接Windows Server 2008远程桌面

    远程桌面大大方便了大家的日常管理工作,Windows Server 2008同样秉承这一优秀特性,并引入网络级身份验证(NLA)作为远程桌面连接的默认身份验证方式. 网络级身份验证 (NLA) 是一种 ...

  6. ASP.net的身份验证方式有哪些?

    [转] ASP.net的身份验证方式有哪些?分别是什么原理? Asp.net的身份验证有有三种,分别是"Windows | Forms | Passport",其中又以Forms验 ...

  7. 发布Restful服务时出现IIS 指定了身份验证方案错误时的解决方案(IIS specified authentication schemes)

    发布RESTful服务,当访问.svc文件时出现如下错误时: IIS 指定了身份验证方案“IntegratedWindowsAuthentication, Anonymous”,但绑定仅支持一种身份验 ...

  8. C# 在iis windows authentication身份验证下,如何实现域用户自动登录

    前言: 该博文产生的背景是有个项目在客户那部署方式为iis windows身份验证,而客户不想每次登录系统都要输入帐号和密码来登录. 因此需要得到域用户,然后进行判断该用户是否可以进入系统. 解决方法 ...

  9. android下身份验证方式调用webservice

    在企业开发领域,webservice还是经常被用到的服务体系,因为他对安全事务支持都比较好. 有时候,我们就需要在android下调用后端的webservice服务,因为在内部网络环境下,所有需要ba ...

随机推荐

  1. shell 中grep命令详解

    用‘grep’搜索文本文件如果您要在几个文本文件中查找一字符串,可以使用‘grep’命令.‘grep’在文本中搜索指定的字符串.举个例子:假设您正在‘/usr/src/linux/Documentat ...

  2. OutputCache缓存各参数的说明

    Duration 缓存时间,以秒为单位,这个除非你的Location=None,可以不添加此属性,其余时候都是必须的. Location Location当被设置为None时,其余的任何设置将不起作用 ...

  3. HDU 5835 Danganronpa

    Danganronpa Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total ...

  4. ylbtech-数据库设计与优化-对作为复选框/单选列表的集合表的设计

    ylbtech-DatabaseDesgin:ylbtech-数据库设计与优化-对作为复选框/单选列表的集合表的设计 -- DatabaseName:通用表结构-- -- 主要是针对将要设计的表对象, ...

  5. [King.yue]Ext.Net 正则表达式用法

    例: .Regex("^[A-Za-z0-9]+$")   //正则表达式 .InvalidText("只能输入英文字符和数字.")); //输入错误提示

  6. 《Python CookBook2》 第一章 文本 - 测试一个对象是否是类字符串 && 字符串对齐

    测试一个对象是否是类字符串 任务 有时候需要测试一个对象,尤其是当你在写一个函数或者方法的时候,经常需要测试传入的参数是否是一个字符串. 解决方案 利用内建的isinstance 和basestrin ...

  7. 【和我一起学python吧】python入门语法总结

    1.python是一个解释性语言: 一个用编译性语言比如C或C++写的程序可以从源文件(即C或C++语言)转换到一个你的计算机使用的语言(二进制代码,即0和1).这个过程通过编译器和不同的标记.选项完 ...

  8. mysql操作时遇到的小问题

    mysql数据库在程序中执行sql语句时,或者在执行sql时,数据库表可能会有一些特殊的字符,比如说#,.等,这样在执行时 可能会遇到问题 如以下的表名,backup_2014.2.22, 这个表在查 ...

  9. hdfs[命令] dfsadmin

    Usage: java DFSAdminNote: Administrative commands can only be run as the HDFS superuser. [-report] [ ...

  10. EmEditor正则表达式例子

    正则表达式中 单词指的是由字母.数字.下划线组合而成的字符串,用符号表示为\w(小写). 空白符包括单字节空格.双字节空格.制表符,用符号表示为\s(小写). 1.匹配被双引号包含的所有字符串(str ...