Get Software List Using WMI

Hi

How would you use wmi to get hardware/software information on a networked computer if you knew the network path and or computer name of a computer on your network?

Thanks
LVL 1
narmi2Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ramesh SrinivasTechnical ConsultantCommented:
Enter your computer name after u run this script:

On Error Resume Next

result = inputbox("Name", "Please enter the computer name", 100, 100)

strComputer = result

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each objItem in colItems
    Wscript.Echo "BootDevice: " & objItem.BootDevice
    Wscript.Echo "BuildNumber: " & objItem.BuildNumber
    Wscript.Echo "BuildType: " & objItem.BuildType
    Wscript.Echo "Caption: " & objItem.Caption
    Wscript.Echo "CodeSet: " & objItem.CodeSet
    Wscript.Echo "CountryCode: " & objItem.CountryCode
    Wscript.Echo "CreationClassName: " & objItem.CreationClassName
    Wscript.Echo "CSCreationClassName: " & objItem.CSCreationClassName
    Wscript.Echo "CSDVersion: " & objItem.CSDVersion
    Wscript.Echo "CSName: " & objItem.CSName
    Wscript.Echo "CurrentTimeZone: " & objItem.CurrentTimeZone
    Wscript.Echo "Debug: " & objItem.Debug
    Wscript.Echo "Description: " & objItem.Description
    Wscript.Echo "Distributed: " & objItem.Distributed
    Wscript.Echo "ForegroundApplicationBoost: " & objItem.ForegroundApplicationBoost
    Wscript.Echo "FreePhysicalMemory: " & objItem.FreePhysicalMemory
    Wscript.Echo "FreeSpaceInPagingFiles: " & objItem.FreeSpaceInPagingFiles
    Wscript.Echo "FreeVirtualMemory: " & objItem.FreeVirtualMemory
    Wscript.Echo "InstallDate: " & objItem.InstallDate
    Wscript.Echo "LastBootUpTime: " & objItem.LastBootUpTime
    Wscript.Echo "LocalDateTime: " & objItem.LocalDateTime
    Wscript.Echo "Locale: " & objItem.Locale
    Wscript.Echo "Manufacturer: " & objItem.Manufacturer
    Wscript.Echo "MaxNumberOfProcesses: " & objItem.MaxNumberOfProcesses
    Wscript.Echo "MaxProcessMemorySize: " & objItem.MaxProcessMemorySize
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "NumberOfLicensedUsers: " & objItem.NumberOfLicensedUsers
    Wscript.Echo "NumberOfProcesses: " & objItem.NumberOfProcesses
    Wscript.Echo "NumberOfUsers: " & objItem.NumberOfUsers
    Wscript.Echo "Organization: " & objItem.Organization
    Wscript.Echo "OSLanguage: " & objItem.OSLanguage
    Wscript.Echo "OSProductSuite: " & objItem.OSProductSuite
    Wscript.Echo "OSType: " & objItem.OSType
    Wscript.Echo "OtherTypeDescription: " & objItem.OtherTypeDescription
    Wscript.Echo "PlusProductID: " & objItem.PlusProductID
    Wscript.Echo "PlusVersionNumber: " & objItem.PlusVersionNumber
    Wscript.Echo "Primary: " & objItem.Primary
    Wscript.Echo "QuantumLength: " & objItem.QuantumLength
    Wscript.Echo "QuantumType: " & objItem.QuantumType
    Wscript.Echo "RegisteredUser: " & objItem.RegisteredUser
    Wscript.Echo "SerialNumber: " & objItem.SerialNumber
    Wscript.Echo "ServicePackMajorVersion: " & objItem.ServicePackMajorVersion
    Wscript.Echo "ServicePackMinorVersion: " & objItem.ServicePackMinorVersion
    Wscript.Echo "SizeStoredInPagingFiles: " & objItem.SizeStoredInPagingFiles
    Wscript.Echo "Status: " & objItem.Status
    Wscript.Echo "SystemDevice: " & objItem.SystemDevice
    Wscript.Echo "SystemDirectory: " & objItem.SystemDirectory
    Wscript.Echo "TotalSwapSpaceSize: " & objItem.TotalSwapSpaceSize
    Wscript.Echo "TotalVirtualMemorySize: " & objItem.TotalVirtualMemorySize
    Wscript.Echo "TotalVisibleMemorySize: " & objItem.TotalVisibleMemorySize
    Wscript.Echo "Version: " & objItem.Version
    Wscript.Echo "WindowsDirectory: " & objItem.WindowsDirectory
Next

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
narmi2Author Commented:
Is that vb.net?
Ramesh SrinivasTechnical ConsultantCommented:
Nope. It's WMI.
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Ramesh SrinivasTechnical ConsultantCommented:
Well its vbscript using WMI :O
Ramesh SrinivasTechnical ConsultantCommented:
You can access all software by going through the registry of each machine. I believe it's something like:


Dim uninstallKey As String = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
        Dim rk As RegistryKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, "<YourMachineNameHere>")
        For Each skName As String In rk.GetSubKeyNames()
            Dim sk As RegistryKey = rk.OpenSubKey(skName)
            Console.WriteLine(sk.GetValue("DisplayName"))
Next


*Note: You will need the correct user account in order to do this.


regards,

KS
prakash_prkCommented:
you can also use the WMI extension provided by microsoft

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/posdmg/htm/usingcandmanagementextensions.asp

Regards
Prakash
Ramesh SrinivasTechnical ConsultantCommented:
If the code I previously posted doesn;t work than this will :O

Dim uninstallKey As String = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
        Dim rk As RegistryKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, "<YourMachineName>")

        Dim searchKey As RegistryKey = rk.OpenSubKey(uninstallKey)

        For Each skName As String In searchKey.GetSubKeyNames()
            Dim sk As RegistryKey = searchKey.OpenSubKey(skName)
            Dim str As String = sk.GetValue("DisplayName")
            Console.WriteLine(str)
        Next
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.