Sign in to follow this  
Followers 0
L'egyptien

Problem with .AccountExpirationDate property

4 posts in this topic

#1 ·  Posted (edited)

Hello,

I try to make a program who find properties on a user domain. The problem is on the Expiration Date, When there is one, everything is OK, but when a user does not have a date expiration, the program is interrupted.

$objUser = ObjGet ("WinNT://MYDOMAIN/" & $Login & ",User" )

$UserLogin = $objUser.Name
$UserFullName = $objUser.FullName
$UserProfile = $objUser.Profile
$UserScript = $objUser.LoginScript
$UserDescription = $objUser.Description

[b]$UserExpiration = $objUser.AccountExpirationDate[/b]

Can you help me finding a solution to bypass this error ?

Thank you

:)

Edited by L'egyptien

Share this post


Link to post
Share on other sites



As long it's a COM error you can always let one of your own function handle the COM errors. Then you can just ignore it.

Look under the COM section in the help file to see how you register your own error handling function. :)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Yeah, so if you just want the error to be ignored, this might work:

$oMyError = ObjEvent("AutoIt.Error","MyErrFunc"); Install a custom error handler 

$objUser = ObjGet ("WinNT://MYDOMAIN/" & $Login & ",User" )

$UserLogin = $objUser.Name
$UserFullName = $objUser.FullName
$UserProfile = $objUser.Profile
$UserScript = $objUser.LoginScript
$UserDescription = $objUser.Description

$UserExpiration = $objUser.AccountExpirationDate

Func MyErrFunc()
;
EndFunc

Das Häschen benutzt Radar

Share this post


Link to post
Share on other sites

Yeah, so if you just want the error to be ignored, this might work:

$oMyError = ObjEvent("AutoIt.Error","MyErrFunc"); Install a custom error handler 

$objUser = ObjGet ("WinNT://MYDOMAIN/" & $Login & ",User" )

$UserLogin = $objUser.Name
$UserFullName = $objUser.FullName
$UserProfile = $objUser.Profile
$UserScript = $objUser.LoginScript
$UserDescription = $objUser.Description

$UserExpiration = $objUser.AccountExpirationDate

Func MyErrFunc()
;
EndFunc
Yeah, Thank You so much Squirrely1 and monoceres, this program is working for me!!! I don't need to use the error.

And sorry to awnser late ... I was just on holiday !!! :)

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