3
Powershell and Excel
Post Body
I am trying to write a script to get email addresses in an Excel file, then get the SamAccountName which I've done but now I'm not sure how to get the script to read the AD group that account needs to be added to which is in another row in the same Excel sheet.
$people = Import-Excel C:\Scripts\NamestoEmails.xlsx
$people[2].Email
''
Foreach ($E in $people.Email) { Get-ADUser -Filter {Emailaddress -Like $E} | Select-Object -ExpandProperty SamAccountName}
Author
Account Strength
100%
Account Age
12 years
Verified Email
Yes
Verified Flair
Yes
Total Karma
66,614
Link Karma
30,920
Comment Karma
35,639
Profile updated: 4 days ago
Posts updated: 9 months ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 1 year ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/PowerShell/...