1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| strOrdinateur = "."
Set objWMISer= GetObject("winmgmts:\\" & strOrdinateur & "\root\CIMV2")
Set colUsers= objWMISer.ExecQuery( "SELECT * FROM Win32_UserAccount",,48)
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
strPath = ".\output.csv"
IF(objFSO.FileExists(strPath&strName)) Then objFSO.DeleteFile strPath
SET objF=objFSO.CreateTextFile(strPath)
objF.Close
Set objF=objFSO.openTextFile(strPath,ForAppending)
objF.WriteLine("Nom;Nom_Complet;Mdp_expire?")
For each utilisateur in colUsers
nom = utilisateur.name
nom_complet = utilisateur.FullName
mdp_expire = utilisateur.PasswordExpires
Ligne = nom & ";" & nom_complet & ";" & mdp_expire
objF.WriteLine Ligne
Next
objF.Close |
Partager