Page 1 of 1 1
Topic Options
#198015 - 2010-03-09 10:34 PM Google Earth check
mahjohn Offline
Fresh Scripter

Registered: 2004-11-02
Posts: 26
I am looking for code to add to my script that can check the two locations below for "googleearth.exe", and if found, log to a .txt file on a server with computer name, username, and date.

Also, is it possible to check the .txt file to see if the computer/username combo already exists? I don't want the same computer registering everyday.

"~\Application Data\Google\Google Earth\GoogleEarth.exe"
"C:\Program Files\Google\Google Earth\GoogleEarth.exe"

thanks

Top
#198016 - 2010-03-09 10:42 PM Re: Google Earth check [Re: mahjohn]
mahjohn Offline
Fresh Scripter

Registered: 2004-11-02
Posts: 26
people are stupid enough to reinstall, after i've uninstalled !! inmates are running the asylum
Top
#198017 - 2010-03-10 03:28 AM Re: Google Earth check [Re: mahjohn]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
A. Use an INI file with Read/WriteProfileString - easier to manage than a text file.

B. Consider implementing a GPO to prevent the installation of this software

C. Take away everyone's local admin rights. \:\)

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#198018 - 2010-03-10 09:26 AM Re: Google Earth check [Re: mahjohn]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Logging each workstation that has Google Earth installed is not so difficult. A script like below will log it for you. It checks if an ini file exists and if it does it set a variable to show that Google Earth has been detected before.

 Code:
Break on

$appdata = ExpandEnvironmentVars(%appdata%)
$progfiles = ExpandEnvironmentVars(%programfiles%)

If Exist( ("\\server\share\G_Earth_Installed_" + @WKSTA + ".ini")
	$alreadydetected = "yes"
Else
	$alreadydetected = "no"
EndIf

If Exist( $appdata + "\Google\Google Earth\GoogleEarth.exe")
	$rc = WriteProfileString("\\server\share\G_Earth_Installed_" + @WKSTA + ".ini", "AppData", @WKSTA, "Yes")
	$rc = WriteProfileString("\\server\share\G_Earth_Installed_" + @WKSTA + ".ini", "AlreadyDetected", @WKSTA, $alreadydetected)
EndIf

If Exist ($progfiles + "\Google\Google Earth\GoogleEarth.exe")
	$rc = WriteProfileString("\\server\share\G_Earth_Installed_" + @WKSTA + ".ini", "ProgramFiles", @WKSTA, "Yes")
	$rc = WriteProfileString("\\server\share\G_Earth_Installed_" + @WKSTA + ".ini", "AlreadyDetected", @WKSTA, $alreadydetected)
EndIf


Edited by Mart (2010-03-12 10:59 AM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#198039 - 2010-03-11 03:45 PM Re: Google Earth check [Re: Mart]
mahjohn Offline
Fresh Scripter

Registered: 2004-11-02
Posts: 26
so...i've run into a problem, i've run the script with -d for debugging, and it appears to end after the $appdata section without getting to the $progdata section?
Top
#198040 - 2010-03-11 05:28 PM Re: Google Earth check [Re: mahjohn]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Can you put the code below just after de $rc?

 Code:
?$rc
?@error
?@serror
sleep 5


This will show some error codes on the screen so you can see what is happening.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#198041 - 2010-03-11 05:45 PM Re: Google Earth check [Re: Mart]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4546
Loc: USA
You have
$progfile = ExpandEnvironmentVars(%programfiles%)

at the top of your code, but $progdata in your if.

Top
#198045 - 2010-03-12 11:01 AM Re: Google Earth check [Re: Allen]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
LOL Sorry, my bad.
Fixed the post above.

Thanks Allen.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#198067 - 2010-03-15 08:04 PM Re: Google Earth check [Re: Mart]
mahjohn Offline
Fresh Scripter

Registered: 2004-11-02
Posts: 26
thank you much...works very nicely...now to just beat some sense into people....3 licenses does not = 200 installs !!

Edited by mahjohn (2010-03-15 08:10 PM)

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 384 anonymous users online.
Newest Members
SERoyalty, mytar, Gabriel, Alex_Evos, Dansen
17869 Registered Users

Generated in 0.211 seconds in which 0.165 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org