»
 

Go Back   ResellerRatings Store Ratings > ResellerRatings Forums > Tech Support

Reply
 
LinkBack Thread Tools Display Modes
Old 04-19-2004, 09:58 AM   #1 (permalink)
Registered User
 
jgargac's Avatar
 
Join Date: Oct 2001
Location: St. Louis, MO
Posts: 455
jgargac is on a distinguished road
Talk scripting question/languages

Hello everyone,

I need to write a script to verify that certain exe files are located in specific directories. The use of this script would be to determine if P2P programs were loaded on a computer. How would I get started and what language would be best? The code needs to be portable across multiple computers without having to install any software. Thanks,

Jeff

jgargac is offline   Reply With Quote
Old 04-19-2004, 10:04 AM   #2 (permalink)
Registered User
 
DVNT1's Avatar
 
Join Date: Oct 2001
Location: Ohio
Posts: 5,577
DVNT1 is on a distinguished road
You could use a VBS script to do the file check.

Is this in a Domain environment?

What client OSes are involved?
DVNT1 is offline   Reply With Quote
Old 04-19-2004, 10:16 AM   #3 (permalink)
Registered User
 
jgargac's Avatar
 
Join Date: Oct 2001
Location: St. Louis, MO
Posts: 455
jgargac is on a distinguished road
DVNT1,

This is not in a domain environment and the clients will be win2000 and winxp. I'm leaning toward Windows Script/VBscript, but I don't know how to start the code. I'm currently looking at the scriptomatic tool to see if I can possible use code from it. Thanks,

Jeff
jgargac is offline   Reply With Quote
Old 04-19-2004, 10:19 AM   #4 (permalink)
Registered User
 
Join Date: Apr 2002
Posts: 58
JohnRoboto is on a distinguished road
Uhmmm you might have trouble finding a scripting language that is portable without installing any software. At the very least, each computer will have to have an installation of the required libraries and interpreter in order to process the script.

I recommend Perl. IIRC, it's fairly easy to install on Windows machines (can't remember for *nix, been a long time). And gives pretty easy functions for file manipulation.
JohnRoboto is offline   Reply With Quote
Old 04-19-2004, 10:33 AM   #5 (permalink)
Registered User
 
DVNT1's Avatar
 
Join Date: Oct 2001
Location: Ohio
Posts: 5,577
DVNT1 is on a distinguished road
If you were in a Domain, it could all be done from your computer without physically touching the others.

In a workgroup, it could work relatively easily if you know all the computer names and related Administrator account name/password.
DVNT1 is offline   Reply With Quote
Old 04-19-2004, 10:35 AM   #6 (permalink)
Registered User
 
DVNT1's Avatar
 
Join Date: Oct 2001
Location: Ohio
Posts: 5,577
DVNT1 is on a distinguished road
Alternately, you could also create a BATCH file to do the checking for specific file names.

Is your intention to physically go to each machine to run the script ?
DVNT1 is offline   Reply With Quote
Old 04-19-2004, 10:51 AM   #7 (permalink)
Registered User
 
jgargac's Avatar
 
Join Date: Oct 2001
Location: St. Louis, MO
Posts: 455
jgargac is on a distinguished road
Yes, we are setting up a check-in station for student computers to run through. It will not be done remotely.
jgargac is offline   Reply With Quote
Old 04-19-2004, 10:55 AM   #8 (permalink)
Registered User
 
Join Date: Oct 2001
Location: TOO close to Wash DC
Posts: 7,956
vass0922 is on a distinguished road
Here is a cheesy script I wrote to do basically what you're doing...
Now this one was intended to use from a central location where you can connect to each one so it may not work for you but if you want to learn vbscript it'll give you a good idea of what you want to do

Code:
On Error Resume Next

Dim objFSO
Dim objInputFile
Const FILE_PATH = "C:\CurrentServers.txt"
Const CHECK_FILE = "\ADMIN$\system32\Msasn1.dll"
Set objFSO = CreateObject("Scripting.FileSystemObject") 
Const FOR_READING = 1
Set objInputFile = objFSO.OpenTextFile(FILE_PATH, FOR_READING)

While Not objInputFile.AtEndOfStream
  sCurLine = Trim(objInputFile.ReadLine)
  If sCurLine <> "" Then
    If objFSO.FileExists("\\" & sCurLine & CHECK_FILE) Then
      WScript.Echo "Exists: " & sCurLine
    End If
  End If
Wend
Just put all the machine names/IP's in a text file called Servers.txt (as shown in the script) and it will connect to each box
This does not check for installed applications, it just does as requested and looks for the existence of a file.

JohnRoboto
Any machine with IE5 and greater has the Windows Scripting Host that contains VBScript and JScript which works pretty well for coding purposes on windows machines (as I believe is what jgargac is looking for)
So no installation needed.
Seeing as this script only uses the FileSystemObject it should be just fine for win98 and above.

The scriptomatic I believe only helps you with using WMI and does not do any FSO which is what you'll need for the file system work you need.

Let me know if this helps, or at least gets you in the right direction.
You won't be able to impersonate a specific user with this unfortunately.
__________________
<< Insert exceedingly large and overly verbose message of how 1337 you are here including full specs of every vehicle you've ever driven and PC you've owned >>
vass0922 is offline   Reply With Quote
Old 04-19-2004, 11:22 AM   #9 (permalink)
Registered User
 
DVNT1's Avatar
 
Join Date: Oct 2001
Location: Ohio
Posts: 5,577
DVNT1 is on a distinguished road
simple batch file example (executed locally)

Code:
Echo off
echo .
echo .
echo .
IF NOT EXIST "C:\Program Files\Outlook Express\msimn.exe" GOTO check2
echo msimn exists
echo .

:Check2
IF NOT EXIST "C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe" GOTO check3
echo AcroRd32 exists
echo .

:Check3
IF NOT EXIST "C:\Program Files\kaza\kaza.exe" GOTO check4
echo KAZA exists
echo .

:Check4
IF NOT EXIST c:\bad.exe GOTO ENDING
echo BAD exists
echo .

:Ending
echo .
pause
exit

Last edited by DVNT1; 04-19-2004 at 11:24 AM.
DVNT1 is offline   Reply With Quote
Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Most Active Discussions

Recent Discussions

All times are GMT -6. The time now is 06:56 PM.