Windows Vista Forums

ript runs manualyok automatic nok

  1. #1

    Admin.ADPO Guest

    ript runs manualyok automatic nok


    I have a script wich should update the group policys over vpn, depending if
    it sees the domain controler

    when i manualy start the script it starts and acts as it should be
    but when i start the script from either run parameter in register, or
    startup folder or via a schedulled task it not acting as it should be

    the script runs a cmd that updates the policy's with the command "gpupdate
    when it is started manual i get a dos prompt and the command is executed
    when the script is started automaticaly i see for a slit second the dos
    prompt and then it dissapeares , the command is not executed !

    anyone any idea what can cause these behavior?

    here is the script

    strHost = ""
    trigger = 0
    Do While i = 0 'endless loop
    If Ping(strHost) = True Then
    If trigger = 0 Then
    'WScript.Echo "Host " & strHost & " contacted"
    set objShell = wscript.createObject("")
    objshell.Run "taskkill /im iexplore.exe",1, TRUE
    objshell.Run "C:\windows\update.cmd"
    Set objShell = Nothing
    trigger = 1
    End If
    'Wscript.Echo "Host " & strHost & " could not be contacted"
    trigger = 0
    End If
    Function Ping(strHost)
    dim objPing, objRetStatus
    set objPing =
    GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery _
    ("select * from Win32_PingStatus where address = '" & strHost & "'")
    for each objRetStatus in objPing
    if IsNull(objRetStatus.StatusCode) or objRetStatus.StatusCode<>0
    Ping = False
    'WScript.Echo "Status code is " & objRetStatus.StatusCode
    Ping = True
    'Wscript.Echo "Bytes = " & vbTab & objRetStatus.BufferSize
    'Wscript.Echo "Time (ms) = " & vbTab & objRetStatus.ResponseTime
    'Wscript.Echo "TTL (s) = " & vbTab &
    end if
    End Function

      My System SpecsSystem Spec

  2. #2

    LikeToCode Guest

    RE: ript runs manualyok automatic nok

    You can use the cmd.exe /c or cmd.exe /k to activate the command window. Are
    your piping in the "ECHO Y" to confirm the reboot that may be required with
    the gpupdate /force?
    Try this

    objshell.Run "%comspec% /k C:\windows\update.cmd",1,True

      My System SpecsSystem Spec

  3. #3

    Bruno Guest

    Re: ript runs manualyok automatic nok


    Did you check witch user launch the script when it runs with scheduler
    or run parameter ?
    May be you could use runas command ?


      My System SpecsSystem Spec

ript runs manualyok automatic nok
Similar Threads
Thread Forum
RE: Backup runs once SBS Server
Services...Automatic Start vs Automatic--Delayed Start? Vista General
computer updates runs reboots and runs again help Windows Updates
CHKDSK runs and runs... General Discussion