Created
May 28, 2019 10:28
-
-
Save Stephanevg/e8263600a44cf8fc041778fa7566d206 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param( | |
[String]$GroupName = "administrators" | |
) | |
html { | |
head { | |
title 'Local User Manager' | |
} | |
body { | |
h2 { | |
"Local User Report:" | |
} | |
import-module Microsoft.PowerShell.LocalAccounts | |
$Group = Get-LocalGroup -Name $GroupName | |
$Users = Get-LocalGroupMember -Group $Group | |
h3 "The group $($AdminGroup.Name) contains $($Users.Count) users" | |
h2 { | |
"Remove user:" | |
} | |
Form -action "/removeuser" -method post -id "AddUser" -Content { | |
ConvertTo-PsHtmlTable -Object $Users -Properties "Name","SID" | |
input -type submit -Name 'Submit' -Id "btn_submit" -value "Remove" | |
SelectTag { | |
foreach($U in $Users){ | |
option -value $U.SID -Content $U.Name | |
} | |
} #-Attributes @{form="AddUser"} | |
} -enctype 'application/x-www-form-urlencoded' -target _self | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment