Jump to content

User Management With Autoit3


Recommended Posts

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

Link to comment
Share on other sites

  • Developers

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

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

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...