Get the version of a file through PowerShell

Every now and then I need to get or compare the version of a file. Although this is a rather basic task, you’ll need to know the exact location of the file.
If you have a standardized environment, this wouldn’t be much of a problem… the file is at the same location on each server, right? 😉

But what if you don’t have that luxury? What if you only know the drive where the file is located?
You can use a simple CIM/WMI class for this:

And if you don’t know the drive, simply don’t filter on that and the command will search through the entire target… logically this will take a lot more time 😉

Leave a Reply

Your email address will not be published. Required fields are marked *