lafafmentvotre Posted February 8, 2007 Share Posted February 8, 2007 Hello I want to create a script to rename the "administrator" or "administrateur" local account but i didn't choose the function reference to do it. Please help me thanks and sorry for my bad english Link to comment Share on other sites More sharing options...
lafafmentvotre Posted February 8, 2007 Author Share Posted February 8, 2007 HelloI want to create a script to rename the "administrator" or "administrateur" local account but i didn't find the function reference to do it.Please help me thanks and sorry for my bad english Link to comment Share on other sites More sharing options...
lafafmentvotre Posted February 8, 2007 Author Share Posted February 8, 2007 Oupps Nobody can help me ? Thanks Link to comment Share on other sites More sharing options...
Developers Jos Posted February 8, 2007 Developers Share Posted February 8, 2007 (edited) Hello I want to create a script to rename the "administrator" or "administrateur" local account but i didn't choose the function reference to do it. Please help me thanks and sorry for my bad englishexpandcollapse popup; Init objects $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Install a custom error handler $UserName = 'Fred' $Password = 'Wilma123' $strComputer = @ComputerName $colAccounts = ObjGet("WinNT://" & $strComputer & "") ;*********************** ;Create UserID $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 $OldUser = "Fred" $NewUser = "Fredrenamed" $oUser = ObjGet("WinNT://" & @ComputerName & "/" & $OldUser & ",user") $oComputer = ObjGet("WinNT://" & @ComputerName) $oNewUser = $oComputer.MoveHere($oUser.ADsPath, $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 Edited February 8, 2007 by JdeB 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. Link to comment Share on other sites More sharing options...
evilertoaster Posted February 8, 2007 Share Posted February 8, 2007 (edited) http://www.autoitscript.com/forum/index.ph...+user++accountshttp://www.autoitscript.com/forum/index.ph...+user++accountsedit: or that above Edited February 8, 2007 by evilertoaster 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