Liste des logiciels installés (par VBS)

Résolu
cs_glad Messages postés 97 Date d'inscription lundi 26 novembre 2001 Statut Membre Dernière intervention 24 février 2012 - 27 sept. 2010 à 15:26
cs_glad Messages postés 97 Date d'inscription lundi 26 novembre 2001 Statut Membre Dernière intervention 24 février 2012 - 30 sept. 2010 à 13:10
Bonjour,

Je suis un peu perplexe, je viens de m'apercevoir que certains logiciels ne "remontaient" pas ds WMI via le script suivant :

    
Set WMI_ObjProps = WMI_Obj.ExecQuery("SELECT * FROM Win32_Product", , 48)
    For Each ObjClsItem In WMI_ObjProps
    WScript.echo ObjClsItem.name + "/"+ ObjClsItem.description + "/"+ ObjClsItem.caption  + "/"+ ObjClsItem.installlocation
    Next


C'est le cas par exemple de mozilla firefox.

J'ai écrit une suite de logiciel pour gérer le parc logiciel de manière automatisée et s'il me manque la moitié des logiciels, ça va pas le faire

Avez-vous des idées d'où ça peut provenir ?
Pour info, je suis utilisateur d'un domaine.

A+

3 réponses

cs_Le Pivert Messages postés 7899 Date d'inscription jeudi 13 septembre 2007 Statut Contributeur Dernière intervention 21 septembre 2023 137
30 sept. 2010 à 12:17
Bonjour,
Essayez cela:

Set oShell = CreateObject("wscript.Shell")
Set env = oShell.environment("Process")
strComputer = env.Item("Computername")
Const HKEY_LOCAL_MACHINE = &H80000002
Const UnInstPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\" &_
".\root\default:StdRegProv")
oReg.EnumKey HKEY_LOCAL_MACHINE, UnInstPath, arrSubKeys
software = "*******************************" & Now & "****************************" & vbCrLf
software = software & "*******************************Logiciels installés********************************" & vbCrLf
For Each subkey In arrSubKeys
        'MsgBox subkey
        If Left (subkey, 1) <> "{" Then
                software = software & subkey & vbCrLf
        End If
Next
software = software & "*********************************************************" & vbCrLf
 
Set fso = CreateObject("Scripting.FileSystemObject")
 
'Détermine si le fichier csv existe déjà ou s'il doit le créer
If Not fso.FileExists("inventaire " & strComputer & ".csv") Then
        set ts = fso.CreateTextFile("inventaire " & strComputer & ".csv", True)
Else
        set ts = fso.OpenTextFile("inventaire " & strComputer & ".csv", 2, True)
End If
 
ts.write software


Cela fonctionne chez moi
@+
Le Pivert
3
cs_glad Messages postés 97 Date d'inscription lundi 26 novembre 2001 Statut Membre Dernière intervention 24 février 2012
30 sept. 2010 à 11:48
j'ai pas de succès avec ma question...

Vraiment aucune idée ?
0
cs_glad Messages postés 97 Date d'inscription lundi 26 novembre 2001 Statut Membre Dernière intervention 24 février 2012
30 sept. 2010 à 13:10
Ca marche !

Merci ...
Au passage voici ton code un peu revu :

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\" &_
".\root\default:StdRegProv")
oReg.EnumKey HKEY_LOCAL_MACHINE, UnInstPath, arrSubKeys

For Each subkey In arrSubKeys
        	WScript.echo subkey & vbCrLf
        	tmp=WshShell.RegRead ("HKLM" & UnInstPath & subkey & "\DisplayName")
        	If tmp="" Then tmp=SubKey
        	f.Write(";Appl;" & tmp)
        	tmp=""
        	tmp=WshShell.RegRead ("HKLM" & UnInstPath & subkey & "\InstallDate")
        	f.Write(";ApplInstallDate;" & tmp)
        	tmp=""
        	tmp=WshShell.RegRead ("HKLM" & UnInstPath & SubKey & "\DisplayVersion")
        	f.writeline(";ApplVersion;" & tmp )
Next



A++
0
Rejoignez-nous