Good morning PSers!
If have this code:
**********StartCode*****************
$mytoken = [System.Security.Principal.WindowsIdentity]::GetCurrent()
{
{
{
foreach($g in $mytoken.Groups)$TestG = $g.Translate("System.Security.Principal.NTAccount")switch -regex ($TestG.ToString())"\(\d{5}\)$"$g
write-host ($TestG.ToString())
}
}
**********************EndCode**************************
I would like to do this with a pipe line.
So I tryed this:
*****************StartCode**************************
I am Receiving a list of SIDs and not list of group names.
Thoughts?
$mytoken.Groups | Where-Object {$_.Translate("System.Security.Principal.NTAccount").ToString() -match "\(\d{5}\)$"}*****************EndCode****************************
$mytoken = [System.Security.Principal.WindowsIdentity]::GetCurrent()
}