I need some help with basic mechanics of manipulating data in a PowerShell script, and in Excel
I've got all the input data, and I know what I need, but I need help with the mechanics. I'm sure this is
easy for someone out there! --I'm not a developer, so it would take me WAY longer than I have, in order to learn all this from scratch....
Basic Requirement:List the members of an ActiveDirectory group, and resolve them to their 'Friendly Name'
Step-1: List the SIDs of the 12 group members of the 'ACCT' group
dsget group "CN=ACCT,OU=Groups,DC=ad,DC=xxxxxxxxxxxx,DC=com" -members -expand | findstr ForeignSecurity
This yields one line per account:"CN=S-1-5-21-3588447096-1463914-869570945-1213589,CN=ForeignSecurityPrincipals,DC=ad,DC=xxxxxxxxxxxx,DC=com"
----This is saved in a TXT file, and I can strip out just the SID, using Excel so I'm left with just the SID. Such as:
S-1-5-21-3588447096-1463911-869570941-1213589
S-1-5-21-3588447096-1463912-869570942-1213589
S-1-5-21-3588447096-1463913-869570943-1213589
S-1-5-21-3588447096-1463914-869570944-1213589
S-1-5-21-3588447096-1463915-869570945-1213589
--->What I need here, is to construct a command-line entry that will put into PowerShell, and submit it over and over for each SID that is in the TXT file I wrote in step1 "for each entry in xxxxxxxx, do YYYYYYYYYY"
Step-2: Resolve each SID to the Domain's 'Account Name' In PowerShell:
([System.Security.Principal.SecurityIdentifier]("S-1-5-21-3588447096-1463914-869570945-1213589")).Translate([System.Security.Principal.NTAccount]).toString()
This yields one line per SID, for each SID::AMERICA\H111111. I can use Excel to strip away the AMERICA\ domain, leaving the actual Account Name. Such as:
H111111
H111112
H111113
H111114
H111115
Step-3: Resolve the ActiveDirectory Account Name to a Friendly name, using Excel. Assume that I have an Excel spreadsheet containing
all 10,000 Account Names of everyone in the company. It would look like:
H111111 Bill
H111112 Sally
H111113 Henry
H111114 Sam
H111115 George
Endpoint: Somehow in Excel, I'm left with a listing of the 12 Friendly Names for all group members in the 'ACCT' group.
↧