Avatar billede mullermanden Nybegynder
08. maj 2001 - 22:50 Der er 3 kommentarer og
1 løsning

Lidt hjælp til dette script

Hejsa...jeg mener dette er noget Basic script.

Scriptet undersøger om man mangler nogle opdateringer til Ms IIS 5.0

// NOTIFY.JS
// Description:
// Notify.js can be customized by the user
// Right now it reports a missing hotfix on commandline and writes an event to the eventlog
// But it is also possible to generate a mail, halt IIS or generate other events that are
// relevant to administrators.


function Notify(type,sBulletin, sTitle, sLink, sMachine)

{
    var oShell = new ActiveXObject(\"WScript.Shell\");
    switch(type)
    {
        // consts (for instance HOTFIX) are declared in HFCHECK.WSF
        case HOTFIX:
            WScript.Echo(\"\\nMissing Hotfix on Machine \" + sMachine + \" Detected:\\nMicrosoft Security Bulletin (\" + sBulletin + \")\\n\" + sTitle + \"\\nLink: http://www.microsoft.com\" + sLink);               
            oShell.LogEvent(2,\"Missing Hotfix on Machine \" + sMachine + \" Detected:\\nMicrosoft Security Bulletin (\" + sBulletin + \")\\n\" + sTitle + \"\\nLink: http://www.microsoft.com\" + sLink);
            break;
        case WORKAROUND:
            WScript.Echo(\"\\nWorkaround Notification for Machine \" + sMachine + \":\\nMicrosoft Security Bulletin (\" + sBulletin + \" )\\n\" + sTitle + \"\\nLink: http://www.microsoft.com\" + sLink);
            oShell.LogEvent(2,\"Workaround Notification for Machine \" + sMachine + \":\\nMicrosoft Security Bulletin (\" + sBulletin + \" )\\n\" + sTitle + \"\\nLink: http://www.microsoft.com\" + sLink);
            break;
        case MISSINGINFO:
            WScript.Echo(\"\\nHotfix Warning for Machine \" + sMachine + \":\\nUnable to verify hotfix install \\nMicrosoft Security Bulletin (\" + sBulletin + \")\\nLink: http://www.microsoft.com\" + sLink);
            oShell.LogEvent(2,\"Hotfix Warning for Machine \" + sMachine + \":\\nUnable to verify hotfix install \\nMicrosoft Security Bulletin (\" + sBulletin + \")\\nLink: http://www.microsoft.com\" + sLink);
            break;

    }

}

MS skriver så at man kan adde følge til scriptet for at få det til at sende en mail til en, når der mangler en hotfix...

Set objMsg = CreateObject(\"CDONTS.NewMail\")
    \'Set the properties of the Message
    objMsg.From = \"HotfixNotification@YourCompany.com\"
    objMsg.To = \"Administrators@YourCompany.com\"
    objMsg.Subject = \"Missing Hotfix Detected!\"
    objMsg.Body = \"Microsoft Security Bulletin _
(\" + sBulletin + \") \" + sTitle + \" Link:
_http://www.microsoft.com\" + sLink
    objMsg.Send


Men hvor skal dette indsættes for at virke ?

Martin
Avatar billede xion Nybegynder
24. maj 2001 - 01:43 #1
vil også meget gerne vide dette.
Avatar billede richardr Nybegynder
08. juni 2001 - 02:17 #2
Er det mig eller ligner koden der Java??
Avatar billede run Nybegynder
23. juni 2001 - 06:09 #3

// NOTIFY.JS
// Description:
// Notify.js can be customized by the user
// Right now it reports a missing hotfix on commandline and writes an event to the eventlog
// But it is also possible to generate a mail, halt IIS or generate other events that are
// relevant to administrators.


function Notify(type,sBulletin, sTitle, sLink, sMachine)
{
    var oShell = new ActiveXObject(\"WScript.Shell\");
    switch(type)
    {
        // consts (for instance HOTFIX) are declared in HFCHECK.WSF
        case HOTFIX:
            WScript.Echo(\"\\nMissing Hotfix on Machine \" + sMachine + \" Detected:\\nMicrosoft Security Bulletin (\" + sBulletin + \")\\n\" + sTitle + \"\\nLink: http://www.microsoft.com\" + sLink);               
            oShell.LogEvent(2,\"Missing Hotfix on Machine \" + sMachine + \" Detected:\\nMicrosoft Security Bulletin (\" + sBulletin + \")\\n\" + sTitle + \"\\nLink: http://www.microsoft.com\" + sLink);
            break;
        case WORKAROUND:
            WScript.Echo(\"\\nWorkaround Notification for Machine \" + sMachine + \":\\nMicrosoft Security Bulletin (\" + sBulletin + \" )\\n\" + sTitle + \"\\nLink: http://www.microsoft.com\" + sLink);
            oShell.LogEvent(2,\"Workaround Notification for Machine \" + sMachine + \":\\nMicrosoft Security Bulletin (\" + sBulletin + \" )\\n\" + sTitle + \"\\nLink: http://www.microsoft.com\" + sLink);
            break;
        case MISSINGINFO:
            WScript.Echo(\"\\nHotfix Warning for Machine \" + sMachine + \":\\nUnable to verify hotfix install \\nMicrosoft Security Bulletin (\" + sBulletin + \")\\nLink: http://www.microsoft.com\" + sLink);
            oShell.LogEvent(2,\"Hotfix Warning for Machine \" + sMachine + \":\\nUnable to verify hotfix install \\nMicrosoft Security Bulletin (\" + sBulletin + \")\\nLink: http://www.microsoft.com\" + sLink);
            break;
    }
    Set objMsg = CreateObject(\"CDONTS.NewMail\")
    \'Set the properties of the Message
    objMsg.From = \"HotfixNotification@YourCompany.com\"
    objMsg.To = \"Administrators@YourCompany.com\"
    objMsg.Subject = \"Missing Hotfix Detected!\"
    objMsg.Body = \"Microsoft Security Bulletin _
(\" + sBulletin + \") \" + sTitle + \" Link:
_http://www.microsoft.com\" + sLink
    objMsg.Send

}
Avatar billede run Nybegynder
23. juni 2001 - 18:55 #4
Det virkede ikke, men følgende virker:


// NOTIFY.JS
// Description:
// Right now it reports a missing hotfix on commandline and writes an event to the eventlog
// But it is also possible to generate a mail, halt IIS or generate other events that are
// relevant to administrators.


function Notify(type,sBulletin, sTitle, sLink, sMachine)
{

    var oShell = new ActiveXObject(\"WScript.Shell\");
    switch(type)
    {
        // consts (for instance HOTFIX) are declared in HFCHECK.WSF
        case HOTFIX:
            WScript.Echo(\"\\nMissing Hotfix on Machine \" + sMachine + \" Detected:\\nMicrosoft Security Bulletin (\" + sBulletin + \")\\n\" + sTitle + \"\\nLink: http://www.microsoft.com\" + sLink);               
            oShell.LogEvent(2,\"Missing Hotfix on Machine \" + sMachine + \" Detected:\\nMicrosoft Security Bulletin (\" + sBulletin + \")\\n\" + sTitle + \"\\nLink: http://www.microsoft.com\" + sLink);
            break;
        case WORKAROUND:
            WScript.Echo(\"\\nWorkaround Notification for Machine \" + sMachine + \":\\nMicrosoft Security Bulletin (\" + sBulletin + \" )\\n\" + sTitle + \"\\nLink: http://www.microsoft.com\" + sLink);
            oShell.LogEvent(2,\"Workaround Notification for Machine \" + sMachine + \":\\nMicrosoft Security Bulletin (\" + sBulletin + \" )\\n\" + sTitle + \"\\nLink: http://www.microsoft.com\" + sLink);
            break;
        case MISSINGINFO:
            WScript.Echo(\"\\nHotfix Warning for Machine \" + sMachine + \":\\nUnable to verify hotfix install \\nMicrosoft Security Bulletin (\" + sBulletin + \")\\nLink: http://www.microsoft.com\" + sLink);
            oShell.LogEvent(2,\"Hotfix Warning for Machine \" + sMachine + \":\\nUnable to verify hotfix install \\nMicrosoft Security Bulletin (\" + sBulletin + \")\\nLink: http://www.microsoft.com\" + sLink);
            break;
   
};
vsFrom = \"HotfixNotification@YourCompany.com\"
vsToEmail = \"Administrators@YourCompany.com\"
vsSubject = \"Missing Hotfix Detected!\"
vsText = \"Microsoft Security Bulletin (\" + sBulletin + \") \" + sTitle + \" Link: http://www.microsoft.com\" + sLink
var objNewMail = new ActiveXObject(\"CDONTS.NewMail\")
objNewMail.Send(vsFrom, vsToEmail, vsSubject, vsText, 1)
objNewMail = null
}
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester