Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Installation des SP sur plusieurs postes W2K

2 réponses
Avatar
eddy
bonjour,
j'ai un domaine sous NT 4 avec une centaine de machines sous w2k.
Quel est la meilleure façon d'effectuer des mise a jour SP sur ces postes?
merci pour vos réponses


--
enlever (pas et mag_) pour me répondre merci

2 réponses

Avatar
Clive Lumb
"eddy" a écrit dans le message de
news:41f2b752$0$26224$
bonjour,
j'ai un domaine sous NT 4 avec une centaine de machines sous w2k.
Quel est la meilleure façon d'effectuer des mise a jour SP sur ces postes?
merci pour vos réponses


--
enlever (pas et mag_) pour me répondre merci



Voici un script (adapté d'un script Microsoft)
Sauver le text apres les *** comme installSP4.vbs
lancer avec:


cscript installSP4.vbs <nom_de_fichier_adresses_IP.txt>
<chemin_vers_les_SP4>ou: <nom_de_fichier_adresses_IP.txt> est le chemin et
nom d'un fichier avec la liste des adresse IP des postes à vérifier/mettre à
jour,et <chemin_vers_les_SP4> est le chemin vers les service packsLes
service packs doivent être nommés: w2ksp4_en.exe
w2ksp4_fr.exeN'oublier pas de mettre les chemins entre "" s'il y a des
espaces
Good luck
Clive
*********
' InstallSP4.vbs
' Patch installation script for Win2K
' (c) Clive Lumb 2004
' v1.01 cl


on error resume next


const W2K_SP4en = "w2ksp4_en.exe"
const W2K_SP4fr = "w2ksp4_fr.exe"


If right(ucase(wscript.FullName),11)="WSCRIPT.EXE" then
wscript.echo "ERROR: You must run this script using cscript, for
example 'cscript " & wscript.scriptname & "'."
wscript.quit 0
end if


' USAGE
if wscript.arguments.count <> 2 then


wscript.echo "Usage: cscript " & wscript.scriptname & "
<IpFile.txt><chemin_vers_les_SP4>" & vbCrLf & vbCrLf & _ "
<chemin_vers_les_SP4> must be a full path of a folder that containsall of
these files:" & vbCrLf & _

" " & W2K_SP4en & vbCrLf & _ " " & W2K_SP4fr
wscript.quit
end if


ipFile = wscript.arguments(0)
localPathToPatches = wscript.arguments(1)


set onet = createobject("wscript.network")
set ofs = createobject("scripting.filesystemobject")


' Verify that ipfile is accessible.
set oipFile = ofs.opentextfile(ipFile, 1, false)
if (Err.Number <> 0) then
wscript.echo "Cannot open " & ipFile
wscript.quit
end if


' Make sure to end with a character.
if right(localPathToPatches, 1) <> "" then
localPathToPatches = localPathToPatches & ""
end if


'Note that cim_datafile does not support UNC paths
'so everything must be handled through mapped drives.
if left(localPathToPatches, 2) = "" then
wscript.echo "<pathToExecutable> cannot be a UNC path, please map a
drive locally"
wscript.quit
end if


exeW2ken = ofs.getfile(localPathToPatches + W2K_SP4en).name
exeW2kfr = ofs.getfile(localPathToPatches + W2K_SP4fr).name


' Verify that the patches are accessible.
if ((len(exeW2ken) = 0) OR (len(exeW2kfr) = 0)) then
wscript.echo "Cannot find patch files."
wscript.echo "Please verify that the <LocalPathToPatches> folder
contains all of these files:" & vbCrLf & _


" " & W2K_SP4en & vbCrLf & _ " " & W2K_SP4fr
wscript.quit
end if


set osvcLocal = getobject("winmgmts:rootcimv2")


'The error-handling code is below the function that may throw one - execute
it.
on error resume next


while not oipFile.atEndOfStream
ip = oipFile.ReadLine()
wscript.echo vbCrLf & "Connecting to " & ip & "..."


Err.Clear


set osvcRemote = GetObject("winmgmts:" & ip & "rootcimv2")
if (Err.Number <> 0) then
wscript.echo "Failed to connect to " & ip & "."
else


exeCorrectPatch = detectOSPatch(osvcRemote)
if (exeCorrectPatch <> "") then
' Lay the bits on the remote computer.
wscript.echo "Installing patch " & exeCorrectPatch & "..."



onet.mapnetworkdrive "z:", "" & ip & "C$"
set osourceFile = osvcLocal.get("cim_datafile="""
&replace(localPathToPatches, "", "") & exeCorrectPatch & """")
ret = osourceFile.Copy("z:SP4inst.exe")



if (ret <> 0 and ret <> 10) then ' Failure
detected and failure was not "file already
exists."

wscript.echo "Failed copy to " & ip & " - error: " & ret
else
set oprocess = osvcRemote.Get("win32_process")


' Start the installation without user interaction, and
do not force a restart after completion.


ret = oprocess.create("c:SP4inst.exe -q")
if (ret <> 0) then
wscript.echo "Failed to start process on " & ip &
": " & ret
else
' Get a reference to the file that was copied.
set odestFile
osvcLocal.get("cim_datafile=""z:SP4inst.exe""")
' Wait for the installation to complete.
for waitTime = 0 to 6000 ' Lay and wait--up to
10 minutes for the installation to complete.
wscript.Sleep 1000 ' Sleep one second.
' Delete temporary file as soon as possible
after it is freed.
if (odestFile.Delete() = 0) then
exit for
end if
next ' Otherwise, loop again and keep waiting...


wscript.echo "Installation successful."


end if 'Create process succeeded.
end if 'Copy succeeded.


onet.removenetworkdrive "z:", true
end if ' The script knows which patch to install.
end if ' Do the next IP address, then the next IP address...
wend


oipFile.close()


'Clean up, remove drive mapping (check this time, because it may not have
been mapped).
if ofs.folderexists("z:") then
onet.removenetworkdrive "z:", true
end if


wscript.echo vbCrLf & "Patching complete. Exiting."


function detectOSPatch(osvcRemote)


set oOSInfo = osvcRemote.InstancesOf("Win32_OperatingSystem")
'Only one instance is ever returned (the currently active OS), even
though the following is a foreach.
for each objOperatingSystem in oOSInfo


if (objOperatingSystem.OSType <> 18) then
' Make sure that this computer is Windows NT-based.
wscript.echo ip & " is not a Windows XP, Windows 2000, or
Windows 2003 Server computer."
else
if (objOperatingSystem.Version = "5.0.2195") then
' Windows 2000.
if (objOperatingSystem.ServicePackMajorVersion <> 4)
then
' SP4 not installed
if (objOperatingSystem.CountryCode = 33) then
'French
wscript.echo "French"
systemType = exeW2kfr
end if
if (objOperatingSystem.CountryCode = 1) then
'US English
wscript.echo "US English"
systemType = exeW2ken
end if
else
wscript.echo "Could not patch " & ip & " - SP4
already installed"


end if


else


'This was a Windows NT-based computer, but not with a
valid service pack.
wscript.echo "Could not patch " & ip & " - unhandled OS
version: " & objOperatingSystem.Caption & " SP" &
objOperatingSystem.ServicePackMajorVersion & "("& objOperatingSystem.Version
& ")"
end if
end if


next


detectOSPatch = systemType


end function


*********

Avatar
eddy
merci beaucoup

--
enlever (pas et mag_) pour me répondre merci
"Clive Lumb" a écrit dans le message
de news:

"eddy" a écrit dans le message de
news:41f2b752$0$26224$
bonjour,
j'ai un domaine sous NT 4 avec une centaine de machines sous w2k.
Quel est la meilleure façon d'effectuer des mise a jour SP sur ces
postes?
merci pour vos réponses


--
enlever (pas et mag_) pour me répondre merci



Voici un script (adapté d'un script Microsoft)
Sauver le text apres les *** comme installSP4.vbs
lancer avec:


cscript installSP4.vbs <nom_de_fichier_adresses_IP.txt>
<chemin_vers_les_SP4>ou: <nom_de_fichier_adresses_IP.txt> est le chemin et
nom d'un fichier avec la liste des adresse IP des postes à vérifier/mettre
à
jour,et <chemin_vers_les_SP4> est le chemin vers les service packsLes
service packs doivent être nommés: w2ksp4_en.exe
w2ksp4_fr.exeN'oublier pas de mettre les chemins entre "" s'il y a des
espaces
Good luck
Clive
*********
' InstallSP4.vbs
' Patch installation script for Win2K
' (c) Clive Lumb 2004
' v1.01 cl


on error resume next


const W2K_SP4en = "w2ksp4_en.exe"
const W2K_SP4fr = "w2ksp4_fr.exe"


If right(ucase(wscript.FullName),11)="WSCRIPT.EXE" then
wscript.echo "ERROR: You must run this script using cscript, for
example 'cscript " & wscript.scriptname & "'."
wscript.quit 0
end if


' USAGE
if wscript.arguments.count <> 2 then


wscript.echo "Usage: cscript " & wscript.scriptname & "
<IpFile.txt><chemin_vers_les_SP4>" & vbCrLf & vbCrLf & _ "
<chemin_vers_les_SP4> must be a full path of a folder that containsall of
these files:" & vbCrLf & _

" " & W2K_SP4en & vbCrLf & _ " " & W2K_SP4fr
wscript.quit
end if


ipFile = wscript.arguments(0)
localPathToPatches = wscript.arguments(1)


set onet = createobject("wscript.network")
set ofs = createobject("scripting.filesystemobject")


' Verify that ipfile is accessible.
set oipFile = ofs.opentextfile(ipFile, 1, false)
if (Err.Number <> 0) then
wscript.echo "Cannot open " & ipFile
wscript.quit
end if


' Make sure to end with a character.
if right(localPathToPatches, 1) <> "" then
localPathToPatches = localPathToPatches & ""
end if


'Note that cim_datafile does not support UNC paths
'so everything must be handled through mapped drives.
if left(localPathToPatches, 2) = "" then
wscript.echo "<pathToExecutable> cannot be a UNC path, please map a
drive locally"
wscript.quit
end if


exeW2ken = ofs.getfile(localPathToPatches + W2K_SP4en).name
exeW2kfr = ofs.getfile(localPathToPatches + W2K_SP4fr).name


' Verify that the patches are accessible.
if ((len(exeW2ken) = 0) OR (len(exeW2kfr) = 0)) then
wscript.echo "Cannot find patch files."
wscript.echo "Please verify that the <LocalPathToPatches> folder
contains all of these files:" & vbCrLf & _


" " & W2K_SP4en & vbCrLf & _ " " & W2K_SP4fr
wscript.quit
end if


set osvcLocal = getobject("winmgmts:rootcimv2")


'The error-handling code is below the function that may throw one -
execute
it.
on error resume next


while not oipFile.atEndOfStream
ip = oipFile.ReadLine()
wscript.echo vbCrLf & "Connecting to " & ip & "..."


Err.Clear


set osvcRemote = GetObject("winmgmts:" & ip & "rootcimv2")
if (Err.Number <> 0) then
wscript.echo "Failed to connect to " & ip & "."
else


exeCorrectPatch = detectOSPatch(osvcRemote)
if (exeCorrectPatch <> "") then
' Lay the bits on the remote computer.
wscript.echo "Installing patch " & exeCorrectPatch & "..."



onet.mapnetworkdrive "z:", "" & ip & "C$"
set osourceFile = osvcLocal.get("cim_datafile="""
&replace(localPathToPatches, "", "") & exeCorrectPatch & """")
ret = osourceFile.Copy("z:SP4inst.exe")



if (ret <> 0 and ret <> 10) then ' Failure
detected and failure was not "file already
exists."

wscript.echo "Failed copy to " & ip & " - error: " &
ret
else
set oprocess = osvcRemote.Get("win32_process")


' Start the installation without user interaction, and
do not force a restart after completion.


ret = oprocess.create("c:SP4inst.exe -q")
if (ret <> 0) then
wscript.echo "Failed to start process on " & ip &
": " & ret
else
' Get a reference to the file that was copied.
set odestFile >
osvcLocal.get("cim_datafile=""z:SP4inst.exe""")
' Wait for the installation to complete.
for waitTime = 0 to 6000 ' Lay and wait--up to
10 minutes for the installation to complete.
wscript.Sleep 1000 ' Sleep one second.
' Delete temporary file as soon as possible
after it is freed.
if (odestFile.Delete() = 0) then
exit for
end if
next ' Otherwise, loop again and keep waiting...


wscript.echo "Installation successful."


end if 'Create process succeeded.
end if 'Copy succeeded.


onet.removenetworkdrive "z:", true
end if ' The script knows which patch to install.
end if ' Do the next IP address, then the next IP address...
wend


oipFile.close()


'Clean up, remove drive mapping (check this time, because it may not have
been mapped).
if ofs.folderexists("z:") then
onet.removenetworkdrive "z:", true
end if


wscript.echo vbCrLf & "Patching complete. Exiting."


function detectOSPatch(osvcRemote)


set oOSInfo = osvcRemote.InstancesOf("Win32_OperatingSystem")
'Only one instance is ever returned (the currently active OS), even
though the following is a foreach.
for each objOperatingSystem in oOSInfo


if (objOperatingSystem.OSType <> 18) then
' Make sure that this computer is Windows NT-based.
wscript.echo ip & " is not a Windows XP, Windows 2000, or
Windows 2003 Server computer."
else
if (objOperatingSystem.Version = "5.0.2195") then
' Windows 2000.
if (objOperatingSystem.ServicePackMajorVersion <> 4)
then
' SP4 not installed
if (objOperatingSystem.CountryCode = 33) then
'French
wscript.echo "French"
systemType = exeW2kfr
end if
if (objOperatingSystem.CountryCode = 1) then
'US English
wscript.echo "US English"
systemType = exeW2ken
end if
else
wscript.echo "Could not patch " & ip & " - SP4
already installed"


end if


else


'This was a Windows NT-based computer, but not with a
valid service pack.
wscript.echo "Could not patch " & ip & " - unhandled OS
version: " & objOperatingSystem.Caption & " SP" &
objOperatingSystem.ServicePackMajorVersion & "("&
objOperatingSystem.Version
& ")"
end if
end if


next


detectOSPatch = systemType


end function


*********