我的DSCconfiguration中有以下内容:
xWebApplication StaffDirectoryApp { Website = "MySite" Name = "MyApp" WebAppPool = "MyPool" PhysicalPath = $Destination Ensure = "Present" PreloadEnabled = $true }
这似乎工作正常,但我也想使用AuthenticationInfo属性(虽然文档似乎说它应该是AuthenticationInformation,不是)。
我能find的唯一例子是在GitHub上的一个unit testing中,他们的用法是这样的:
AuthenticationInfo = New-CimInstance -ClassName MSFT_xWebApplicationAuthenticationInformation ` -ClientOnly ` -Property @{ Anonymous = $false; Basic = $false; Digest = $false; Windows = $true }
然而,这产生以下结果:
Convert property 'AuthenticationInfo' value from type 'STRING' to type 'INSTANCE' failed
我应该如何设置这个属性?
尝试以下语法:
xWebApplication StaffDirectoryApp { Website = "MySite" Name = "MyApp" WebAppPool = "MyPool" PhysicalPath = $Destination Ensure = "Present" PreloadEnabled = $true AuthenticationInfo = MSFT_xWebApplicationAuthenticationInformation { Anonymous = $false Basic = $false Digest = $false Windows = $true } }
我不知道为什么New-CimInstance的代码不起作用,但这个应该是诀窍。