So lots of my old posts were lost a while ago in the ‘GREAT TEMPLATE UPDATE OF 2015’
But I’m slowly reporting the old content.
If there is anything in particular you are after let me know and I’ll see if I can dig it up from the archives.
'CryptoPrevent, v1.1b 'Updated by Ivan Kelleher (12/06/2014) 'ReTweaked again by Me Dim strFile, objFSO, WshShell, strURL, strOutput, strParameters, AgentPath, OsType, WshExec Set objFSO = CreateObject("Scripting.FileSystemObject") Set WshShell = CreateObject("WScript.Shell") 'CryptoPrevent Location strURL = "http://www.yourdomain.com/rmm/" strVersion = "5.2.0.2" strOutput = "" strParameters = "" OsType = WshShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE") If OsType = "x86" then AgentPath = "C:\Program Files\" elseif OsType = "AMD64" then AgentPath = "C:\Program Files (x86)\" end if If objFSO.FolderExists(AgentPath & "Advanced Monitoring Agent") Then AgentPath = AgentPath & "Advanced Monitoring Agent" ElseIf objFSO.FolderExists(AgentPath & "Advanced Monitoring Agent GP") Then AgentPath = AgentPath & "Advanced Monitoring Agent GP" Else wscript.Echo "Agent Folder Not Found." End If 'Get Run Parameters Set objArgs = Wscript.Arguments For Each strArg in objArgs If (strParameters = "") Then strParameters = strArg Else If InStr(lcase(strArg), "log") = 0 Then strParameters = strParameters & " " & strArg End if End If Next DownloadCryptoPrevent Set WshExec = WshShell.Exec(AgentPath & "\CryptoPreventTestCLI.exe") If WshExec.ExitCode = 0 then wscript.Echo "Prevention Successfully Applied" Else wscript.Echo "Prevention Not Applied or Unsuccessful!" wscript.Echo "Executing CryptoPrevent.exe with parameters " & strParameters Set WshExec = WshShell.Exec(chr(34) & AgentPath & "\CryptoPrevent.exe" & chr(34) & " " & strParameters) Do While WshExec.Status <> 1 WScript.Sleep 100 Loop wscript.Echo "Execution Complete!" End If WScript.Quit(0) Sub DownloadCryptoPrevent() If not objFSO.Fileexists(AgentPath & "\CryptoPrevent.exe") Then 'Save Path strSaveTo = AgentPath & "\CryptoPrevent.exe" 'Download Program WScript.Echo "Downloading " & strURL & "CryptoPrevent.exe to " & strSaveTo HTTPDownload strURL & "CryptoPrevent.exe", strSaveTo Else If not objFSO.GetFileVersion(AgentPath & "\CryptoPrevent.exe") = strVersion Then WScript.Echo "CryptoPrevent.exe is not version " & strVersion objFSO.DeleteFile (AgentPath & "\CryptoPrevent.exe") objFSO.DeleteFile (AgentPath & "\CryptoPreventTestCLI.exe") Else WScript.Echo "CryptoPrevent.exe is version " & strVersion End If End If If not objFSO.Fileexists(AgentPath & "\CryptoPreventTestCLI.exe") Then 'Save Path strSaveTo = AgentPath & "\CryptoPreventTestCLI.exe" 'Download Program WScript.Echo "Downloading " & strURL & "CryptoPreventTestCLI.exe to " & strSaveTo HTTPDownload strURL & "CryptoPreventTestCLI.exe", strSaveTo End If End Sub Sub HTTPDownload(myURL, strFile) Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP") objXMLHTTP.open "GET", myURL, false objXMLHTTP.send() If objXMLHTTP.Status = 200 Then Set objADOStream = CreateObject("ADODB.Stream") objADOStream.Open objADOStream.Type = 1 'adTypeBinary objADOStream.Write objXMLHTTP.ResponseBody objADOStream.Position = 0 'Set the stream position to the start objADOStream.SaveToFile strFile objADOStream.Close Set objADOStream = Nothing End if Set objXMLHTTP = Nothing End Sub