Get user/s SID in Active Directory using SamAccountName.
To check SID for a single user:
(GET-ADUSER –Identity ) |
select SID, UserPrincipalName
(GET-ADUSER –Identity Pedro ) | select SID,
UserPrincipalName
Above example will get user Pedro SID and it's UPN.
If need to get list of user's SID in Active Directory, it
would be best to get the list on a text file and put users name on it.
1users.txt will have this list:
UserA
UserB
FinanceA
FinanceB
Sales01
Sales02
Use the code below to read the text file and list user's SID
and UPN.
===============================
$pathToFile = "d:\1users.txt"
$getTxtLines = Get-Content $pathToFile
foreach ($LineUpdatex in $getTxtLines ) {
#write-host $LineUpdatex `n
#code below will display the output
(GET-ADUSER –Identity $LineUpdatex ) | select SID,
UserPrincipalName
#use code below to export the output to CSV format
#(GET-ADUSER –Identity $LineUpdatex ) | select SID,
UserPrincipalName | out-file -Append d:\1users.csv
}
===============================
Free Android App with No Ads.
Linux Android App cheat sheet:
https://play.google.com/store/apps/details?id=com.LinuxMobileKit
Heaven's Dew Fall
https://play.google.com/store/apps/details?id=soulrefresh.beautiful.prayer
Android Catholic Rosary App - Guide
https://play.google.com/store/apps/details?id=com.myrosaryapp&hl=en-GB
Free Android App with No Ads.
Linux Android App cheat sheet:
https://play.google.com/store/apps/details?id=com.LinuxMobileKit
https://play.google.com/store/apps/details?id=soulrefresh.beautiful.prayer
Android Catholic Rosary App - Guide
Comments
Post a Comment