Skip to content

Commit a515787

Browse files
Merge pull request #25 from hahndorf/DSCWebServiceNTLM
Fix for issue #24 - xDscWebService: PSDSCComplianceServer returns HTTP Error 401.2
2 parents 7b39a0a + 857a14e commit a515787

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

DSCResources/MSFT_xDSCWebService/MSFT_xDSCWebService.psm1

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,27 @@ function Set-TargetResource
164164
$pswsMofFileName = "$pathPullServer\PSDSCComplianceServer.mof"
165165
$pswsDispatchFileName = "$pathPullServer\PSDSCComplianceServer.xml"
166166
}
167+
168+
# check for the existance of Windows authentication, this is needed for the Compliance Server
169+
Write-Verbose "Check IIS Windows Authentication"
170+
if(($Ensure -eq "Present"))
171+
{
172+
# only important if Present, Get-WindowsFeature works under 2008 R2 and newer
173+
if ((Get-WindowsFeature -name Web-Windows-Auth | Where Installed).count -eq 0)
174+
{
175+
# enable the feature
176+
# Checking for Windows Server 2008 R2:
177+
if([Environment]::OSVersion.Version.ToString().StartsWith("6.1."))
178+
{
179+
Add-WindowsFeature -Name Web-Windows-Auth
180+
}
181+
else
182+
{
183+
Install-WindowsFeature -Name Web-Windows-Auth
184+
}
185+
}
186+
}
187+
167188

168189
Write-Verbose "Create the IIS endpoint"
169190
PSWSIISEndpoint\New-PSWSEndpoint -site $EndpointName `
@@ -311,6 +332,19 @@ function Test-TargetResource
311332
break
312333
}
313334

335+
# check for the existance of Windows authentication, this is needed for the Compliance Server
336+
if(($Ensure -eq "Present"))
337+
{
338+
Write-Verbose "Check IIS Windows Authentication"
339+
# only important if Present, Get-WindowsFeature works under 2008 R2 and newer
340+
if ((Get-WindowsFeature -name Web-Windows-Auth | Where Installed).count -eq 0)
341+
{
342+
$DesiredConfigurationMatch = $false
343+
Write-Verbose "Required Windows authentication is not installed, does not match the desired state."
344+
break
345+
}
346+
}
347+
314348
Write-Verbose "Check Port"
315349
$actualPort = $website.bindings.Collection[0].bindingInformation.Split(":")[1]
316350
if ($Port -ne $actualPort)

0 commit comments

Comments
 (0)