Jump to content

I got a error message, would you help me?


Tonny
 Share

Recommended Posts

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...