need a powershell script to remove SIDS from Adminstrators Group On Windows 10 Hybrid AD Joined Devices -- 2
Budget: $10 – $30 USD
I have an open issue w/ MSFT; I have AutoPilot devices w/ Global Admins and Device Admins in the Administrators Group on Windows 10 Devices. I have to remove these SIDS.
Pseudo Code:
#Test if the SID exists
Get-LocalUser -S-1-12-1-3598938502-1280727568-3632501898-3897530764
Get-LocalUser -S-1-12-1-61017865-1125260692-820944550-834916098
#If SID exists, execute the following
if
( -eq $true)
{
Remove-LocalGroupMember -Group "Administrators" -Member "S-1-12-1-3598938502-1280727568-3632501898-3897530764"
Remove-LocalGroupMember -Group "Administrators" -Member "S-1-12-1-61017865-1125260692-820944550-834916098"
}
#If SID doesn't exist, write error message
Else
{
Write-Host "not found" | Write-Error
Exit
}
Write-Host "Configuration complete" -ForegroundColor Blue
Pseudo Code:
#Test if the SID exists
Get-LocalUser -S-1-12-1-3598938502-1280727568-3632501898-3897530764
Get-LocalUser -S-1-12-1-61017865-1125260692-820944550-834916098
#If SID exists, execute the following
if
( -eq $true)
{
Remove-LocalGroupMember -Group "Administrators" -Member "S-1-12-1-3598938502-1280727568-3632501898-3897530764"
Remove-LocalGroupMember -Group "Administrators" -Member "S-1-12-1-61017865-1125260692-820944550-834916098"
}
#If SID doesn't exist, write error message
Else
{
Write-Host "not found" | Write-Error
Exit
}
Write-Host "Configuration complete" -ForegroundColor Blue
Related categories:
Powershell