HOWTO: Delete local users through Group Policy and vbscript

If you deal with imaging a lot, you’ve probably run into a situation where you have some local users on a workstation that you don’t want to be there, maybe they were creating during the OS install or whatever. It’s also handy if you are moving someone to a domain setup, and need to get rid of their old local accounts to prevent them from logging in as the local user instead of the newly created domain user.

You need only paste the following into a plain text file, and rename the extension to .vbs:

strComputer = “.”
strUser = “user”
Set objComputer = GetObject(“WinNT://” & strComputer & “”)
objComputer.Delete “user”, strUser

Next, create a new GPO, add .vbs this as a startup script under Computer Settings, associate with an existing OU containing you domain computers.

This entry was posted in HOWTO's, Microsoft, VBScript. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s