Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Import-Module LithnetRMA
$a=Get-Content "c:\FIMScripts\GroupNames.txt"
ForEach ($i in $a)
Write-Host $i
$Members=Search-Resources -XPath "/Group[DisplayName = '$i']" -AttributesToGet @("ComputedMember")
foreach ($Member in $Members.ComputedMember)
$User = Get-Resource -ID $Member -AttributesToGet AccountName
$Name = $User.AccountName
# List of samAccountNames written to txt file
$GroupFile=Get-Content C:\users\$env:USERNAME\desktop\FIMGroups\$i.txt | sort-object | Out-File -Filepath C:\users\$env:USERNAME\desktop\FIMGroupsSorted\$i.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment