Page 1 of 1

Service Getting Its Own Version?

Posted: Wed Jul 15, 2020 10:22 am
by andycarpenter@westat.com
Is there a way for a service created with PowerShell Studio to get its own version number?

For an EXE created with PowerShell Studio, I've done something like:
$MyVer=[System.Diagnostics.FileVersionInfo]::GetVersionInfo($MyExe).FileVersion
but that's really collecting it from the EXE file, which I don't think will work for a service.

I thought there might be a property on the running service through Get-Service, but no property seems suitable.

Any ideas how a running service created with PowerShell Studio can get its own version number?

Thanks,
Andy

Re: Service Getting Its Own Version?

Posted: Wed Jul 15, 2020 10:43 am
by jvierra
Applications have no concept of version internally. A version is an arbitrary number that is applied to code when it is packaged. The versioning system in Windows is attached to the executable and has multiple components. "FileVersion""ProductVersion" and other tags.

Re: Service Getting Its Own Version?

Posted: Wed Jul 15, 2020 11:15 am
by Alexander Riedel
The version for a service is specified when packaging, just as for any other executable. Since a service is an exe, it works just the same way.

Re: Service Getting Its Own Version?

Posted: Wed Jul 15, 2020 12:50 pm
by andycarpenter@westat.com
Thanks for the quick, clarifying replies.

Re: Service Getting Its Own Version?

Posted: Sun Jul 19, 2020 8:23 am
by weslein
Alexander Riedel wrote:
Wed Jul 15, 2020 11:15 am
The version for a service is specified when packaging, just as for any other executable. Since a service is an exe, it works just the same way.
Thank you very much for the clarification.

Re: Service Getting Its Own Version?

Posted: Wed Jul 29, 2020 7:22 pm
by weslein
Alexander Riedel wrote:
Wed Jul 15, 2020 11:15 am
The version for a service is specified when packaging, just as for any other executable. Since a service is an exe, it works just the same way.
Thank you very much for the help.