![]() |
| |||||||
| Notices |
![]() |
| LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) |
| Hi, I have the following: try{ wmiobj = locmachine.ExecQuery("Select * from Win32_NTLogEvent Where Logfile = 'Security' And TimeWritten >= '" + dtmStartDate + "' and TimeWritten < '" + dtmEndDate + "'"); }catch(err){ wmiobj=null; } WScript.Echo(String(wmiobj)); running as a WSF JavaScript, unfortunately when I run it and the query doesn't return anything it doesn't raise an error, so wmiobj does not get set to null How do I set it to null if the query does not provide a usable return? | Guest
Posts: n/a
|
|
| | #2 (permalink) | |
| If the query is written correctly it will not fail, it is returning nothing, basically an empty collection. You can check the Count on "wmiobj", if it is equal to 0 then you can go ahead an set it to null. Thanks, Jonathan -- This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm -- "pantagruel" <rasmussen.bryan@gmail.com> wrote in message news:bccfc8b1-85fc-4907-b3bc-0bf5b98f6f43@d2g2000pra.googlegroups.com... Quote:
| Guest
Posts: n/a
| |
|
![]() |
| Tags |
| None |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| VPN connection was working, now fails with error 651 | jahyen | Windows Vista Networking & Sharing | 2 | 02-26-2007 11:55 AM |
| WMI query local computer fails with access denied despite being local admin | xr7 | Windows XP WMI | 0 | 11-17-2005 06:48 PM |
| Catching all internet activity on my network | Mike Riston | Windows XP Network & Web | 7 | 07-25-2003 03:59 PM |
| Catching all network activity. | Mike Riston | Windows XP Hardware | 0 | 07-23-2003 04:39 AM |
| Connection Error - Unable to query version information | Xdrive, Inc. Support | Windows XP New Users | 0 | 07-15-2003 08:33 PM |