#149411 - 2005-10-06 04:33 PM
If folder exists
|
Savvy95
Fresh Scripter
Registered: 2005-05-09
Posts: 11
|
My goal is to update files in the %windir%\system32 folder on client machines if the fileversion is lower than what's listed below
this is what I have....Will it work (effeciently?)
$wuclientver =GetFileVersion("%windir%\system32\wuaueng.dll") If $wuclientver < "5.8.0.2469" Shell "net stop wuauserv" Copy "\\troy\c$\%sindir%\system32\wu*.*" "c:\winnt\system32" Shell "net start wuauserv" EndIf
Thanks for your help
|
Top
|
|
|
|
#149413 - 2005-10-06 04:58 PM
Re: If folder exists
|
Co
MM club member
 
Registered: 2000-11-20
Posts: 1342
Loc: NL
|
|
Top
|
|
|
|
#149414 - 2005-10-06 05:17 PM
Re: If folder exists
|
Savvy95
Fresh Scripter
Registered: 2005-05-09
Posts: 11
|
It works, I guess my question is: is this the most efficient way. but maybe efficiency doesn't matter.
PS. I saw I fat-fingered the directory. It should read Copy "\\troy\c$\%Windir%\system32\wu*.*" "c:\winnt\system32"
|
Top
|
|
|
|
#149415 - 2005-10-06 05:18 PM
Re: If folder exists
|
Savvy95
Fresh Scripter
Registered: 2005-05-09
Posts: 11
|
This is were it should go....
It works, I guess my question is: is this the most efficient way. but maybe efficiency doesn't matter.
PS. I saw I fat-fingered the directory. It should read Copy "\\troy\c$\%Windir%\system32\wu*.*" "c:\winnt\system32"
|
Top
|
|
|
|
#149417 - 2005-10-06 10:08 PM
Re: If folder exists
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
If it works, it works. This would be slightly more efficient, code-wise...
Code:
If GetFileVersion("%windir%\system32\wuaueng.dll") < "5.8.0.2469" Shell "net stop wuauserv" Copy "\\troy\c$\%Windir%\system32\wu*.*" "c:\winnt\system32" Shell "net start wuauserv" EndIf
But you may want to use SC or XNET to query wether the service is actually stopped before trying to copy the new file. I would probably use SC and WshPipe() to get the results of the command.
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1574 anonymous users online.
|
|
|