L'egyptien Posted March 18, 2008 Share Posted March 18, 2008 (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 March 18, 2008 by L'egyptien Link to comment Share on other sites More sharing options...
monoceres Posted March 18, 2008 Share Posted March 18, 2008 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! Link to comment Share on other sites More sharing options...
Squirrely1 Posted March 18, 2008 Share Posted March 18, 2008 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 Link to comment Share on other sites More sharing options...
L'egyptien Posted March 26, 2008 Author Share Posted March 26, 2008 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 !!! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now