/build/static/layout/Breadcrumb_cap_w.png

vbscript to run remotely

Hi Friends,
Currently I am working with antivirus team, and we have to run 1 script remotely by using psexec command. By using psexec switch we accessed command prompt of the machine, and we ran below script, but it is not updating settings. Do we have to write such scripts in other methods? Please guide.


'==========================================================================
' NAME: EPO SETTINGS.vbs

' DATE : 03/01/2010

' COMMENT: This script, does EPO SETTINGS.

'==========================================================================
On Error Resume Next

Dim OBJFSO

Dim OBJSHELL

Set OBJFSO = CreateObject("SCRIPTING.FILESYSTEMOBJECT")

Set OBJSHELL = CreateObject("WSCRIPT.SHELL")

A = OBJSHELL.CurrentDirectory

STRPROGRAMFILES = OBJSHELL.ExpandEnvironmentStrings("%PROGRAMFILES%")

STRTEMP = OBJSHELL.ExpandEnvironmentStrings("%TEMP%")

PATH1 = A & "\FRAMEPKG\FRAMEPKG.EXE"

PATH2 = STRTEMP & "\FRAMEPKG.EXE"

PATH3 = STRPROGRAMFILES & "\McAfee\Common Framework\CmdAgent.exe"

PATH4 = STRPROGRAMFILES & "\McAfee\Virus Scan Enterprise\mcupdate.exe"

COMMANDPATH2 = Chr(34) & PATH2 & Chr(34)

COMMANDPATH3 = Chr(34) & PATH3 & Chr(34) & " /P"

COMMANDPATH4 = Chr(34) & PATH4 & Chr(34)

'==========================================================================
'THIS PIECE OF CODE, COPIES FRAMEPKG.EXE TO C:\TEMP LOCATION

OBJFSO.CopyFile PATH1, PATH2

'==========================================================================
'THIS PIECE OF CODE, RUNS FRAMEPKG.EXE

OBJSHELL.RUN COMMANDPATH2,1,True

'==========================================================================
'THIS PIECE OF CODE, DELETES MCAFEE AGENT GUID

OBJSHELL.RegDelete "HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\ePolicy Orchestrator\Agent\AgentGUID"

'==========================================================================
'THIS PIECE OF CODE, RESTARTS SERVICE

OBJSHELL.Run "SC STOP McAfeeFramework"

OBJSHELL.Run "SC START McAfeeFramework"

'==========================================================================
'THIS PIECE OF CODE, WILL RUN CMDAGENT.EXE WITH PARAMETER /P

OBJSHELL.RUN COMMANDPATH3,1,True

'==========================================================================
'THIS PIECE OF CODE, WILL RUN MCUPDATE.EXE

OBJSHELL.RUN COMMANDPATH4,1,True

WScript.Quit
'==========================================================================
'END

0 Comments   [ + ] Show comments

Answers (4)

Posted by: kapil.kathuria 14 years ago
Orange Belt
0
I have never tried the way you are trying. Though i have successfully used this:
OBJSHELL.RUN psexec COMMANDPATH2,1,True

For changing registry setting of remote computer you may use WMI.
Posted by: airwolf 14 years ago
Red Belt
0
Are you passing credentials to PSExec? If so, are there any errors in the Security log on the remote machine? Does the account have proper local access to perform all modifications in the VBS?
Posted by: anonymous_9363 14 years ago
Red Belt
0
This is getting boring now...

Why bother with script when all you're doing is calling command line tools? These tools have only rudimentary error-reporting - if any - meaning that your script is seriously flawed. For example, after 'SC STOP McAfeeFramework', how do you know that the service stopped? You don't test for its stopped state, but just assume that it did. As usual, that will probably work most of the time but what about the time it doesn't? What if it's the CEO's machine which is down because your script failed? Egg on face, IT's reputation even more damaged and so on.

Either stick with DOS batch/command files or get some proper scripting skills and write proper code with error-checking.

As already stated, WMI will serve you well for all the tasks carried out by your script: service control, process execution and so on.
Posted by: Puneetha 13 years ago
Yellow Belt
0
Hi,

I am new to scripting language.

Can someone please help me to write VB script to install FramePkg.exe (McAfee Virus Enterprise). This should get installed if I run the script.

TAI.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