Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create & Run Service

Status
Not open for further replies.

WalleyeGuy

Technical User
Oct 18, 2007
44
US
Hello All,

First the problem (overall):
We're having problems with people bringing in viruses from their USB Drives (Thumb Drives, USB Sticks..whatever).

My possible solution:
I've found this utility named USBVirusScan ( to which will detect when an USB Device is inserted in to the computer and with parameters will run whatever parameter you pass it.

Now, my issue:
I have a script that I've created that'll create a service and that seems to work; however, it seems that the parameters I pass don't pull fully.

If I run this whole thing as a batch file it works perfectly
BATCH: C:\Windows\USBVirusScan.exe -cie c:\Progra~1\AVG\AVG8\avgscanx.exe /scan=%%c: /clean /nobreak

Code for the Service(snipped):
strSvcName = "USBScan"
strSrvAnyPath = "c:\reskit\srvany.exe"
strUSBScanPath = "C:\Windows\USBVirusScan.exe"
strUSBScanParam = "c:\Progra~1\AVG\AVG8\avgscanx.exe /scan=%%c: /clean /nobreak"

objReg.CreateKey HKLM,strKeyPath
objReg.SetStringValue HKLM,strKeyPath,"Application",strUSBScanPath
objReg.SetStringValue HKLM,strKeyPath,"AppParameters",strUSBScanParam


Now, AVG does start upon USB insertion; however, scans no files or directories (using the script created service); however, does scan files and directories if using that batch file.

I suppose I could copy over the usbvirusscan.exe and batch file and force a start of the batch file within the login script; however, not sure how to hide the cmd window (I've tried objFSO.ShellExecute with the app and parameters, I get the same results as script created service.

Any ideas?

Thanks Ahead of time
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top