Jump to content
Sign in to follow this  
L'egyptien

Problem with .AccountExpirationDate property

Recommended Posts

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

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

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  

×
×
  • Create New...