0
我想将下面的$ Groups变量的结果限制为仅返回特定组的成员。该代码检索计算机所属的组。我只对那些包含“SCCM”的任何AD组的成员感兴趣。Powershell - 在管道中过滤变量结果
我试过第5行,但不起作用。什么是正确的方法来做到这一点?谢谢。
$SamAccountNames = (Get-ADComputer Computer).SamAccountName
$OSInfo = Get-WmiObject -Class Win32_OperatingSystem -ComputerName Computer
$ServerGroupMemberShipList = Get-ADPrincipalGroupMembership $SAMAccountNames | Sort SAMAccountName
$Groups = $ServerGroupMemberShipList.Name
#$Groups = $ServerGroupMemberShipList.Name | Select {$ServerGroupMemberShipList.Name -like "SCCM"}
Write-Host " "
Write-Host "Checking Software Updates Compliance on" $Computer.ToUpper() -ForegroundColor Yellow -NoNewline
Write-Host $OSInfo.Caption
$Groups
我忘了说我没有尝试,但$组来到我们空。也许我错了。 如果我跑线4事情是这样的,它返回: 域控制器 SCCM-服务器修补-0530 正如你所看到的,我想集合限制为具有“SCCM”这些广告组名字。 – Habanagold