Sign in to follow this  
Followers 0
joshiieeii

Removing Administrator from Administrators Group Vista

1 post in this topic

#1 ·  Posted (edited)

Trying to remove the Administrator account from the Administrators group in VISTA. I tried the "net" method and get a 1371 error even when running as administrator. I am convinced the only way is through WMI. I have tried the below code in various configurations, with no luck. Anyone have any ideas?

;Remove Administrator for Administrators Group
Dim $objgroup = ObjGet("WinNT://" & @ComputerName & "/Administrators")
Dim $objuser = ObjGet("WinNT://" & @ComputerName & "/Administrator")
$objgroup.remove($objuser)oÝ÷ ØZ½æ¥²kçb·­Ø^«-)Þ)¶¬jëh×6$objgroup.remove($objuser.ADsPath)

All the times I have tried, I keep getting a "The requested action with this object has failed." It references the last line.

I can do it manually, but for some reason I can't script it.

According to the MS site, I am formatting it correctly: IADsGroup::Remove

Edited by joshiieeii

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0