Solved

Use VBScript to run an exe located on network

Posted on 2009-07-06
6
796 Views
Last Modified: 2013-12-23
I'm trying to write a very basic VBScript to add to the logon script in AD to remove Groupwise 7 using the utility "cleanit.exe".
The script seems to run without errors but is not executing it on the client/target machine.  Not sure what I'm missing.

Thanks!


Dim WSHShell
Dim sServer, sPath, sSwitches
Dim sServerName, sWinXp, sCmd
Dim Command, objArgs
 
On Error Resume Next
 
Set WSHShell = WScript.CreateObject("WScript.Shell")
 
sServerName = "\\server.path.com"
sPath = "\apps"
sWinXp = "\CleanIt.exe"
sSwitches = " /sn"
 
'Set the command line - format: "\\server\share\path\hotfix.exe" /switches
sCmd = sServerName & sPath & sWinXp & sSwitches
 
Command = sCmd
 
Public Function RunPatch
'set path of executable to command variable
Command = sCmd
'run the command
WSHShell.Run Command,1,False
End Function

Open in new window

0
Comment
Question by:khiggins1979
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 24784721
Hi, khiggins1979.

Comment out the "On Error resume Next" command and see if you get an error.
0
 
LVL 1

Author Comment

by:khiggins1979
ID: 24785280
With "On Error resume Next" still runs with no errors.

Couple things worth mentioning is the share itself is not mapped to a drive letter on the local machines but all users authenticated have access to it.  Not sure if maybe somewhere the script needs to be told to use the current logged in users' authentication?  The only other thing I can think of it is maybe it's trying to run the .exe on a different machine and that the localhost needs to be targeted?

Thanks!
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24790473
Does the script run if you run it locally (i.e. double-click on the script instead of attempting to run it via a login script)?
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 1

Author Comment

by:khiggins1979
ID: 24793168
Runs locally without error but doesn't seem to execute the file.  I've checked the processes and wscript, cscript nor the cleanit.exe are there.  Same behavior when ran from the network.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24793389
Purely as a test how about mapping a drive and adjusting the path to the exe to use the mapped drive?
0
 
LVL 13

Accepted Solution

by:
Daz_1234 earned 500 total points
ID: 24924484
Comment out On Error Resume Next, i.e..

'On Error Resume Next
  -(or just delete the line temporarily).

Then change the end run line(s) with the following:

WSHShell.Run Command,1,True
MsgBox "Run Complete"
End Function

Now run it again manually.  Changing the False to True, forces the script to wait until the executable has finished before moving to the next line.  I have added a MsgBox so that you'll know when the call has completed.  Now, if you get no errors, the CleanIt.exe will have run and the problem must be with that exe.  Then you would need to test the exe alone, outside of the script to see why it is not working.

Hope this helps.
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Active Directory security has been a hot topic of late, and for good reason. With 90% of the world’s organization using this system to manage access to all parts of their IT infrastructure, knowing how to protect against threats and keep vulnerabil…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question