Skip to content

Instantly share code, notes, and snippets.

@Stephanevg
Created May 28, 2019 10:28
Show Gist options
  • Save Stephanevg/e8263600a44cf8fc041778fa7566d206 to your computer and use it in GitHub Desktop.
Save Stephanevg/e8263600a44cf8fc041778fa7566d206 to your computer and use it in GitHub Desktop.
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