新 ADUser -POBox returns "A value for the attribute was not in the acceptable range of values"
New-ADUser -POBox returns "A value for the attribute was not in the acceptable range of values"
我们有一个创建用户的脚本,但有时会失败
New-ADUser -name "test" -pobox "Streetname Streetname2 99, EU-1010 Country"
A value for the attribute was not in the acceptable range of values
所以我做了一个参数的eleminitaion,我一个接一个地注释掉,失败的link是POBox。
许多其他帖子表明 -Country 是一个常见错误,但这里不是这种情况(我们使用国家代码并且一切正常)。
我好像找不到什么时候能用,什么时候不能用,POBox-name 有什么限制吗?任何可能导致失败的原因?
Microsoft Docs 只是说“字符串值”
postBoxOffice
attribute(-POBox
参数映射到的)的值限制为最多 40 个字符。
您问题中的示例字符串“Streetname Streetname2 99, EU-1010 Country”的长度为 42 个字符:)
您可以通过检查目标属性对应架构条目上的 rangeUpper
属性来检查任何字符串语法属性的最大长度:
PS ~> $poBoxSchema = Get-ADObject -Filter 'lDAPDisplayName -eq "postOfficeBox"' -SearchBase (Get-ADRootDSE).SchemaNamingContext -Properties rangeUpper
PS ~> $poBoxSchema.rangeUpper
40
我们有一个创建用户的脚本,但有时会失败
New-ADUser -name "test" -pobox "Streetname Streetname2 99, EU-1010 Country"
A value for the attribute was not in the acceptable range of values
所以我做了一个参数的eleminitaion,我一个接一个地注释掉,失败的link是POBox。 许多其他帖子表明 -Country 是一个常见错误,但这里不是这种情况(我们使用国家代码并且一切正常)。
我好像找不到什么时候能用,什么时候不能用,POBox-name 有什么限制吗?任何可能导致失败的原因? Microsoft Docs 只是说“字符串值”
postBoxOffice
attribute(-POBox
参数映射到的)的值限制为最多 40 个字符。
您问题中的示例字符串“Streetname Streetname2 99, EU-1010 Country”的长度为 42 个字符:)
您可以通过检查目标属性对应架构条目上的 rangeUpper
属性来检查任何字符串语法属性的最大长度:
PS ~> $poBoxSchema = Get-ADObject -Filter 'lDAPDisplayName -eq "postOfficeBox"' -SearchBase (Get-ADRootDSE).SchemaNamingContext -Properties rangeUpper
PS ~> $poBoxSchema.rangeUpper
40