To delete a local admin on remote computer, run the PowerShell code below in elevated mode and it will delete the user name specified on the command.
The command below will fail if the remote PC is not configured to accept WMI connections.
invoke-command -ComputerName PC007 -ScriptBlock { net localgroup user_name /delete }
In a Windows domain environment, users should not have local admin or else it will be tough to control. There will be a lot of security issues and if the user is quite smart he or she will be able to circumvent group policies or domain settings.
If the user has local admin the user will be able to install software without the knowledge of the domain admin.
To check local admin accounts on remote computers check the link below.
There are quite a few tools on the web that will delete or list local admins on remote computers but whether the software has a malicious code on its coding then that would be another issue. Scripting is better than installing unknown software.
To display the list of local administrators check out this link below:
http://quickbytesstuff.blogspot.sg/2015/12/powershell-get-local-admins-on-remote.html
Comments
Post a Comment