如何使用PowerShell修改注册表

下面的例子里, PowerShell修改了注册表键值, 完成了Security loop disable, 和loopbackcheck disable.

 

#Security loop disable so that you can look at it on the same machine

if(($gchn = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0\" -Name "BackConnectionHostNames" -ea SilentlyContinue) -eq $null){

New-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0\" -PropertyType MultiString -Value "$url" -Name "BackConnectionHostNames"

}else{

Set-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0\" -Name "BackConnectionHostNames" -Value ($gchn.BackConnectionHostNames+" $url")

}

 

#disable loobback check

if((Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\" -Name "DisableLoopbackCheck" -ea SilentlyContinue) -eq $null){

New-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\" -PropertyType DWORD -Value "1" -Name "DisableLoopbackCheck"

}

 

 

参考资料

===============

SharePoint 2010 for Hosters Whitepaper

posted on 2012-01-26 09:30  中道学友  阅读(2042)  评论(0编辑  收藏  举报

导航

技术追求准确,态度积极向上