Avatar of Jay Thomas
Jay Thomas
Flag 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.
Powershell

Avatar of undefined
Last Comment
Jay Thomas

8/22/2022 - Mon
SOLUTION
footech

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
oBdA

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Jay Thomas

ASKER
thank you very much. and I can save that as a script and run from schedule task?
Jay Thomas

ASKER
hi@fotech. sorry I'm on a mobile and only saw the second response through my screen. it checks for versions.
footech

??
it checks for versions.
I don't know what that means.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Jay Thomas

ASKER
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.
footech

oBdA's should work for you then.  Just change FileVersion to ProductVersion.
Jay Thomas

ASKER
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.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
oBdA

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Jay Thomas

ASKER
Brilliant as always. Hope point share seems fair.