Created
October 2, 2018 20:11
-
-
Save jkbryan/95653dc2de15060959665ca8a17d3c4d to your computer and use it in GitHub Desktop.
lithnet-get-ComputedMember-from-input-file.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
$Name>>C:\users\$env:USERNAME\desktop\FIMGroups\$i.txt | |
$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