如何使用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"
}
参考资料
===============