Meilleur auteur de réponses
Changer le mot de passe admin local des postes

Question
-
Bonjour,
Est-il possible de changer le mot de passe administrateur local des postes par une GPO ou un script ?
Merci d'avance
Christophemardi 24 novembre 2009 13:22
Réponses
-
Par GPO non pas à ma connaissance (tu peux le renommer).
Par script oui :
Tu crées un fichier C:\computers.txt et tu mets la liste de tes postes
Tu créés ce fichier
ResetADM.vbs
' --------------------------------------------------------
' VARIABLE
' --------------------------------------------------------
Option Explicit
Dim strFile
Dim objFSO, objTS, strComputer' --------------------------------------------------------
' Fichier à utiliser
' --------------------------------------------------------
strFile = "C:\computers.txt"' --------------------------------------------------------
' Script
' --------------------------------------------------------
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strFile) Then
Set objTS = objFSO.OpenTextFile(strFile)
Do Until objTS.AtEndOfStream
strComputer = objTS.ReadLine
If TestPing(strComputer) Then
On Error Resume Next
Dim objAdmin
Set objAdmin = GetObject("WinNT:\\" & strComputer & "\Administrator,user")
If Err = 0 Then
objAdmin.SetPassword "P@ssw0rd!"
objAdmin.SetInfo
Else
WScript.Echo strComputer & " skipped: " & Err.Description
End If
On Error GoTo 0
End If
Loop
End IfobjTS.Close
WScript.Echo "Fini"' --------------------------------------------------------
' Fonctions
' --------------------------------------------------------
Function TestPing(sName)
Dim cPingResults, oPingResult
Set cPingResults = GetObject("winmgmts://./root/cimv2").ExecQuery("SELECT * FROM Win32_PinStatus WHERE Address = '" & sName & "'")
For Each oPingResult In cPingResults
If oPingResult.StatusCode = 0 Then
TestPing = True
Else
TestPing = False
End If
Next
End Function' --------------------------------------------------------
' Fin du script
' --------------------------------------------------------
cdlt,Ludo
- Proposé comme réponse Ludovik DOPIERALA mardi 24 novembre 2009 15:52
- Marqué comme réponse Roxana PANAITMicrosoft employee jeudi 26 novembre 2009 11:15
mardi 24 novembre 2009 15:52
Toutes les réponses
-
Par GPO non pas à ma connaissance (tu peux le renommer).
Par script oui :
Tu crées un fichier C:\computers.txt et tu mets la liste de tes postes
Tu créés ce fichier
ResetADM.vbs
' --------------------------------------------------------
' VARIABLE
' --------------------------------------------------------
Option Explicit
Dim strFile
Dim objFSO, objTS, strComputer' --------------------------------------------------------
' Fichier à utiliser
' --------------------------------------------------------
strFile = "C:\computers.txt"' --------------------------------------------------------
' Script
' --------------------------------------------------------
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strFile) Then
Set objTS = objFSO.OpenTextFile(strFile)
Do Until objTS.AtEndOfStream
strComputer = objTS.ReadLine
If TestPing(strComputer) Then
On Error Resume Next
Dim objAdmin
Set objAdmin = GetObject("WinNT:\\" & strComputer & "\Administrator,user")
If Err = 0 Then
objAdmin.SetPassword "P@ssw0rd!"
objAdmin.SetInfo
Else
WScript.Echo strComputer & " skipped: " & Err.Description
End If
On Error GoTo 0
End If
Loop
End IfobjTS.Close
WScript.Echo "Fini"' --------------------------------------------------------
' Fonctions
' --------------------------------------------------------
Function TestPing(sName)
Dim cPingResults, oPingResult
Set cPingResults = GetObject("winmgmts://./root/cimv2").ExecQuery("SELECT * FROM Win32_PinStatus WHERE Address = '" & sName & "'")
For Each oPingResult In cPingResults
If oPingResult.StatusCode = 0 Then
TestPing = True
Else
TestPing = False
End If
Next
End Function' --------------------------------------------------------
' Fin du script
' --------------------------------------------------------
cdlt,Ludo
- Proposé comme réponse Ludovik DOPIERALA mardi 24 novembre 2009 15:52
- Marqué comme réponse Roxana PANAITMicrosoft employee jeudi 26 novembre 2009 11:15
mardi 24 novembre 2009 15:52 -
Bonjour
et sur un serveur 2008R2 via les GPO comment faire
Mehdi
mardi 26 novembre 2013 16:24