Rob van der Woude's Scripting Pages

News Archives 2011 Q3


[ Back to the current news page... ]


September 25, 2011 • Another update for Hardware.hta: DxDiag data has been added to most Details windows (if the /DxDiag switch has been used on the local computer).
September 23, 2011 DxVideo.bat has been updated, it will now "stop gracefully" when XML Starlet is not found.

• Like DxVideo.bat, DxSound.bat uses DirectX (DxDiag.exe) to list some properties, this time for every sound device: the name and hardware acceleration level, and if the device is the default device for sound and voice playback.
Comparing the 2 batch files may help you find out how to write your own batch files for DxDiag based queries.
September 20, 2011 DxVideo.bat is a spin-off of Hardware.hta's DirectX functionality. The batch file uses DirectX (DxDiag.exe) to list the name, amount of video memory, screen resolution and monitor model for every video output (WMIC will only return the correct values if there is only a single video card and monitor). Using DxDiag means the inventory can take a minute or more in the first run, but the inventory data can be reused by the batch file to speed up the process.
September 18, 2011 • I ironed out some glitches in Hardware.hta's Help and Credits screens.
September 17, 2011 • Gary Johnson's questions about Hardware.hta inspired me to add an option to use DxDiag.exe instead of WMI for the video properties.
This is much more reliable than WMI, but it is very slow (a minute or more extra delay) and works only on the local computer. This made testing a real nightmare...
While working on it, I also added a "Save" option (button as well as command line).

Thanks Gary
August 17, 2011 • WMIGen.hta 7.10 beta 2 is available.
The generated Object Pascal (Delphi™) code skips properties of type Array and returns the string "[Array]" instead.
August 16, 2011 • If you are interested in beta testing the next WMIGen.hta version: it can be downloaded here.
Besides the languages supported in Version 7.02, Version 7.10 beta 1 can also generate Java and Object Pascal (Delphi™) code.
The Object Pascal code still needs "some" work, it breaks on WMI properties of type "Array" (try the Win32_CDROMDrive class in the root/CIMV2 namespace).

• An unscheduled intermediate update of WMIGen.hta: in Version 7.03 Java has already been implemented, and a bug that could disable the "Generate Code" and/or "Run Code" buttons has been fixed.
It is the code from Version 7.10 beta 1 with all references to Object Pascal removed and the bug fixed.
August 15, 2011 • A bug was found in WSHVer.vbs: it would sometimes return an incorrect errorlevel when comparing the actual WSH version against the required one.
This bug has been fixed.
August 12, 2011 • The new KiXtart 2010 4.62 has been released.
It can be downloaded here.
August 11, 2011 • For now, the last planned update for WMIGen.hta has been released. All planned features have been added (though support for more languages is in the pipeline).
The latest version of the HTA can even be used to generate code or perform WMI queries without any interaction.
Read all about the new features in the changes list.
August 9, 2011 • I dedicated a new page to math in batch files.
August 8, 2011 • David Riemens improved Which.bat: it has become much faster.
The (small) price to pay is it probably won't work in Windows 2000 (not tested).

Thanks David
August 7, 2011 • The first bug in WMIGen.hta Version 7 has been fixed: no more error message when trying to access the MSDN Help.
August 6, 2011 WMIGen.hta Version 7.00 has been officially released.
The Release Candidates will be removed from my site.
August 4, 2011 • Steve Robertson and myself improved Hardware.hta once more.
Steve recommended using a PING (Win32_PingStatus), which catches the error much faster than the WMI timeout did, in case of non-existing or off-line computers.
Steve also suggested an improvement in the interface: in theory, the HTA can now be used without a mouse, i.e. keyboard only.
The SATA detection has also been improved. It is still far from perfect, though, as can be seen in the screenshot at the Hardware.hta product page: my harddisks #0, #3 and #4 are all identical, but #4 is on a RAID enabled controller, which causes an incorrect interface detection.
If the WMI repository incorrectly lists a disk as SCSI, and the PnP ID also classifies it incorrectly as SCSI, then a WMI query will not be able to tell you differently. Fixing this in a script would require using a database with disk models and their interface types.

Thanks again Steve!

