我正在尝试从名称以XX开头的组中导出组成员及其属性,因此输出为
使用我编写的代码,我可以获得所有用户和属性,但我也想在每个成员面前导出该组
$Groups = Get-ADGroup -filter {name -like "Group*"} | Select-Object Name
foreach ($Group in $Groups)
{
$Members = Get-ADGroupMember -Identity $($Group.name) -Recursive | Select-Object name
foreach ($Member in $Members )
{ Get-ADUser -Identity $($Member.name) -Properties * | Select-object * | export-csv
}
}
先谢谢你们,伙计们。
答案 0 :(得分:0)
将用户对象存储在变量中,将该组添加为该对象的新成员并将其传递给
INSERT INTO target_table (fields)
SELECT (fields) FROM @tmp as tmp
INNER JOIN dbo.buff AS bf ON tmp.id = bf.id
。
Export-CSV