Вы находитесь на странице: 1из 5

Dim wshShell,saveFile,ObjFSO,objLog,windowsdir

ScriptPath = Left(WScript.ScriptFullName, InStrRev(WScript.ScriptFullNam


e, "\")-1)
Set wshShell = CreateObject( "WScript.Shell" )
Set ObjFSO = CreateObject("Scripting.FileSystemObject")
windowsdir = wshShell.ExpandEnvironmentStrings("%SYSTEMDRIVE%")+"\Maestr
oCAMScriptLog\"
Function checkLAN()
'Option Explicit
'start WMI get Adapter Objects...
Dim ObjWMI: Set ObjWMI = GetObject("winmgmts:{impersonationLevel
=impersonate}!\\.\root\cimv2")
Dim colItems : Set colItems = ObjWMI.ExecQuery("Select * From Wi
n32_NetworkAdapterConfiguration Where IPEnabled = True")
If colItems.Count = 0 Then
msgbox("Please check LAN/internet connection!")
objLog.WriteLine Now & " - Error : " & Err.Number & ": "
& Err.Description & " Please check internet connection!"
End if
End function
Function createLogFile()
On Error Resume Next
exists = ObjFSO.FolderExists(windowsdir)
if (exists) then
Set objLog = objFSO.CreateTextFile(windowsdir + "\antiviruslog.t
xt")
else
Set objFolder = objFso.CreateFolder (wshShell.ExpandEnvironmentS
trings("%SYSTEMDRIVE%")+ "\MaestroCAMScriptLog")
Set objLog = objFSO.CreateTextFile(objFolder + "\antiviruslog.tx
t")
end If
If Err.Number <> 0 Then
objLog.WriteLine Now & " - Error : " & Err.Numb
er & ": " & Err.Description
End if
End function
Function Is32BitOS() : Is32BitOS = (GetObject("winmgmts:root\cimv2:Win32
_Processor='cpu0'").AddressWidth = 32) : End Function
Function Is64BitOS() : Is64BitOS = (GetObject("winmgmts:root\cimv2:Win32
_Processor='cpu0'").AddressWidth = 64) : End Function
Function downloadfromHTTP(link,sFile)
On Error Resume Next
If Err.Number <> 0 Then
objLog.WriteLine Now & " - Error : " & Err.Numb
er & ": " & Err.Description
Err.Clear
end If
msgbox("File download in progress...")
dim xHttp: Set xHttp = createobject("Microsoft.X
MLHTTP")
dim bStrm: Set bStrm = createobject("Adodb.Strea
m")
'link=InputBox("Enter URL","Enter the link to do
wnload","http://10.154.0.232:8585/Content/docs/software/npp.6.2.1.Installer.exe"
)
'saveFile=InputBox("Enter the saveTO file Name w
ith .exe or .zip","Enter name to save file","McafeeAgent.exe")
saveFile=sFile
checkFileExistorNot(saveFile)
xHttp.Open "GET", link, False
xHttp.Send
If Err.Number <> 0 Then
objLog.WriteLine Now & " - Error : " & Err.Numb
er & ": " & Err.Description
downloadfromHTTP = false
Exit Function
End if
If xmlhttp.Status = 200 Then
with bStrm
.type = 1
.open
.write xHttp.responseBody
.savetofile (wshShell.ExpandEnvironmentStrings(
saveFile)) , 2
objLog.WriteLine Now & " - Antivirus file downlo
aded successfully successfully!-->> " &ScriptPath&"\" &saveFile
end with
downloadfromHTTP = true
Exit Function
Else
downloadfromHTTP = false
End If
If Err.Number <> 0 Then
objLog.WriteLine Now & " - Error : " & Err.Numb
er & ": " & Err.Description
Err.Clear
end If
End Function
Function checkFileExistorNot(file_Path)
On Error Resume Next
If Err.Number <> 0 Then
objLog.WriteLine Now & " - Error : " & Err.Numb
er & ": " & Err.Description
Err.Clear
end if
Set objFSO = CreateObject("Scripting.FileSystemO
bject")
If objFSO.FileExists(file_Path) Then
objFSO.DeleteFile file_Path
End If
Set objFSO = Nothing
End Function
Function WindowsUnZip(sUnzipFileName, sUnzipDestination)
Set oUnzipFSO = CreateObject("Scripting.FileSystemObje
ct")
If Not oUnzipFSO.FolderExists(sUnzipDestination) Then
oUnzipFSO.CreateFolder(sUnzipDestination)
End If
With CreateObject("Shell.Application")
.NameSpace(sUnzipDestination).Copyhere .NameS
pace(sUnzipFileName).Items
End With
If Err.Number <> 0 Then
objLog.WriteLine Now & " - Error : " & Err.Numbe
r & " " & "--" & Err.Description
End If
Set oUnzipFSO = Nothing
End Function
If Is32BitOS then
createLogFile
checkLAN
'link="http://10.24.126.25/Documents/ftp/miscellaneous/Antivirus
/antivirus-software/Mcafee%20Agent/FramePkg%205.0.3.exe"
link="http://10.154.0.232:8585/Content/docs/software/npp.6.2.1.I
nstaller.exe"
sFile="FramPkg-205.0.3.exe"
downloadfromHTTP link,sFile
WScript.Echo "File downloaded sucessfully to:" & ScriptPath+"\"
objLog.WriteLine Now & " File downloade successfully! to: " & Sc
riptPath+"\"
runFile = chr(34) & sFile & chr(34)
'msgbox(runFile)
wshShell.Run runFile,0,True

'link="http://10.24.126.25/Documents/ftp/miscellaneous/Antiviru
s/antivirus-software/DLP/DLPAgentInstaller.x86.zip"
link="http://10.154.0.232:8585/Content/docs/software/Firefox%20
Setup%2019.0.2.zip"
sFile="DLPAgentInstaller.zip"
downloadfromHTTP link,sFile
WScript.Echo"File downloaded sucessfully to:" & ScriptPath+"\"
objLog.WriteLine Now & " File downloaded successfully! to: " & S
criptPath+"\"
zipSource=ScriptPath+"\"+sFile
zipDest=ScriptPath+"\"
WindowsUnZip zipSource,zipDest
objLog.WriteLine Now & " - Unzipped sucessfully to:" & zipDest
Set oExec=wshShell.Exec("mshta.exe ""about:<input type=file id=F
ILE><script>FILE.click();new ActiveXObject('Scripting.FileSystemObject').GetStan
dardStream(1).WriteLine(FILE.value);close();resizeTo(0,0);</script>""")
runFile = oExec.StdOut.ReadLine
runFile = chr(34) & runFile & chr(34)
wshShell.Run runFile,0,True
'link="http://10.24.126.25/Documents/ftp/miscellaneous/Antiviru
s/antivirus-software/VSE/VSE880LMLRP6.Zip"
link="http://10.154.0.232:8585/Content/docs/software/Firefox%20
Setup%2019.0.2.zip"
sFile="VSE880LMLRP6.zip"
downloadfromHTTP link,sFile
WScript.Echo"File downloaded sucessfully to:" & ScriptPath+"\"
objLog.WriteLine Now & " File downloaded successfully! to: " & S
criptPath+"\"
zipSource=ScriptPath+"\"+sFile
zipDest=ScriptPath+"\"
WindowsUnZip zipSource,zipDest
objLog.WriteLine Now & " - Unzipped sucessfully to:" & zipDest
Set oExec=wshShell.Exec("mshta.exe ""about:<input type=file id=F
ILE><script>FILE.click();new ActiveXObject('Scripting.FileSystemObject').GetStan
dardStream(1).WriteLine(FILE.value);close();resizeTo(0,0);</script>""")
runFile = oExec.StdOut.ReadLine
runFile = chr(34) & runFile & chr(34)
wshShell.Run runFile,0,True
objLog.WriteLine Now & " - Application installed successfully"
If Err.Number <> 0 Then
objLog.WriteLine Now & " - Error : " & Err.Numbe
r & ": " & Err.Description
End If
ElseIf Is64BitOS Then
createLogFile
checkLAN
'link="http://10.24.126.25/Documents/ftp/miscellaneous/Antivirus
/antivirus-software/Mcafee%20Agent/FramePkg%205.0.3.exe"
link="http://10.154.0.232:8585/Content/docs/software/npp.6.2.1.I
nstaller.exe"
sFile="FramPkg-205.0.3.exe"
downloadfromHTTP link,sFile
WScript.Echo "File downloaded sucessfully to:" & ScriptPath+"\"
objLog.WriteLine Now & " File downloaded successfully! to: " & S
criptPath+"\"
runFile = chr(34) & sFile & chr(34)
'msgbox(runFile)
wshShell.Run runFile,0,True

'link="http://10.24.126.25/Documents/ftp/miscellaneous/Antiviru
s/antivirus-software/DLP/DLPAgentInstaller.x86.zip"
link="http://10.154.0.232:8585/Content/docs/software/Firefox%20
Setup%2019.0.2.zip"
sFile="DLPAgentInstaller.zip"
downloadfromHTTP link,sFile
WScript.Echo "File downloaded sucessfully to:" & ScriptPath+"\"
objLog.WriteLine Now & " File downloaded successfully! to: " & S
criptPath+"\"
zipSource=ScriptPath+"\"+sFile
zipDest=ScriptPath+"\"
WindowsUnZip zipSource,zipDest
objLog.WriteLine Now & " - Unzipped sucessfully to:" & zipDest
Set oExec=wshShell.Exec("mshta.exe ""about:<input type=file id=F
ILE><script>FILE.click();new ActiveXObject('Scripting.FileSystemObject').GetStan
dardStream(1).WriteLine(FILE.value);close();resizeTo(0,0);</script>""")
runFile = oExec.StdOut.ReadLine
runFile = chr(34) & runFile & chr(34)
'msgbox(runFile)
wshShell.Run runFile,0,True
'link="http://10.24.126.25/Documents/ftp/miscellaneous/Antiviru
s/antivirus-software/VSE/VSE880LMLRP6.Zip"
link="http://10.154.0.232:8585/Content/docs/software/Firefox%20
Setup%2019.0.2.zip"
sFile="VSE880LMLRP6.zip"
downloadfromHTTP link,sFile
WScript.Echo "File downloaded sucessfully to:" & ScriptPath+"\"
objLog.WriteLine Now & " File downloade successfully! to: " & Sc
riptPath+"\"
zipSource=ScriptPath+"\"+sFile
zipDest=ScriptPath+"\"
WindowsUnZip zipSource,zipDest
objLog.WriteLine Now & " - Unzipped sucessfully to:" & zipDest
Set oExec=wshShell.Exec("mshta.exe ""about:<input type=file id=F
ILE><script>FILE.click();new ActiveXObject('Scripting.FileSystemObject').GetStan
dardStream(1).WriteLine(FILE.value);close();resizeTo(0,0);</script>""")
runFile = oExec.StdOut.ReadLine
runFile = chr(34) & runFile & chr(34)
'msgbox(runFile)
wshShell.Run runFile,0,True
objLog.WriteLine Now & " - Application installed successfully"
If Err.Number <> 0 Then
objLog.WriteLine Now & " - Error : " & Err.Number & " "
& "--" & Err.Description
End If
Else
WScript.Echo"Unable to detect the system configuraton"
If Err.Number <> 0 Then
objLog.WriteLine Now & " - Error : " & Err.Numbe
r & " " & "--" & Err.Description & " --->Unable to detect the system configura
ton 32/64 bit"
End if
End If

Вам также может понравиться