Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disabling local user accounts? 3

Status
Not open for further replies.

echang15

Technical User
Jan 17, 2006
34
US
Hello,

I just migrated from a basic peer 2 peer network to an AD environment. However, some of my users are accidently logging onto their local accounts instead of the domain account. Is there a way I can disable these local logins?

thanks!
 
Delete the local accounts. You'll free up space on the machine s if you kill off the related profiles as well.

Pat Richard, MCSE(2) MCSA:Messaging, CNA(2)
 
I'm assuming your clients are running Windows XP? If they are, go to the control panel, select user accounts and choose the advanced tab. In advanced user management, click Advanced again. Click the Users option and right-click the user you want to disable/delete. Choose Properties and check the Account is disabled box.

I'd recommend disabling the accounts for a short while then deleting them when you are satisified they are no longer needed.

Regards,
 
Code:
Const ADS_UF_ACCOUNTDISABLE = &H0002 

strComputername="testbox.company.com"

' Bind to the user object with the WinNT provider.
Set objUser = GetObject("WinNT://" & strComputername & "/baduser,user")

' Retrieve userFlags attribute of user.
lngFlags = objUser.userFlags

' Set password never expires.
' The Or operator sets the bit for the corresponding flag.
lngFlags = lngFlags Or ADS_UF_ACCOUNTDISABLE


' Assign the new value to the userFlags attribute of the user object.
objUser.userFlags = lngFlags

' Save the changes.
objUser.SetInfo

WScript.Echo "Done"

I hope you find this post helpful.

Regards,

Mark
 
thanks guys!

i disabled them temporarily. will delete once i confirm they're not needed anymore..


thanks again!
 
Before you delete the accounts, I would make sure you still have at least one local account with admin privileges that you don't delete.

Been burned by that one when AD servers crash, logon/communication issues with domain, etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top