Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


VBSCRIPT TO RUN EXE

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,26260
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VBSCRIPT TO RUN EXE
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1] 2   next >   >>
Login
Message << Older Topic   Newer Topic >>
 VBSCRIPT TO RUN EXE - 9/23/2005 7:31:21 AM   
  cjwallace

 

Posts: 484
Score: 0
Joined: 3/5/2005
From: United Kingdom
Status: offline
Guys. Can anyone tell me.

Is there a way with VBscript to get it to run a exe off of a cdrom. Now yes i hear you say and i know this can be done aswell, but is there away with the script to say only run this script if the exe is from a certain company?

Please let me know if you want me to explain more.

Basically i want a script to install software off a CDROM but only if the exe is from a certain company

Any help on this would be great

Thanks
 
 
Post #: 1
 
 RE: VBSCRIPT TO RUN EXE - 9/23/2005 7:56:05 AM   
  thantos_kalev2001


Posts: 26
Score: 0
Joined: 8/31/2005
Status: offline
When you say certain company, can you differentiate by the name of the executable?  Other than the name and/or folder path, I dont know how you could choose which exe's to run.

(in reply to cjwallace)
 
 
Post #: 2
 
 RE: VBSCRIPT TO RUN EXE - 9/23/2005 8:26:42 AM   
  kracksmith

 

Posts: 198
Score: 0
Joined: 2/24/2005
From:
Status: offline
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthrun.asp

WshShell.run "cmd /c ""d:\your.exe""",0,True

(in reply to thantos_kalev2001)
 
 
Post #: 3
 
 RE: VBSCRIPT TO RUN EXE - 9/23/2005 8:33:43 AM   
  cjwallace

 

Posts: 484
Score: 0
Joined: 3/5/2005
From: United Kingdom
Status: offline
basically. Our users are members of the local users group on the pc hence they cant run any exe files. Now one of our partners gets some CD's in that he would like to install but cant

All the CD's he gets the exe is in D:\setup\setup.exe and is from ABV company.

Now i can convert a script .vbs with Admin Script Studio into a exe which will run with admin rights, but i dont want this guy running any CD he puts into his CDROM drive. So i was wondering is there a way for the script to check that the exe is from ABC company and if so run it and if not dont run it or just error?

Any ideas?

Many thanks

(in reply to kracksmith)
 
 
Post #: 4
 
 RE: VBSCRIPT TO RUN EXE - 9/24/2005 7:42:33 AM   
  cjwallace

 

Posts: 484
Score: 0
Joined: 3/5/2005
From: United Kingdom
Status: offline
Anyone???

(in reply to cjwallace)
 
 
Post #: 5
 
 RE: VBSCRIPT TO RUN EXE - 9/25/2005 6:54:13 AM   
  didorno

 

Posts: 361
Score: 0
Joined: 2/12/2005
From:
Status: offline
cjwallace, with the next script, I get the manufacturer of the .exe, but I can imagin that
not all exes have that option filled in.

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
    ("Select * from CIM_Datafile Where name = 'c:\\Program Files\\Skyline\\TerraExplorer\\TerraExplorer.exe'")
For Each objFile in colFiles
    Wscript.Echo "Drive: " & objFile.Drive
    Wscript.Echo "Manufacturer: " & objFile.Manufacturer
    Wscript.Echo "Name: " & objFile.Name
    Wscript.Echo "Version: " & objFile.Version
Next

Source The System Administration Scripting Guide from Technet Script Center

Regards.

_____________________________

Regular Expression ? I (L+o{1,}v{1,3}e\s)+[iI]t!$

(in reply to cjwallace)
 
 
Post #: 6
 
 RE: VBSCRIPT TO RUN EXE - 9/25/2005 7:25:13 AM   
  cjwallace

 

Posts: 484
Score: 0
Joined: 3/5/2005
From: United Kingdom
Status: offline
Hello mate. Great thanks for the reply. i knew there must have been away of getting this information.

Now with the script you have above. what i would like it to do, is somehow look at the .exe and if it is from ABC Company then run it , or if it does not have a company or is not from ABC company dont run it or just error.

Any ideas how i might do this.

