Endpoint Protection

 View Only
Expand all | Collapse all

VBScript to stop smc.exe (and prompt for password), then start smc.exe

  • 1.  VBScript to stop smc.exe (and prompt for password), then start smc.exe

    Posted Nov 10, 2011 03:38 PM

    I'm trying to find out how to create a script such that

     

    - user is prompted for password to stop smc.exe

    [perform operation]

    - smc.exe is started

     

    I searched these threads and google, and I'm not sure how to approach this.

    Can you give a hint?



  • 2.  RE: VBScript to stop smc.exe (and prompt for password), then start smc.exe

    Posted Nov 10, 2011 04:46 PM

    You can try this

    strComputer = ""
    strMsg = "This script will restart the SMC services on the remote machine."
    strComputer = UCase(Trim(InputBox(strMsg,"Enter Target Computer Name", strComputer))) 
    If Len(strComputer) = 0 Then 
    	WScript.Echo "Machine name not specified" & vbCrlf &  "Terminating Script"
    	WScript.Quit
    End If
    
    Set objShell = CreateObject("Wscript.Shell")
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")
    intReturn = objWMIService.Create("c:\program files\symantec client security\symantec antivirus\smc.exe -stop", Null, Null, intProcessID)
    Wscript.Sleep 10000
    intReturn2 = objWMIService.Create("c:\program files\symantec client security\symantec antivirus\smc.exe -start", Null, Null, intProcessID)


  • 3.  RE: VBScript to stop smc.exe (and prompt for password), then start smc.exe

    Posted Nov 10, 2011 04:48 PM

    And i also think this might need Admin access to get executed try this on few machines first .All the best



  • 4.  RE: VBScript to stop smc.exe (and prompt for password), then start smc.exe

    Broadcom Employee
    Posted Nov 11, 2011 05:16 AM

    Hi,

    Is there any specific reason for VB script ?

    This feature is already available in SEPM.



  • 5.  RE: VBScript to stop smc.exe (and prompt for password), then start smc.exe

    Posted Nov 11, 2011 05:35 AM

    Ya ia also tried..it is working fine only..



  • 6.  RE: VBScript to stop smc.exe (and prompt for password), then start smc.exe

    Broadcom Employee
    Posted Nov 11, 2011 05:49 AM

    check out this

    @echo off
    echo.

    "%programfiles%\symantec\symantec endpoint protection\smc.exe" -stop -p *******

    echo End of script.

    https://www-secure.symantec.com/connect/forums/smc-stop-batch-file-password



  • 7.  RE: VBScript to stop smc.exe (and prompt for password), then start smc.exe

    Broadcom Employee


  • 8.  RE: VBScript to stop smc.exe (and prompt for password), then start smc.exe

    Posted Nov 14, 2011 10:17 AM

    Symantec Engineer advised the following on thousands of computers across our network:

     

    stop smc.exe (this requires a password)

    Delete luinfo.dat from <Drive>:\Program Files\Symantec\Symantec Endpoint Protection\LiveUpdate.

    start smc.exe

     

     

    Will try out these solutions, Thank you!



  • 9.  RE: VBScript to stop smc.exe (and prompt for password), then start smc.exe

    Posted Nov 14, 2011 04:25 PM

    I did some more researching, and it seems I need two files

     

    1. the batch file

    2. a vbs file to HIDE the password

     

    batch file:

     

    @echo off
    :: GetPwd.cmd - Get password with no echo.
    <nul: set /p passwd=Enter Password to stop Symantec service:
    for /f "delims=" %%i in ('cscript /nologo GetPwd.vbs') do set passwd=%%i
    echo.
    "%programfiles%\symantec\symantec endpoint protection\smc.exe" -stop passwd

    del "%programfiles%\Symantec Endpoint Protection\LiveUpdate\luinfo.dat

    "%programfiles%\symantec\symantec endpoint protection\smc.exe" -start

     

    vbs file: GetPwd.vbs

     

    ' GetPwd.vbs - Get password with no echo then echo it. '

    Option Explicit

    Dim oScriptPW, strPassword

    Set oScriptPW = CreateObject("ScriptPW.Password")
    strPassword = oScriptPW.GetPassword()
    Wscript.StdOut.WriteLine strPassword

     

     

     

    Is there a way to combine this into ONE file?



  • 10.  RE: VBScript to stop smc.exe (and prompt for password), then start smc.exe
    Best Answer

    Posted Nov 23, 2011 02:19 PM

    I figured it out. Only thing is, the code will work on Windows XP or 2000 because it uses ScriptPW (a COM object found only in these two versions of Windows)

     

     

    Option Explicit

    Dim objPassword, strPassword, objShell, objWMIService, PATH

    Set objPassword = CreateObject("ScriptPW.Password")
    WScript.StdOut.Write "Please enter your password:"

    strPassword = objPassword.GetPassword()

    Set objShell = WScript.CreateObject("WScript.Shell")
    Set objWMIService = GetObject("winmgmts:\\" & "." & "\root\cimv2:Win32_Process")

    PATH = objShell.ExpandEnvironmentStrings( "%programfiles%" )

    objWMIService.Create(PATH & "\Symantec Endpoint Protection\smc.exe -stop " & strPassword)

    'objWMIService.Create("d:\program files\Symantec Endpoint Protection\smc.exe -stop " & strPassword)



  • 11.  RE: VBScript to stop smc.exe (and prompt for password), then start smc.exe

    Posted Nov 23, 2011 02:21 PM

    Amazing nice to hear and good to keep for records