PowerShell

PowerShell is King–Use PowerShell to find out the file information in a file repository

This morning I was scheduled to install some software, one part of HP Service Pack was not installed, so I made the decision to just install that component, rather then re-running that Service Pack Setup (HPSUM). The quarion is, what file contains what I need? All files has just the CPXXXXXXX.exe? If I select properties from a file in explorer, I can see that it contains this:

image

Hmm, how could  I get that using PowerShell? Could it be “"Get-ChildItem”?

Running Get-ChildItem -Path \\cloud\dfs\Software\Applications\HP\swpackages -Filter *.exe gives me this:

image

and that does not help, but if adding | Select * will give me this:

image

So, the info is there, right, now how could I get rid of the junk…

Hmm, there is something called VersionInfo, lets try that…

Get-ChildItem -Path \\cloud\dfs\Software\Applications\HP\swpackages -Filter *.exe | Select-Object Name,VersionInfo | Out-GridView

image

Getting closer, bet still to much junk…

Maybe, this would work?

Get-ChildItem -Path \\cloud\dfs\Software\Applications\HP\swpackages -Filter *.exe | Select-Object -ExpandProperty VersionInfo | Select-Object -Property ProductName, ProductVersion, Filename | Out-GridView

Lets try that:

image

Yes, that seems to give the the result I like.

/mike

Categories: PowerShell

Tagged as:

1 reply »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.