Jump to content
Sign in to follow this  
Autalycus

User Management With Autoit3

Recommended Posts

Autalycus

Hello All,

I am using the latest beta of AutoIT3 and am trying to use the COM extension. The problem I am encountering I guess is the syntax of such COM commands, anyone know where the reference is? This is issue, this doesn't work, throws an error when run.

Const $ADS_UF_DONT_EXPIRE_PASSWD = "10000"

$objUser = ObjGet("WinNT:// " & $strComputer & "/" & $User)
$objUserFlags = ObjGet("", $objUser & ".UserFlags")
$objPasswordExpirationFlag = $objUserFlags OR $ADS_UF_DONT_EXPIRE_PASSWD
$objUser.Put ("UserFlags", $objPasswordExpirationFlag) 
$objUser.SetInfo

Basically this will set the Password Never Expires Flag on the particular user account.

It gives an error on the $objUser.Put ("UserFlags", $objPasswordExpirationFlag) saying that variable must be of type object.

There was an earlier post on this however he didn't work out the right syntax.

Anyone see my issue? This is a conversion from a working VBS.

Thanks

Share this post


Link to post
Share on other sites
Jos

I cannot test at this moment but maybe something like this?:

Const $ADS_UF_DONT_EXPIRE_PASSWD = 0x10000 
$objUser = ObjGet("WinNT:// " & $strComputer & "/" & $User)
$objUserFlags = $objUser.Get("UserFlags")
$objPasswordExpirationFlag = BitOR($objUserFlags,$ADS_UF_DONT_EXPIRE_PASSWD)
$objUser.Put ("UserFlags", $objPasswordExpirationFlag) 
$objUser.SetInfo

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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  

×