Video Screencast Help

Remotely Run Symantec Antivirus Related Batch file

Created: 22 Mar 2012 • Updated: 27 Mar 2012 | 13 comments
Ashish-Sharma's picture
+31 31 Votes
Login to vote

Hi,

This vbscript will be helpful for run remotely any batch file.

You can be enter system host name in computer.txt and run vbs file. 

I have tested my organization and successfully remove the Symantec antivirus hardware id and replace the syslink file.

 Note: kindly copy PsExec.exe freeware tool download for http://technet.microsoft.com/en-us/sysinternals/bb897553 and for copy c:\windows\system32\ after run the vbscript.

**************************************************Script *****************************************************************

Option Explicit

Const ForReading = 1
Const ForWriting = 2
Const OverwriteExisting = TRUE

Dim objFSO, strComputer, objFile, filesys, testfile, strPSExec, strCmd, objShell, strUser, strPass

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\Scripts\Computer.txt") 'Change the name and location of the output file as needed
Set filesys = CreateObject("Scripting.FileSystemObject")
Set testfile = filesys.CreateTextFile("c:\scripts\ScriptFeedback.txt", True) 'Change the name and location of the output file as needed

strUser = InputBox("Please Enter Your Username: " & (Chr(13) & Chr(10)) & "(Format:domain\username) ")
strPass = InputBox("Please Enter Your password: ")

Do Until objFile.AtEndOfStream
 On Error Resume Next
    strComputer = objFile.ReadLine
 Set objShell = CreateObject("Wscript.Shell")
      
  strPSExec = "c:\windows\system32\psexec.exe"

  strCmd = strPSExec & " -d " & " -u " & strUser & " -p " & strPass & " \\" & strComputer & " cmd /c " & "\\systemname\c$\Scripts\Delete.bat" 'Change to reflect location of batch file in network
  objShell.Run strCmd, 0, False

  If Err.Number <> 0 Then
       testfile.WriteLine strComputer
       Err.Clear
   End If
  Set objFSO = Nothing
Loop
testfile.Close

Comments 13 CommentsJump to latest comment

Shiv003's picture

Hi Ashish,

Thanks for providing script.

can you tell me which type we have using this script.

 

Thanks....

0
Login to vote
Ashish-Sharma's picture

You can be run this script on your system and you will be Remotely Run any batch file and complete large amount you work.

Prerequisite run this script.

1) Copy c:\windows\system32\ PsExec.exe freeware tool (Available http://technet.microsoft.com/en-us/sysinternals/bb897553).

2) Give the host name in Computer.txt.

3) Give the batch file path here:- ("\\systemname\c$\Scripts\Delete.bat" )

4) Run the batch file.

5) Give the domain username and password.

after you have check your script are successfully run .

 

Thanks in advance.

Ashish Sharma

 

Thanks In Advance

Ashish Sharma

 

 

+3
Login to vote
Shiv003's picture

Thanks ashish for you reply

I will Check and if found any problem found get back you.

 

yes

0
Login to vote
Jackie007's picture

yes good for see remotaly run batch file.

 

I will be bookmark this script and using in my Organization.

Thanks....

Don't forget to mark your thread as 'SOLVED' with the answer that best helped you

0
Login to vote
G4u's picture

good helpfull for running script.

0
Login to vote
Marksh's picture

hi,

thanks for sharing

0
Login to vote
hemantsingh681's picture

hi,

Can we using this script run any batch file.

0
Login to vote
AshMelwani's picture

Very nice script Ashish I have attached a bat file that I use to execute if possible could you please change the above script to do the commands in the bat script

AttachmentSize
Profile.txt 833 bytes
0
Login to vote
avi.gawari's picture

hey thanks for your useful information

0
Login to vote
Parks1's picture

Nice script for remotely access.

0
Login to vote