If you want to list all members of the local computer group IIS_IUSRS with PowerShell, use this script:

 

[Script]

"Set execution policy to [Unrestricted]"
Set-ExecutionPolicy Unrestricted

$iisIUSRS = [ADSI]"WinNT://L014/IIS_IUSRS,group"

"Loop members"
foreach ($member in $iisIUSRS.Invoke("Members", $null))
{
    # Cast object to type DirectoryEntry
    $de = New-Object System.DirectoryServices.DirectoryEntry($member)
    # Determine username
    $userName = $de.Name
    # Show the username
    "Member is $userName"
}

 

[Result]

PS C:\Temp> C:\Temp\Test.ps1
Set execution policy to [Unrestricted]
Loop members
Member is SQLServerReportServerUser$L001$MSRS10.MSSQLSERVER
Member is Administrator
Member is saAsaWeb

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.