Thanks for any help you can give

(in reply to didorno)
 
 
Post #: 7
 
 RE: VBSCRIPT TO RUN EXE - 9/25/2005 7:34:15 AM   
  Snipah


Posts: 1341
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
I suggest run the above script with:
 
If objFile.Manufacturer = "ABC" Then
  Wscript.Run "<CDROM>:\setup.exe"
Else
  MsgBox "ERROR, YOU ARE NOT AUTHORIZED TO RUN THIS...YOU HAVE BEEN REPORTED!"
  Wscript.Quit(0) 

End If
 
 


_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to cjwallace)
 
 
Post #: 8
 
 RE: VBSCRIPT TO RUN EXE - 9/26/2005 1:07:28 AM   
  cjwallace

 

Posts: 484
Score: 0
Joined: 3/5/2005
From: United Kingdom
Status: offline
Hello mate. Thanks for the reply.

The code so far is...........


strComputer =
"."

Set
objWMIService = GetObject("winmgmts:" _
&
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set
colFiles = objWMIService.ExecQuery _
(
"Select * from CIM_Datafile Where name = 'E:\\NUCD.exe'")

For
Each objFile In colFiles
WScript.Echo "Drive: " & objFile.Drive
WScript.Echo "Manufacturer: " & objFile.Manufacturer
WScript.Echo "Name: " & objFile.Name
WScript.Echo "Version: " & objFile.Version

Next


If
objFile.Manufacturer = "Symantec Corporation" Then
WScript.Run "E:\NUCD.exe"

Else

MsgBox "ERROR, YOU ARE NOT AUTHORIZED TO RUN THIS...YOU HAVE BEEN REPORTED!"
WScript.Quit(0)

End
If

===========================
 
When i run this script i get.
 
Line 42

Char 1

 
Error: Object required: 'objFile'
 
Any ideas?

Many thanks for your help and input on this


(in reply to Snipah)
 
 
Post #: 9
 
 RE: VBSCRIPT TO RUN EXE - 9/26/2005 3:01:28 AM   
  tnoonan

 

Posts: 364
Score: 0
Joined: 12/14/2004
From:
Status: offline
strComputer = "."
Set oShell = CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colFile = objWMIService.ExecQuery _
("Select * from CIM_Datafile Where name = 'E:\\NUCD.exe'")
For Each objFile In colFile
WScript.Echo "Drive: " & objFile.Drive
WScript.Echo "Manufacturer: " & objFile.Manufacturer
Call Filetest()
wscript.Echo objFile.Manufacturer
WScript.Echo "Name: " & objFile.Name
WScript.Echo "Version: " & objFile.Version
Next

Sub Filetest()
If objFile.Manufacturer = "Symantec Corporation" Then
oShell.Run "E:\\NUCD.exe"
Else
MsgBox "ERROR, YOU ARE NOT AUTHORIZED TO RUN THIS...YOU HAVE BEEN REPORTED!"
WScript.Quit(0)
End If
End Sub

_____________________________

If you can conceive it you can achieve it
___________________________________

www.spoogenet.com

(in reply to cjwallace)
 
 
Post #: 10
 
 RE: VBSCRIPT TO RUN EXE - 9/26/2005 3:24:02 AM   
  cjwallace

 

Posts: 484
Score: 0
Joined: 3/5/2005
From: United Kingdom
Status: offline
You are the man. That worked.

Thank you so much for your help.

(in reply to tnoonan)
 
 
Post #: 11
 
 RE: VBSCRIPT TO RUN EXE - 9/26/2005 4:27:57 AM   
  didorno

 

Posts: 361
Score: 0
Joined: 2/12/2005
From:
Status: offline
Snipah and tnoonan,
thanks for your help.
It would be nice if an explanation is given why the objfile.manufacturer is
only valid within the For Each Loop.
For me also a question.

Bye bye !

_____________________________

Regular Expression ? I (L+o{1,}v{1,3}e\s)+[iI]t!$

(in reply to cjwallace)
 
 
Post #: 12
 
 RE: VBSCRIPT TO RUN EXE - 9/26/2005 5:29:35 AM   
  Snipah


Posts: 1341
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
Didorno,

Best to describe this is to quote Microsoft:

quote:


The ExecQuery method of the SWbemServices object executes a query to retrieve objects. These objects are available through the returned SWbemObjectSet collection.

A collection is a standard automation concept that provides a uniform interface to a set of objects over which you can perform iteration. The Scripting API for WMI exposes a number of interfaces that conform to the collection paradigm. In each case, you can use the Item method to identify the elements using a string .

Hope this helps...

Snipah

< Message edited by Snipah -- 9/26/2005 5:32:12 AM >


_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to didorno)
 
 
Post #: 13
 
 RE: VBSCRIPT TO RUN EXE - 9/26/2005 7:02:15 AM   
  didorno

 

