Tonny Posted September 3, 2007 Posted September 3, 2007 I Add a user, and I want set the user's property Code: $UserName = 'Fred' $Password = '1234' $strComputer = @ComputerName Const $ADS_UF_DONT_EXPIRE_PASSWD = 0x10000 Const $ADS_UF_PASSWD_CANT_CHANGE = 0x40 $objName = "WinNT://" & @ComputerName & "/" & $UserName $objUser = ObjGet($objName) $objUserFlags = ObjGet($objUser & ".userFlags") $objPasswordExpirationFlag = $objUserFlags Or $ADS_UF_DONT_EXPIRE_PASSWD Or $ADS_UF_PASSWD_CANT_CHANGE $objUser.Put ("userFlags", $objPasswordExpirationFlag ) $objUser.SetInfo ERROR Message: D:\My Documents\AutoIt\AddUser.au3 (25) : ==> The requested action with this object has failed.: $objUser.Put ("userFlags", $objPasswordExpirationFlag ) $objUser.Put ("userFlags", $objPasswordExpirationFlag )^ ERROR ->15:05:08 AutoIT3.exe ended.rc:1 Is anybody known the reason? Sorry for bay english.
Valuater Posted September 3, 2007 Posted September 3, 2007 (edited) ObjectCreate() ??? I am not possitive, but quite sure that $objName = "WinNT://" & @ComputerName & "/" & $UserName is not an Object. to use ObjGet($objName) You need an object first 8) Edited September 3, 2007 by Valuater
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