• I rewrote ListWMIClasses.vbs, it now lists all WMI classes in all namespaces by default.
August 3, 2011 WMIGen.hta Version 7.00 Release Candidate 2 is available for download.
I tested the generated source code for each language with 2 namespaces and 3 classes, but that does not guarantee there are no more bugs left...
If you want to test it, either start it with the /NOUPDCHK command line switch or just hide and ignore the "Invalid version" notification at the top.
July 31, 2011 • For the next major update of WMIGen.hta I rewrote a lot of code.
All versions up to and including 6.24 listed only classes from the root/CIMV2 namespace.
Version 7.00 Release Candidate 1 features a drop-down list to select a different namespace, as well as a command line switch to select a different initial namespace at startup.
The new RC1 still requires a lot of testing before its final release, especially the generated code, but you can download and try it now, if you like.
July 30, 2011 WMIGen.hta has been updated again: it now offers a choice to either add or leave out the WQL and wbemFlagReturnImmediately + wbemFlagForwardOnly parameters in the ExecQuery statement.
Though not using these parameters has some advantages (see the July 10 news item), it does require more resources, which may slow down inventory scans involving large numbers of remote computers.
July 26, 2011 • I guess I wasn't the only one who once dismissed FORFILES.EXE as an obsolete mimic of NT's internal FOR command.
Rob Van Etta had a closer look and found out it can do more, like output "special" characters using their hexadecimal ASCII value.
For example:

FORFILES /P %~dps0 /M %~nxs0 /C "CMD /C ECHO 0x07"

will make the speaker emit a beep (ASCII character 7).
Of course there are other ways to do this, this is just a simple example.
I used this trick to improve my own Chr.bat: it now accepts decimal values from 32..126 as well as hexadecimal values.

Thanks Rob
July 25, 2011 • More maintenance on the web server tonight:

We are planning to perform an upgrade of one of our central storage systems the night between Monday July 25 2011 and Tuesday July 26 2011 from 03:00 to 05:30 CET.
Your website will be affected by this upgrade and during this period you might experience a short downtime of 5 to 10 minutes.
We plan to have everything up and running normally at 05:30 CET.

• I applied Steve Robertson's recommendations to WMIGen.hta.
The generated code no longer contains the WQL and wbemFlagReturnImmediately + wbemFlagForwardOnly parameters in the ExecQuery statement.

Thanks Steve
July 19, 2011 • Matt Bouwens found and corrected 2 errors in MemberOf.bat.

Thanks Matt
July 10, 2011 • Steve Robertson and yours truly optimized and partly rewrote Hardware.hta.
It has become much faster by reusing objects instead of creating new instances for every hardware component.
Steve also taught me a great WMI trick: by removing the second and third parameters from the ExecQuery( ) method, the .Count property will actually work.
So instead of:

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly       = &h20

Set objWMIService = GetObject( "winmgmts://./root/CIMV2" )
Set colItems = objWMIService.ExecQuery( "SELECT * FROM Win32_DiskDrive", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly )
disks = 0
For Each objItem in colItems
    disks = disks + 1

we can use:

Set objWMIService = GetObject( "winmgmts://./root/CIMV2" )
Set colItems = objWMIService.ExecQuery( "SELECT * FROM Win32_DiskDrive" )
disks = colItems.Count

With wbemFlagForwardOnly, one cannot iterate through the colItems collection twice, so the first code snippet often forced me to instantiate colItems a second time, which is no longer necessary when using the second code snippet.
That, and the reuse of the objWMIService object greatly improved the HTAs performance.

To learn more about the wbemFlagReturnImmediately and wbemFlagForwardOnly flags, read "Making a Semisynchronous Call with VBScript".

Thanks Steve
July 5, 2011 • • Steve Robertson thoroughly tested and debugged Hardware.hta version 5.21 on Windows XP with Internet Explorer 7.
As a result, the new version (5.30) should now correctly display multiple harddisks, CDROMs, network or video adapters in IE7 too.
Steve also found a bug in the delay function, which I had added to allow GUI updates while the inventory is running.

Thanks Steve


Archived News pages
Archived news from 2011
Archived news from 2010
Archived news from 2009
Archived news from 2008
Archived news from 2007


page last modified: 2018-04-16