Help with handle local accounts

:slight_smile: Very nice work Jonathan, now im done with this work, all server have disable NtAdmin account …

Hi!

Can i reopen this and add some more questions to this??

Is it possible to make the script to rename the local “Administrator” account to NTAdmin and then disable, i have found some more servers that still have local administrator account enable. Want to the script if it find any server with Administrator name to rename it and disable. Or is it better to create a new script that just rename “Administrator” to NTAdmin adn after that run the disable script?
To the disable NTAdmin script, is it possible to add so it generate a log file so i can see what have gone wrong or what is success?

Can you help me how this rename script should look like. And have the same get-content = xxx.txt file

Thanks

$servers = get-content .\servers.txt

foreach($server in $servers)
{
##code here##

#rename admin
$admin=[adsi]"WinNT://$server/Administrator,user" 
$admin.psbase.rename("NTadmin")

}