#198437 - 2010-04-23 01:59 AM
ReadValue hit & miss
|
itgaz
Fresh Scripter
Registered: 2009-11-09
Posts: 8
Loc: New Zealand
|
Sorry posted in wrong version - as below;
Edited by itgaz (2010-04-23 02:03 AM)
|
Top
|
|
|
|
#198438 - 2010-04-23 02:02 AM
Re: ReadValue hit & miss
[Re: itgaz]
|
itgaz
Fresh Scripter
Registered: 2009-11-09
Posts: 8
Loc: New Zealand
|
Hello all,
I've written a little script that tells me what Internet browser(s) are installed on a PC and which one is the Default. Here's the simplified version;
---------------------------------------------------------------------------
SETCONSOLE("HIDE")
IF Open( 3 , "D:\%USERNAME%.txt" , 5 ) = 0
WriteLine( 3, @DATE + "," + "%USERNAME%" + "," + "%USERCONTEXT%" + "," + @IPADDRESS0 + "," + @WKSTA + "," + @ProductType
+ "," + @CSD + ",")
$Explorer = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer", "Version")
$Firefox = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox", "CurrentVersion")
$Safari = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Apple Computer, inc.\Safari", "Version")
$Chrome = ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome", "Version")
$Default = ReadValue("HKEY_CURRENT_USER\Software\Classes\http\shell\open\ddeexec\Application", "")
If @ERROR = 0
$x = WriteLine( 3, "Explorer=$Explorer" + "," + "Firefox=$Firefox" + "," + "Safari=$Safari" + "," + "Chrome=$Chrome" +
"," + "Default=$Default" + @CRLF + @CRLF)
Endif
WriteLine( 3, ",")
---------------------------------------------------------------------------
I added the Prodcut Type and CSD to see if it was a certain version that doesnt work as I dont really need this info, but alas no.
The trouble is I only seem to be getting around half the results back - outputs vary as below;
--------------------------------------------------------------------------- USER,IP,WORKSTATION,Windows XP Professional,Service Pack 3 USER,IP,WORKSTATION,Windows 2000 Professional,Service Pack 4
USERWORX,IP,WORKSTATION,Windows XP Professional,Service Pack 3,Explorer=6.0.2900.5512,Firefox=3.5.9 (en-US),Safari=,Chrome=,Default=Firefox
---------------------------------------------------------------------------
As you can see USERWORX is fine but another user with the same OS & SP (+Image) doesnt.
Anybody have any ideas why some report back and some dont..? It seems to break at the point of ReadValue - but even if the key doesnt exist it shouldnt prevent the rest of the script from running - all machinges should at least be coming back with IE and a Default Browser...
Thanks,
Gaz
Edited by Allen (2010-04-23 06:22 AM) Edit Reason: added code tags
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Allen)
and 382 anonymous users online.
|
|
|