Hi @Gustavo Lorenzett ,
you can try this:
# Disable all local users with name not equal "Administrator"
Get-LocalUser | Where-Object {$_.Name -ne "Administrator"} | Disable-LocalUser -WhatIf
# Delete all local users with name not equal "Administrator"
Get-LocalUser | Where-Object {$_.Name -ne "Administrator"} | Remove-LocalUser -WhatIf
If you execute one of the lines (line 2 or 4) it will show what will happen and which users will be disabled/deleted.
If the result fits your requirement just delete the -WhatIf
at the end of the line and execute the line again.
----------
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten