Add User to Local Security Group ​
POST /userapi/securitygrouplocal/addusertosecuritygroup
The PowerShell examples below show how to add users to local Security Groups, either via the ID of the Security Group, or the Security Group Name.
Powershell
# PowerShell Request
#JSON data for the object
$Body = @{
SecurityGroupName = "Windows Team"
UserID = "domain\fbloggs"
}
$jsonData = $Body | ConvertTo-Json
$PasswordstateURL = 'https://passwordstate/userapi'
$result = Invoke-Restmethod -Method Post -Uri $PasswordstateURL'/securitygrouplocal/addusertosecuritygroup' -ContentType "application/json" -Body $jsonData -Header @{ "UserID" = "<UserID>" ; "APIKey" = "<APIKey>" }
Write-Output $resultPowershell
# PowerShell Request
#JSON data for the object
$Body = @{
SecurityGroupID = "176"
UserID = "domain\fbloggs"
}
$jsonData = $Body | ConvertTo-Json
$PasswordstateURL = 'https://passwordstate/userapi'
$result = Invoke-Restmethod -Method Post -Uri $PasswordstateURL'/securitygrouplocal/addusertosecuritygroup' -ContentType "application/json" -Body $jsonData -Header @{ "UserID" = "<UserID>" ; "APIKey" = "<APIKey>" }
Write-Output $result