Posts: 361
Score: 0
Joined: 2/12/2005
From:
Status: offline
Snipah, I not fully understand the implications of your quote. But...
I understand that putting the collection in a dictionary, gives the opportunity
to access it after the inquiry in an easy way.

Anyhow, thank you for your response !

_____________________________

Regular Expression ? I (L+o{1,}v{1,3}e\s)+[iI]t!$

(in reply to Snipah)
 
 
Post #: 14
 
 RE: VBSCRIPT TO RUN EXE - 9/26/2005 7:16:08 AM   
  Snipah


Posts: 1341
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
to sum it all up: yes

no probs

_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to didorno)
 
 
Post #: 15
 
 RE: VBSCRIPT TO RUN EXE - 9/26/2005 11:57:52 PM   
  mbouchard


Posts: 1804
Score: 12
Joined: 5/15/2003
From: USA
Status: online
I know that I am coming in after the fact, but I just had to put my 2 cents in.

Will the setup always be in the same location on each CD?  Will they always use setup.exe?

If the answer to either is no, then you might want to take a look at the AutoRun.inf to get the location of and the name of the setup file.

Also,  is there a chance that they will not set the manufacturer field on the exe?  If so, you might want to include the ability to find a readme file, open it, and look for the name of the company.

(in reply to Snipah)
 
 
Post #: 16
 
 RE: VBSCRIPT TO RUN EXE - 9/27/2005 2:00:24 AM   
  Snipah


Posts: 1341
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
I believe that Symantec has their name written down in the app, looking at their commercial status.....

but yes, for other companies this might be something to talk about. Also, not all companies create their own setup, place README files or neatly fill in the Autorun.inf....

Alotta companies even outsource their distribution, and distribution centers normally put their sig on it....

So when push comes to shove, you have an issue there....


unfortunatly there is no uniform way of creating a CD-Rom

< Message edited by Snipah -- 9/27/2005 2:01:30 AM >


_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to mbouchard)
 
 
Post #: 17
 
 RE: VBSCRIPT TO RUN EXE - 9/27/2005 4:54:33 AM   
  didorno

 

Posts: 361
Score: 0
Joined: 2/12/2005
From:
Status: offline
mbouchard and Snipah
You both have an issue. If the cd to be allowed is known beforehand,
it is rather easy to add to the script additional requirements,
such as file names, sizes, versions, and even folder structure, etcetera.
By doing so, you narrow the chance of using an 'illegal' cd, if this is
important enough.

Bye, bye.

_____________________________

Regular Expression ? I (L+o{1,}v{1,3}e\s)+[iI]t!$

(in reply to Snipah)
 
 
Post #: 18
 
 RE: VBSCRIPT TO RUN EXE - 9/27/2005 7:08:23 AM   
  didorno

 

Posts: 361
Score: 0
Joined: 2/12/2005
From:
Status: offline
Snipah, I see that your reply is to cjwallace......, so I don't need to respond.



_____________________________

Regular Expression ? I (L+o{1,}v{1,3}e\s)+[iI]t!$
 
 
Post #: 19
 
 RE: VBSCRIPT TO RUN EXE - 9/27/2005 7:10:13 AM   
  Snipah


Posts: 1341
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
We have issues????

-lol-



is this better?  

_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to didorno)
 
 
Post #: 20
 
 
Page:   [1] 2   next >   >>
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VBSCRIPT TO RUN EXE Page: [1] 2   next >   >>
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts