截屏视频帮助

Remotely Run Symantec Antivirus Related Batch file

创建时间: 22 3 月 2012 • Updated: 27 3 月 2012 | 13 条评论
Ashish-Sharma 的图片
+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

下载 归类至以下社区:

评论 条评论跳转至最新评论

Shiv003 的图片

Hi Ashish,

Thanks for providing script.

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

Thanks....

0
Login to vote
Ashish-Sharma 的图片

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 的图片

Thanks ashish for you reply

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

yes

0
Login to vote
Jackie007 的图片

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 的图片

good helpfull for running script.

0
Login to vote
Marksh 的图片

hi,

thanks for sharing

0
Login to vote
hemantsingh681 的图片

hi,

Can we using this script run any batch file.

0
Login to vote
AshMelwani 的图片

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

附件大小
Profile.txt 833 字节
0
Login to vote
avi.gawari 的图片

hey thanks for your useful information

0
Login to vote
Parks1 的图片

Nice script for remotely access.

0
Login to vote