Set exl = WScript.CreateObject("excel.Application") exl.Visible = True set page=exl.workbooks.add.sheets(1) page.Columns(1).ColumnWidth = 3 page.Columns(2).ColumnWidth = 30 exl.ActiveWindow.DisplayGridlines = False page.cells(2,2).Font.Bold = True page.cells(2,2)="Variables d'environnement" lin=3 '________________________________________ set nw=CreateObject("WScript.Network") txt=nw.ComputerName if txt<>"" then lin=lin+1 page.cells(lin,3)=txt page.cells(lin,2)="nom réseau de l'ordinateur" end if txt=nw.UserDomain if txt<>"" then lin=lin+1 page.cells(lin,3)=txt page.cells(lin,2)="nom de domaine" end if txt=nw.UserName if txt<>"" then lin=lin+1 page.cells(lin,3)=txt page.cells(lin,2)="nom d'utilisateur" end if set lecteurs=nw.EnumNetworkDrives for num=0 to lecteurs.count-1 step 2 lin=lin+1 page.cells(lin,2)=lecteurs(num) page.cells(lin,3)=lecteurs(num+1) next set imprimantes=nw.EnumPrinterConnections for num=0 to imprimantes.count-1 step 2 lin=lin+1 page.cells(lin,2)=imprimantes(num) page.cells(lin,3)=imprimantes(num+1) next '________________________________________ Set Ws = WScript.CreateObject("WScript.Shell") Set envProc = Ws.Environment("PROCESS") lin=lin+1 page.cells(lin,2)="adresse fichier executable" page.cells(lin,3)=envProc("COMSPEC") lin=lin+1 page.cells(lin,2)="chemin d'accès" page.cells(lin,3)=envProc("PATH") lin=lin+1 page.cells(lin,2)="invite de commande" page.cells(lin,3)=envProc("PROMPT") lin=lin+1 page.cells(lin,2)="répertoire Windows" page.cells(lin,3)=envProc("WINDIR") lin=lin+1 page.cells(lin,2)="fichiers temporaires TEMP" page.cells(lin,3)=envProc("TEMP") lin=lin+1 page.cells(lin,2)="fichiers temporaires TMP" page.cells(lin,3)=envProc("TMP") 'seulement pour Win NT, Win 2000 ou Win XP Set envSyst = Ws.Environment("SYSTEM") if envSyst("OS")<>"" then lin=lin+1 page.cells(lin,2)="Système d'exploitation" page.cells(lin,3)=envSyst("OS") lin=lin+1 page.cells(lin,2)="Nombre de processeurs" page.cells(lin,3)=envSyst("NUMBER_OF_PROCESSORS") lin=lin+1 page.cells(lin,2)="Processeur" page.cells(lin,3)=envSyst("PROCESSOR_LEVEL") lin=lin+1 page.cells(lin,2)="fichiers executables" page.cells(lin,3)=envSyst("PATHEXT") end if '________________________________________ Set Fs = CreateObject("Scripting.FileSystemObject") typedisque=Array("disque","disque amovible","disque","lecteur réseau","lecteur CDRom","disque virtuel") for each lect in Fs.drives lin=lin+1 page.cells(lin,2)=typedisque(lect.DriveType) page.cells(lin,3)=lect.DriveLetter & " " & lect.ShareName on error resume next page.cells(lin,3)=page.cells(lin,3) & " (" & int(lect.TotalSize/1024/1024) & " MegaOctets dont " & int(lect.FreeSpace/1024/1024) & " libres et " & int(lect.AvailableSpace/1024/1024) & " accessibles)" on error goto 0 next '________________________________________ txt=ws.SpecialFolders("AllUsersDesktop") if txt<>"" then lin=lin+1 page.cells(lin,3)=txt page.cells(lin,2)="bureau tous utilisateurs" end if lin=lin+1 page.cells(lin,3)=ws.SpecialFolders("Desktop") page.cells(lin,2)="bureau utilisateur en cours" txt=ws.SpecialFolders("AllUsersStartMenu") if txt<>"" then lin=lin+1 page.cells(lin,3)=txt page.cells(lin,2)="menu démarrer tous utilisateurs" end if lin=lin+1 page.cells(lin,3)=ws.SpecialFolders("StartMenu") page.cells(lin,2)="menu démarrer utilisateur en cours" txt=ws.SpecialFolders("AllUsersPrograms") if txt<>"" then lin=lin+1 page.cells(lin,3)=txt page.cells(lin,2)="menu démarrer/Programmes tous utilisateurs" end if lin=lin+1 page.cells(lin,3)=ws.SpecialFolders("Programs") page.cells(lin,2)="menu démarrer/Programmes utilisateur en cours" txt=ws.SpecialFolders("AllUsersStartup") if txt<>"" then lin=lin+1 page.cells(lin,3)=txt page.cells(lin,2)="dossier démarrage tous utilisateurs" end if lin=lin+1 page.cells(lin,3)=ws.SpecialFolders("StartUp") page.cells(lin,2)="dossier démarrage utilisateur en cours" lin=lin+1 page.cells(lin,3)=ws.SpecialFolders("Favorites") page.cells(lin,2)="dossier favoris" lin=lin+1 page.cells(lin,3)=ws.SpecialFolders("MyDocuments") page.cells(lin,2)="dossier Mes Documents" lin=lin+1 page.cells(lin,3)=ws.SpecialFolders("NetHood") page.cells(lin,2)="Voisinage Réseau" txt=ws.SpecialFolders("PrintHood") if txt<>"" then lin=lin+1 page.cells(lin,3)=txt page.cells(lin,2)="imprimantes réseau" end if 'adresse ip Set ws = WScript.CreateObject("WScript.Shell") on error resume next ws.Run "%comspec% /c ipconfig > C:\ip1.txt", 0, True ws.Run "ipconfig /All /batch C:\ip1.txt",0,true on error goto 0 do while not fs.fileexists("C:\ip1.txt") loop 'lire le fichier texte créé par le batch Set fich = fs.OpenTextFile("c:\ip1.txt", 1, false) do while not fich.AtEndOfStream txt=fich.readLine if instr(lcase(txt),"adresse ip")>1 or instr(lcase(txt),"ip address")>1 then txt=right(txt,len(txt)-instr(txt,":")) page.cells(lin,3)=txt page.cells(lin,2)="adresse IP" lin=lin+1 end if loop fich.close fs.deletefile "c:\ip1.txt" '________________________________________ Set lecteurs=nothing Set imprimantes=nothing Set nw=nothing Set Fs=nothing Set envSyst = nothing Set envProc = nothing set page=nothing set exl=nothing set ws=nothing