tedescoj Posted April 12, 2007 Share Posted April 12, 2007 O.K. I know i might be asking for a lot now and I did look in the forum for help but I only found one response and i don't understand it. I need to add a domain user to the local Admin group on there PC. There computer name is there login name so I imagine i can leverage that in some way so there would not have to be any interaction on the user's part? Here is the code that I found but it does not make sense to me. Any help would be appreciated extremely! Thanks in advance. You guy's are great at what you do!CODE:Func _User($action, $user, $pass="", $domain=@ComputerName, $level="") Select Case $action = "ADD" $objLocalComputer = ObjGet("WinNT://" & @ComputerName); Init COM object $objUser = $objLocalComputer.Create ("user", $user); Create user $objUser.SetPassword ($pass) $objUser.SetInfo _User("SET_GROUP", $user, $pass, $domain, $level) Case $action = "REMOVE" _Profile("REMOVE", $user, $domain) $objLocalComputer = ObjGet("WinNT://" & @ComputerName); Init COM object $objLocalComputer.Delete("user", $user); Delete user Case $action = "SET_GROUP" $dso = ObjGet("WinNT:") $objGroup = ObjGet("WinNT://" & @ComputerName & "/" & $level & ",group") $objUser = $dso.OpenDSObject("WinNT://" & $domain & "/" & $user,$domain & "\" & $user, $pass, 1) $objGroup.Add($objUser.ADsPath) Case $action = "REMOVE_GROUP" $objGroup = ObjGet("WinNT://" & @ComputerName & "/" & $level) $objUser = ObjGet("WinNT://" & $domain & "/" & $user) $objGroup.Remove($objUser.ADsPath) EndSelectEndFunc ;==>_User Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now