VBS — Installing ePOagent with checks

Home Forums Scripting Windows Script Host VBS — Installing ePOagent with checks

This topic contains 0 replies, has 1 voice, and was last updated by Avatar Dumber 15 years, 7 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    Dumber
    Participant
    #98273

    Any suggestions??

    got already this:

    Code:
    Dim oShell
    Set oShell = CreateObject (“wscript.shell”)

    If Checkstate = “” Then ‘check of ePOagent is installed….
    WScript.Echo “Not installed!!!!”
    WScript.Echo “installing ePOagent….”
    oShell.Exec (“\Server01epoAgentFramePkg.exe /forceinstall /Silent /install=agent”)
    end if

    If Checkstate = “true” Then ‘check of the state is running….
    WScript.Quit (0)
    End if

    If Checkstate = “false” Then ‘check if the service could be started…
    StartService
    End if

    If Checkstate = “false” Then ‘if that doesn’t work then reinstall agent..
    WScript.Echo “Reinstalling ePoagent….”
    oShell.Exec (“\Server01epoAgentFramePkg.exe /forceinstall /Silent /install=agent”)
    End If

    ‘***********************************************************************************************
    ‘***********************************************************************************************

    Function Checkstate ‘function to check if Epo agent is installed and running.

    On Error Resume Next
    strComputer = “.”
    Set objWMIService = GetObject(“winmgmts:\” & strComputer & “rootcimv2”)
    Set colItems = objWMIService.ExecQuery(“Select * from Win32_Service”,,48)
    For Each objItem in colItems
    If objitem.displayname = “McAfee Framework Service” then
    Wscript.Echo “Started: ” & objItem.Started
    If objitem.started = “False” Then
    CheckState = “false”
    Else
    Checkstate = “true”
    end if
    Exit For
    End If
    Next
    End Function

    Function StartService ‘fuction to start the service…

    On Error Resume next

    StrComputer = “.”
    Set objWMIservice = GetObject (“winmgmts:\” & strComputer & “rootcimv2”)
    Set Colitems = ObjWMIservice.execquery (“Select * from win32_service”,,48)
    For Each objitem In colItems
    If objitem.displayname = “McAfee Framework Service” then
    Wscript.Echo “Started: ” & objItem.Started
    If objitem.started = “False” Then
    objitem.StartService (“Mcafee Framework Service”)
    End If
    Exit for
    End If
    Next
    End Function

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.