Hello,
Voici un script afin de modifier le mot de passe de l'administrator local
sur des PC à distance :
"
Detailed Information
Platforms(s): Windows 2000/XP, 2000/2003 Server
There are a few things in the script that will need to be changed.
src="c:\pclist.txt"
This is the path to the computers that will have its password changed. You
can modify this if needed.
Set noton = fso.CreateTextFile("c:\logs\log.txt")
This is the path to the log file, you can leave it here or change to desired
path.
Set user = GetObject("WinNT://" & temp & "/administrator,user")
This is the account that will have its password changed. If your local admin
account is named something different you will need to change it.
END OF HELP INFO FOR THE SCRIPT.
Copy and paste the code below into a text file and save as filename.vbs
'******************************************************
'Title: Change Local Admin Password
'Description: Changes local admin password on multiple computers.
'********************************************************
Dim fso, user, ts, temp, src
src = "c:\pclist.txt" '** text file list of computer names
Set fSO = CreateObject("Scripting.FileSystemObject")
Set noton = fso.CreateTextFile("c:\logs\log.txt") ' error log
Set ts = fso.OpenTextFile(src,1)
Const cTitlebarMsg = "Local Administrator Password Change Tool" ' Custom
title bar
password = InputBox("Enter new admin password.", cTitlebarMsg)
If Len(password) = 0 Then 'Checks if inputbox = 0
WScript.Quit
End If
Do Until ts.AtEndOfStream ' Start of do loop
on error resume next
temp = ts.ReadLine
Set user = GetObject("WinNT://" & temp & "/administrator,user") ' local
account to change password
Else
noton.writeline strmachine & VBCrLf & _
"done" & VBCrLf & _
"==============================================="
End If
'*******************End error checking*********************
user.setpassword password
user.setinfo
Loop
Wscript.echo "Done"
"
Afin de l'améliorer, pourriez vous me dire comment modifier les inscriptions
dans le fichiers "log.txt" car pour l'instant je n'arrive à avoir que ceci:
pspasswd [[Ordinateur_Distant | Domaine] [-u Nom_Utilisateur [-p Mot_De_Passe]]] Nom_Utilisateur [Nouveau_Mot_De_Passe] -u : spécifie un nom d'utilisateur afin de pouvoir se connecter sur une machine distante. -p : spécifie un mot de passe pour le nom d'utilisateur indiqué.
Et que la Force des batchs soit avec toi !
-- @-salutations
Michel Claveau
Bonjour !
Va là :
http://www.microsoft.com/technet/sysinternals/utilities/sysinternalssuite.mspx
et télécharge pspasswd
Utilisation :
pspasswd [\[Ordinateur_Distant | Domaine] [-u Nom_Utilisateur [-p
Mot_De_Passe]]] Nom_Utilisateur [Nouveau_Mot_De_Passe]
-u : spécifie un nom d'utilisateur afin de pouvoir se connecter sur une
machine distante.
-p : spécifie un mot de passe pour le nom d'utilisateur indiqué.
pspasswd [[Ordinateur_Distant | Domaine] [-u Nom_Utilisateur [-p Mot_De_Passe]]] Nom_Utilisateur [Nouveau_Mot_De_Passe] -u : spécifie un nom d'utilisateur afin de pouvoir se connecter sur une machine distante. -p : spécifie un mot de passe pour le nom d'utilisateur indiqué.