Skip to content

Instantly share code, notes, and snippets.

@Stephanevg
Created May 28, 2019 10:29
Show Gist options
  • Save Stephanevg/6d274bd762aa29bed820c0b94dd30e93 to your computer and use it in GitHub Desktop.
Save Stephanevg/6d274bd762aa29bed820c0b94dd30e93 to your computer and use it in GitHub Desktop.
Param(
[String]$UserSID = 'S-1-5-21-3890033740-644365979-2086776761-1001',
[String]$GroupName
)
If($UserSID){
$Response.SetContentType('text/plain')
#$Body = [System.Web.HttpUtility]::UrlDecode($Request.BodyString)
$Response.Send(($Request.BodyString))
<#
$Body = [System.Web.HttpUtility]::UrlDecode($Request.BodyString)
$Data = @{}
$Body.split('&') | %{
$part = $_.split('=')
$Data.add($part[0], $part[1])
}
$result = $Data | ConvertTo-Json
$Response.Send(($result | ConvertFrom-Json))
#>
<#
$AdminGroup = Get-LocalGroup -Name $GroupName
$LocalUser = Get-LocalUser -SID $UserSID
If($LocalUser){
Write-Verbose "Removing user $($LocalUser.FullName)"
Try{
Remove-LocalGroupMember -Group $AdminGroup -Member $LocalUser -ErrorAction Stop
}Catch{
return "Successfully removed user with SID: $($UserSID)"
}
}
#>
}Else{
Return "No User found with sid $($UserSID)"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment