ript runs manualyok automatic nok

  1.    11 Feb 2010 #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.    11 Feb 2010 #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.    11 Feb 2010 #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
How to tell if app runs in virtual PC ?
Hi, is it somehow possible an application to know whether it runs in a virtual PC or on a 'normal' physically existing PC ? What would be the...
Virtual PC
Services...Automatic Start vs Automatic--Delayed Start?
In Vista 64-bit Services does it matter if you select 'Automatic' or 'Automatic--Delayed Start'? If a Service needs to run immediately at boot one...
Vista General
VNC Runs really Vista64 box?
Hi.. I am trying tyo use realvnc free edition ot VNC into a vista64 box.. but it runns really slow... Any ideas? Running the viewer on my main...
Vista networking & sharing
computer updates runs reboots and runs again help
My windows vists is configuring updates reboots itself and reuns updates again I can't do anything with it. Help:(
Windows Updates
CHKDSK runs and runs...
I have a Dell with a 500Gb hard drive and decided to ask for a diskcheck at next boot with the repair option. It started 25 hours ago and the screen...
General Discussion
chkdsk never runs
i know that i have an error on my hard disk and that i need to run chkdsk to fix it, but when ever i try to schedule chkdsk for the next time i...
Vista General
HDD runs all the time
I did an in place upgrade on an XP MCE machine and the HDD seems to runs all the itme. It just doent stop. Other than that it seems fine but the...
Vista General

Our Sites
  • Ten Forums
  • Eight Forums
  • Seven Forums
  • Help Me Bake
  • Site Links
  • Contact Us
  • Privacy and Cookies
  • About Us
    Windows Vista Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

    Designer Media Ltd
    All times are GMT -5. The time now is 09:26.