Sign in to follow this  
Followers 0
Tonny

I got a error message, would you help me?

2 posts in this topic

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by Valuater

NEWHeader1.png

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