You receive error 401.1 when you browse a Web site that uses Integrated Authentication and is hosted on IIS 5.1 or a later version
Pasted from <http://support.microsoft.com/kb/896861/en-gb>
### Script ###
Param([string]$StringAdditionalUrls)
[System.String[]]$StringAdditionalUrlsArray = $StringAdditionalUrls.Split(",")
$ArrayAdditionalUrls = "$StringAdditionalUrlsArray".Split()
[string]$path = "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0\"
Write-Output "path=$path"
[string]$name = "BackConnectionHostNames"
Write-Output "name=$name"
[string]$currentvalue = (Get-Item "$path").GetValue("$name")
[System.String[]]$ArrayExistingValues = "$currentvalue".Split()
Write-Output "Current Values are: -"
ForEach ($currentAlias in $ArrayExistingValues)
{
Write-Output "- $currentAlias "
}
Write-Output "Additional Values are: -"
ForEach ($addAlias in $ArrayAdditionalUrls)
{
Write-Output "- $addAlias "
}
Write-Output "`nChecking current values..."
ForEach ($currentAlias in $ArrayExistingValues)
{
Write-Output "Checking $currentAlias"
If ($currentAlias)
{
If ($newAlias)
{
If($ArrayNewUrls -notcontains $currentAlias)
{
Write-Output " -Adding: $currentAlias"
$newAlias = $newAlias+" "+$currentAlias
}
}
Else
{
$newAlias = $currentAlias
Write-Output " -Adding $currentAlias"
}
}
[System.String[]]$ArrayNewUrls = "$newAlias".Split()
}
Write-Output "`nComparing new values..."
ForEach ($addAlias in $ArrayAdditionalUrls)
{
Write-Output "Checking: $addAlias.."
If ($ArrayExistingValues -contains $addAlias)
{
Write-Output " -$addAlias already exists"
}
Else
{
Write-Output " -Adding: $AddAlias"
$newAlias = $newAlias+" "+$AddAlias
}
}
Write-Output "`nNow setting registry values..."
$newAlias = $newAlias.Trim()
[System.String[]]$ArrayNewUrls = "$newAlias".Split()
Write-Output "New list of values : -"
#ForEach ($newAlias in $ArrayNewUrls)
# {
Write-Output $newAlias
# }
Set-ItemProperty -Path $path -Name $name -Value ([string[]]$ArrayNewUrls)
Write-Output "`ncompleted adding URLs to BackConnectionHostNames"
Write-Output "Completed Script: $scriptpath"
nice job !
ReplyDelete