Service Getting Its Own Version?

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
andycarpenter@westat.com
Posts: 17
Joined: Wed Jan 14, 2015 1:53 pm

Service Getting Its Own Version?

Post 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

jvierra
Posts: 14544
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Service Getting Its Own Version?

Post 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.

User avatar
Alexander Riedel
Posts: 7458
Joined: Tue May 29, 2007 4:43 pm

Re: Service Getting Its Own Version?

Post 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.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
andycarpenter@westat.com
Posts: 17
Joined: Wed Jan 14, 2015 1:53 pm

Re: Service Getting Its Own Version?

Post by andycarpenter@westat.com »

Thanks for the quick, clarifying replies.

weslein
Posts: 7
Joined: Sun Jul 12, 2020 8:53 am

Re: Service Getting Its Own Version?

Post 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.

weslein
Posts: 7
Joined: Sun Jul 12, 2020 8:53 am

Re: Service Getting Its Own Version?

Post 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.

Locked