netegg Posted May 28, 2008 Posted May 28, 2008 (edited) I've got how to list the groups/users in a machine through the forum? But I have no idea to delete the specific group/user. Someone can help me? Edited May 28, 2008 by netegg
netegg Posted May 29, 2008 Author Posted May 29, 2008 RunWait("net user username /DELETE")Can it do without using "net" command?
enaiman Posted May 29, 2008 Posted May 29, 2008 Maybe because he might not have administrative rights? . . . SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
Developers Jos Posted May 30, 2008 Developers Posted May 30, 2008 Here is a example how to Add/Rename/Delete a user and put it in a group: expandcollapse popup; Init objects $oMyError = ObjEvent("AutoIt.Error","MyErrFunc"); Install a custom error handler $UserName = 'Fred' $Password = 'Wilma123' $strComputer = @ComputerName ;*********************** ;Create UserID $colAccounts = ObjGet("WinNT://" & $strComputer & "") $objUser = $colAccounts.Create("user", $UserName) $objUser.SetPassword ($Password) $objUser.Put ("Fullname", "Test User") $objUser.Put ("Description", "Test User description") $objUser.Put ("PasswordExpired", 1) ;expire the password $objUser.SetInfo ;*********************** ;Add User to group $objGroup = ObjGet("WinNT://" & $strComputer & "/Administrators,group") $objGroup.Add($objUser.ADsPath) ;*********************** ; Rename User $colAccounts = ObjGet("WinNT://" & $strComputer & "") $objUser = $colAccounts.Create("user", $UserName) $OldUser = "Fred" $NewUser = "Fredrenamed" $oUser = ObjGet("WinNT://" & @ComputerName & "/" & $OldUser & ",user") $oComputer = ObjGet("WinNT://" & @ComputerName) $oNewUser = $oComputer.MoveHere($oUser.ADsPath, $NewUser) ; Delete User $colAccounts = ObjGet("WinNT://" & $strComputer & "") $objUser = $colAccounts.Delete("user", $NewUser) Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Linenbr is: " & $oMyError.scriptline & @CRLF & _ "Description is: " & $oMyError.description & @CRLF & _ "Windescription is: " & $oMyError.windescription ) SetError(1); something to check for when this function returns Endfunc SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
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