I want to change following code :
# Add IIS User to IIS Group
$computergroup = [ADSI]("WinNT://localhost,computer")
$admins = $computergroup.psbase.children.find("IIS_IUSRS")
foreach ($member in $admins.psbase.Invoke("Members"))
$member_name = $member.GetType().InvokeMember("Name", 'GetProperty', $null, $member, $null)
if ($member_name -eq $username)
Write-Host $username "already in this group."
Write-Host $username "added to group."
to Read-Host "enter details"
I already made something like this in Powershell ISE :
function add_user_to_iis_group $username = read-host "please enter the user"
But it doesn't work and i don't understand why
I'm not an expert in PS.
Thanks for reading and hopefully replying.