> On May 15, 11:09 am, Kai Lippok <REMOVEME_pub...[ at ]kl-mail.de> wrote:
>> Hi,
>>
>> I am trying to use the following script as a per computer logon script:
>>
>> ---
>> set wshShell = CreateObject("Wscript.shell")
>>
>> On Error resume next
>>
>> key = "HKLM\SOFTWARE\UPDATE\INSTALLED"
>> test = wshshell.regread(key)
>>
>> If err <> 0 Then
>>
>> wshShell.run WindowsUpdateAgent30-x86.exe /wuforce /quiet
>> wshShell.run WindowsXP-KB927891-v3-x86-DEU.exe /quiet /norestart",0,TRUE)
>>
>> WshShell.RegWrite "HKLM\SOFTWARE\UPDATE\INSTALLED", "1", "REG_SZ"
>>
>> ELSE
>>
>> WScript.Quit()
>>
>> END IF
>>
>> WScript.Quit()
>>
>> ---
>>
>> My problem is that the reg key is written but the two commands are not
>> excuted. I've tried to use a complete path to these files as well but it
>> doesn't work. Any idea?
>>
>> BTW: This script works well when executed from explorer...
>
> You almost certainly need the full pathspecs for the two executables,
> but the real problem is that there are syntax errors in both run
> lines. In addition, the On Error statement is not helping you
> troubleshoot the problems the way it is instituted.
>
> To be syntactically correct the two run lines should be changed to
> be ...
>
> wshShell.run "WindowsUpdateAgent30-x86.exe /wuforce /quiet", 0,
> true
> wshShell.run "WindowsXP-KB927891-v3-x86-DEU.exe /quiet /norestart",
> 0, TRUE
>
> To test for success in running the programs, you should build them
> something like this ...
>
> sCmd = "WindowsUpdateAgent30-x86.exe /wuforce /quiet"
> nRes = wshShell.run(sCmd, 0, true)
> if nRes = 0 then
> sCmd = "WindowsXP-KB927891-v3-x86-DEU.exe /quiet /norestart"
> nRes = wshShell.run(sCmd, 0, true)
> end if
>
> Tom Lavedas
> ===========
>
http://members.cox.net/tglbatch/wsh/>