Link to home
Start Free TrialLog in
Avatar of Jay Thomas
Jay ThomasFlag for United Kingdom of Great Britain and Northern Ireland

asked on

powershell psobject

Hi experts.
I want to compare a file on a server with one that is newer (same name but version difference) so I am trying to compare the files version, and if the same version do nothing, if older install newer file.
I have been looking at psobject -property but to be honest PS is not my strength, if the file resides :
\\SERVER1\files\myfile   and the version is 1.
my new file is also called myfile and it's version is version 2. can anyone give me the command I would use please? I'm not one for trying this site everything a problem occurs but as said PS isn't me and it could take me hours to get the answer through googling.
thank you all.
SOLUTION
Avatar of footech
footech
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jay Thomas

ASKER

thank you very much. and I can save that as a script and run from schedule task?
hi@fotech. sorry I'm on a mobile and only saw the second response through my screen. it checks for versions.
??
it checks for versions.
I don't know what that means.
Hi. first of it looks like my responses are appearing more than once, could be the new EE app I'm using I have no idea. To clarify further as I realise my version answer was a bit vague. so, we look are looking at the file properties, details tab, and "product version" property.
thank you chaps.
oBdA's should work for you then.  Just change FileVersion to ProductVersion.
Hi both still looking at this. What one liner can I use to pull the file version info for a file? I just want to be able to test and check the version outside of a script.
Thank you.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Brilliant as always. Hope point share seems fair.