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

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

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.
Answered 01/03/2010 by: kapil.kathuria
Orange Belt

Please log in to comment
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?
Answered 01/04/2010 by: airwolf
Tenth Degree Black Belt

Please log in to comment
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.
Answered 01/04/2010 by: VBScab
Red Belt

Please log in to comment
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.
Answered 01/17/2011 by: Puneetha
Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity