1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Dim strDescription, strComputer, reg, objRegistry
Dim ret, msg, ValueName
Const HKLM = &H80000002
strComputer = inputbox("Nom de l'ordinateur cible :")
if strComputer = " " then wscript.quit
on error resume next
Set reg = GetObject(" winmgmts:\\ "& strComputer &" \root\default:StdRegProv ")
if err.number <> 0 then
msgbox "Erreur rencontré en essayant de se connecter à la base de données WMI du '" & strComputer & "'. L'ordinateur est-il sous tension ? Si oui, il peut y avoir un problème avec vos permissions. ",16, "Erreur de connexion au " & strComputer & "."
wscript.quit
end if
on error goto 0
Set objRegistry = GetObject(" winmgmts:{impersonationLevel=impersonate}!\\ " & strComputer & " \root\cimv2?).ExecQuery("" Select Description FROM Win32_OperatingSystem")
For Each object In objRegistry
strDescription = object.Description
Next
value = inputbox(" Description pour l'ordinateur " & strComputer & " : ", "Entrez une nouvelle description ",strDescription)
If value = strDescription then wscript.quit
key = " SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters "
ValueName = " srvcomment "
If Len(Value) > 48 Then Value = Left(Value, 48)
ret = reg.SetStringValue(HKLM, key, ValueName, value)
if ret <> 0 then msgbox " La mise à jour à distance a échoué. " |
Partager