Page 1 of 1 1
Topic Options
#149411 - 2005-10-06 04:33 PM If folder exists
Savvy95 Offline
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
#149412 - 2005-10-06 04:50 PM Re: If folder exists
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
Quote:

Will it work




Euhm... Did you tried it?
And? did it work?

What about the dll maybe you have to re-register it...
_________________________
Co


Top
#149413 - 2005-10-06 04:58 PM Re: If folder exists
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
Sorry Savvy, Maybe not a very nice answer but do you understand what I mean. At first test your scripts by yourself before you post it here... Right know I'm thinking that Savvy95 is a lazy b*st*rd

Good luck!


Edited by Co (2005-10-06 04:59 PM)
_________________________
Co


Top
#149414 - 2005-10-06 05:17 PM Re: If folder exists
Savvy95 Offline
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 Offline
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
#149416 - 2005-10-06 09:54 PM Re: If folder exists
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
Well done!
_________________________
Co


Top
#149417 - 2005-10-06 10:08 PM Re: If folder exists
Chris S. Offline
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
#149418 - 2005-10-06 10:22 PM Re: If folder exists
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
actually, none of these codes actually work.
Copy "\\troy\c$\%Windir%\system32\wu*.*" "c:\winnt\system32"

translates to something like:
Copy "\\troy\c$\c:\winnt\system32\wu*.*" "c:\winnt\system32"


and we all know that's not good.
_________________________
!

download KiXnet

Top
#149419 - 2005-10-06 10:33 PM Re: If folder exists
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
Quote:

Copy "\\troy\ c$\c:\winnt\system32\wu*.*" "c:\winnt\system32"





Huh, you mean Copy "\\troy\c$\winnt\system32\wu*.*" "c:\winnt\system32"

{edit}

Sorry Lonk, Didn't read your post very well, I know what you mean after reading it the next time...

{edit}


Edited by Co (2005-10-06 10:38 PM)
_________________________
Co


Top
#149420 - 2005-10-07 01:02 AM Re: If folder exists
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Since %windir% is resolved only to the local enviro var (i.e. C:\Windows) I see no point in using the C$ share to get access to a local drive.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#149421 - 2005-10-07 01:17 AM Re: If folder exists
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
les, it seems he is using a copy from other system to local windir.

and he actually used %sindir% in the first post, maybe that's something else?

and when he said it works, he just lied, plain and simple.
dunno why though...
anyway, his code never worked.
_________________________
!

download KiXnet

Top
#149422 - 2005-10-08 04:40 PM Re: If folder exists
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
The most efficient way would be to use an admin script and update the remote computers centrally. SYSTEM32 writes require local admin privs.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1574 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.166 seconds in which 0.135 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org