header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Dumping list of software and versions, match vendor and converting to HTML
Last Post 27 Aug 2010 01:49 AM by David Symons. 2 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
David SymonsUser is Offline
New Member
New Member
Posts:6
Avatar

--
24 Aug 2010 03:28 AM
    Hi,

    I am trying to create a PowerShell script that will dump the software on the local machine and is sorted by Name/Vendor/Version. This can be done with this:

    Get-wmiobject Win32_Product | Sort-Object Vendor, Name | Format-Table Vendor, Name, Version -groupBy Vendor

    However, I want to be able to match / sort by a specific vendor (let's say I want to only pull data that has Microsoft or the word 'Microsoft' as a vendor). I then want this output to be put into a formatted HTML file. For example, matching all software created by Skype and their versions, in a HTML file.

    The script I am using without the HTML works, and it is this:

    Get-wmiobject Win32_Product | Sort-Object Vendor, Name | Format-Table Vendor, Name, Version -groupBy Vendor | findstr Microsoft

    ..however if I add findstr Microsoft | ConvertTo-HTML | Out-File c:\test.html on the end, it does not work.

    I've tried RegEx and using the -match command without much success.

    Any help is greatly appreciated :)

    Many thanks.

    0ptikGhostUser is Offline
    Basic Member
    Basic Member
    Posts:296
    Avatar

    --
    24 Aug 2010 01:30 PM

    You filter like this:

    Get-WmiObject Win32_Product | Where-Object { $_.Vendor -like '*Microsoft*'} | Sort-Object Vendor, Name | Format-Table Vendor, Name, Version -GroupBy Vendor

    Or like this:

    Get-WmiObject Win32_Product | Where-Object { $_.Vendor -match 'Microsoft'} | Sort-Object Vendor, Name | Format-Table Vendor, Name, Version -GroupBy Vendor

    I believe you can set a parameter on Get-WmiObject directly to do a more efficient filter but I don't know that syntax.

    When you are ready to convert your output to HTML you should replace the Format-Table cmdlet with code that will generate the HTML you want. There is a very good chance you'll need to write that code yourself.

    David SymonsUser is Offline
    New Member
    New Member
    Posts:6
    Avatar

    --
    27 Aug 2010 01:49 AM
    That worked - thanks very much :D
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer