简体   繁体   English

Get-ADPrincipalGroupmembership:由于内部错误,服务器无法处理请求

[英]Get-ADPrincipalGroupmembership : The server was unable to process the request due to an internal error

As in my previous Question, my problem is about this script:和我之前的问题一样,我的问题是关于这个脚本:

$csvInfos=@()
$allservers=@(Get-ADComputer -SearchBase "OU=BRLN-Servers,OU=OU-BRLN,OU=DE,OU=Locations,DC=bla,DC=bla,DC=bla" -Filter * -Properties *)
foreach($server in $allservers){
                $customobject = new-object -TypeName PSObject -Property @{

                'Servername' = $server.Name
                'WSUS Gruppen' = ($server | get-ADPrincipalGroupMembership |?{$_.Name -like '*wsus*'} | Select-Object -ExpandProperty Name ) -join ";"
                'OS' = $server.OperatingSystem }

            $csvinfos+= $customobject }

$csvinfos | export-csv c:\temp\wsus_server_groups.csv -Delimiter ";" -NoTypeInformation

The script is used on 3 different domains (US, EU, ASIA) The domain are built the same.该脚本用于 3 个不同的域(美国、欧盟、亚洲) 域构建相同。 Same OU structure, same settings, same everything.相同的 OU 结构,相同的设置,相同的一切。

Based on the updated script I am able to get the results I want for 2 of the 3 domains.根据更新后的脚本,我可以获得 3 个域中的 2 个域的结果。 On the third domain I get an error with the get-adprincipalgroupmembership command:在第三个域上,get-adprincipalgroupmembership 命令出错:

Get-ADPrincipalGroupmembership: The server was unable to process the request due to an internal error. Get-ADPrincipalGroupmembership:由于内部错误,服务器无法处理请求。

I googled very much about this error.我在谷歌上搜索了很多关于这个错误的信息。 Even here on stackoverflow is a topic with that error:即使在stackoverflow上也是一个带有该错误的主题:

Get-ADPrincipalGroupMembership Fails when any user group name has "/" Get-ADPrincipalGroupMembership 当任何用户组名称有“/”时失败

but I don't think that is describes the same situation as mine.但我认为这与我的情况不同。 Or maybe I am blind....或者我是瞎子……

so: Is there a way to fix that problem / error or do I have to use another command that does the same as Get-ADPrincipalGroupmembership?所以:有没有办法解决这个问题/错误,还是我必须使用另一个与 Get-ADPrincipalGroupmembership 相同的命令?

Thank you, Michael谢谢你,迈克尔

I'm not a fan of the AD PowerShell cmdlets for reasons like this.由于这样的原因,我不喜欢 AD PowerShell cmdlet。 They don't handle all cases very well.他们不能很好地处理所有案件。 I know that foreign security principals are not handled, although I'm not sure how that would affect this specific case.我知道没有处理外国安全负责人,尽管我不确定这将如何影响这个特定案例。 And as you said, forward slashes.正如你所说,正斜杠。

You might be able to hunt down why it's happening if you see which server object it is crashing on.如果您看到它在哪个服务器 object 上崩溃,您可能会找出它发生的原因。

But you can just avoid using Get-ADPrincipalGroupMembership .但是您可以避免使用Get-ADPrincipalGroupMembership You can do the same thing with Get-ADGroup :您可以使用Get-ADGroup做同样的事情:

'WSUS Gruppen' = (Get-ADGroup -LDAPFilter "(&(name=*wsus*)(member=$($server.DistinguishedName)))" | Select-Object -ExpandProperty Name ) -join ";"

If you have more than one domain in your AD forest, then you should tell Get-ADGroup to use a global catalog by specifying -Server example.com:3268 .如果您的 AD 林中有多个域,则应通过指定-Server example.com:3268告诉Get-ADGroup使用全局目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM