Hello,
So I gather applications off of a PC
Our log files tell us what applications have been installed.
I could pull the registry but I've found looking for the .log files to be much quicker
I have a problem where we have mutliple versions of applications
Chrome
Acrobat
Visio
etc..
If my list looks like this
Adobe Acrobat Pro DC 15
Adobe Acrobat Pro DC 17
Google Chrome 50.0.2661.94
Google Chrome 59.0
Microsoft Visio Pro for Office 365 1512 15.0.4779.1002
Microsoft Visio Pro for Office 365 1609 16.0.7369.2127
How would I get it to look like this
Adobe Acrobat Pro DC 17
Google Chrome 59.0
Microsoft Visio Pro for Office 365 1609 16.0.7369.2127
I only want to display the newest if there are more than one that eqaul
Select-Object -last 1?
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Select-Object -last 1?
This should work in most cases, it assumes the application name is the start of the string and contains no digits and the version is at the end of the string and contains only digits and periods. Create an object with the original name, the application name and the version, using this regex.
https://regex101.com/r/7w6Jhy/1
Your object will look something like this.
Then you can group on AppName and select the latest version. There maybe some versions that don't sort properly, like going from 9.1.0 to 10.1.1, but this is about as close as you will get unless you can pull a numeric version number from your source.
https://regex101.com/r/7w6Jhy/1
Your object will look something like this.
Code: Select all
App AppName Version
Adobe Acrobat Pro DC 15 Adobe Acrobat Pro DC 15
...
Microsoft Visio Pro for Office 365 1609 16.0.7369.2127 Microsoft Visio Pro for Office 16.0.7369.2127
- MarvelManiac
- Posts: 63
- Last visit: Thu Sep 13, 2018 3:40 pm
Re: Select-Object -last 1?
I’ll post my psf later. Maybe it’ll help show
I should have done it in the first place
I should have done it in the first place
- MarvelManiac
- Posts: 63
- Last visit: Thu Sep 13, 2018 3:40 pm
Re: Select-Object -last 1?
Sorry for the delay. Here is my working example with lots of corporate applications removed from the excluded applications.txt but I think you'll get the jist
You'll only need to edit lines 206, 207 to get this to work
You'll only need to edit lines 206, 207 to get this to work