|
Newbie |
|
Joined: Mon Jun 21, 2010 11:39 pm Posts: 13 Location: Iowa, USA
|
[quote="Mark"]If you copy the new script around and install the new version - yes, the URL (for submitting audit results) is the same.
I have it setup with a script that downloads the most recent audit script, then runs it, then cleans itself up. I got the download script from this post: viewtopic.php?f=9&t=3683
[code]'Declare variables Dim oXMLHTTP Dim oStream Dim WSHShell Dim AuditFiles(1) Dim objFile Dim objRandom Dim CleanupFiles(2)
'Input variables OAURL = "https://audit.webserver.com"
AuditFiles(0)="audit.vbs" AuditFiles(1)="list_export_config.php"
'Create Objects Set WSHShell = WScript.CreateObject("WScript.Shell") Set fso = CreateObject("Scripting.FileSystemObject") Set objRandom = CreateObject( "System.Random" )
'Get Script folder scriptFullName = WScript.ScriptFullName TargetDir = Left ( scriptFullName, _ InStrRev ( scriptFullName, WScript.ScriptName) - 1 ) 'Retrieve Audit Files For Each objFile in AuditFiles 'Check if file exists and delete if possible If (fso.FileExists(TargetDir & objFile)) Then Set aFile = fso.GetFile(TargetDir & objFile) aFile.Delete End If Set oXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP") oXMLHTTP.Open "GET", OAURL & "/" & objFile, False oXMLHTTP.setOption 2, 13056 oXMLHTTP.Send If oXMLHTTP.Status = 200 Then 'Try to download from root Set oStream = CreateObject("ADODB.Stream") oStream.Open oStream.Type = 1 oStream.Write oXMLHTTP.responseBody oStream.SaveToFile TargetDir & objFile oStream.Close Else oXMLHTTP.Open "GET", OAURL & "/scripts/" & objFile, False oXMLHTTP.Send If oXMLHTTP.Status = 200 Then 'Try to download from scripts folder Set oStream = CreateObject("ADODB.Stream") oStream.Open oStream.Type = 1 oStream.Write oXMLHTTP.responseBody oStream.SaveToFile TargetDir & objFile oStream.Close Else 'Error downloading, exiting script WScript.Quit(2) End If End If Next
'Check if file exists and delete if possible If (fso.FileExists(TargetDir & "audit.config")) Then Set aFile = fso.GetFile(TargetDir & "audit.config") aFile.Delete End If
'Rename php file to config fso.MoveFile TargetDir & AuditFiles(1), TargetDir & "audit.config"
'Execute audit WSHShell.Run "cscript """ & TargetDir & AuditFiles(0) & """", 2, true
'Cleanup CleanupFiles(0)=TargetDir & "audit.config" CleanupFiles(1)=TargetDir & AuditFiles(0) CleanupFiles(2)=TargetDir & AuditFiles(1) For Each objFile in CleanupFiles If (fso.FileExists(objFile)) Then Set aFile = fso.GetFile(objFile) aFile.Delete End If Next[/code]
I set it up so that even if I upgrade to a newer version of OAv2, then it will still be downloading and running the most recent audit script (because manually updating the script on each of my 100+ computers would really suck). This is more of an FYI than a question. Would you consider including this script in with the others in the "scripts" folder? It would also be great to have a text doc in there that describes what each script in the scripts folder does, and when it makes the most sense to use them.
Thanks again for your work. I'm planning to upgrade to OAv2 Alpha 4 on Thursday. Will post results.
|
|