I focus on enterprise Windows optimization and security for Microsoft Services. What the what? This image shows that for the very same file PowerShell and file properties Explorer can report different version numbers. You can try this on various machines and OSes and get fun weird results.
The example above is from Windows Server R2. My colleague Artem Pronichkin showed me that VersionInfo contains the information we want.
It is just hidden by default. Depending on your scripting preferences as a scripty scripter—you can use this freshly revealed truth in several ways. The following is an example you can copy and paste that exposes the goods as a new property called FileVersionUpdated on all FileInfo objects in the current session :.
Due to default formatting our new property may not appear in some views. You can twiddle with the format descriptors or just use -Property on commands like Format-List as in the following example. We can use our new property in scripts or commands to do things like compare versions between machines. Some of the fields are updated by patches and some are left alone.
File properties Explorer and PowerShell were each showing a different subset of the available fields. As you know, the PeVersion object can receive input parameters, i. Here is a simple usage of the PeVersion object:. If you want to get the version with the Assembly object as a passing parameter on the PeVersion object, you can use this code:. The file version tester application is a small application based on the desktop application to check the version and reference files from a file.
Using this application, you just pass a file DLL or EXE Managed into the application, then the application will check the file version and the references files information. The GUI of this application can looks as below:. FileVersion worked for me. I needed to add a computer name from a loop.
Could you elaborate about its effect before even calling for the property FileVersionInfo? Applying this command to the path will get the file version info! Name -match ". Chriseyre Chriseyre 2, 1 1 gold badge 16 16 silver badges 28 28 bronze badges.
CompanyName You should be able to use every member of FileVersionInfo documented here, which will get you basically anything you could ever want about the file. Adam Haile Adam Haile Here an alternative method. Knuckle-Dragger Knuckle-Dragger 6, 4 4 gold badges 23 23 silver badges 38 38 bronze badges. Verify that the property exists.
Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Stack Gives Back Safety in numbers: crowdsourcing data on nefarious IP addresses. Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Visit chat. Linked 3. See more linked questions. Related Hot Network Questions.
Need more help? Join the discussion. Was this information helpful? Yes No. Thank you! Any more feedback? The more you tell us the more we can help.
Can you help us improve? Resolved my issue.
0コメント