I am writing some PowerShell cmdlets in C# to access our production servers and report on the IIS/Service state.
The ServiceController
class has a MachineName
property, but neither Site
nor ApplicationPool
classes have this.
How would I go about returning the computer name alongside these objects (i.e. Get-Service | select MachineName,Status,DisplayName
)? I considered extending the classes, but they are sealed and I don't wish to spend time implementing this solution.
Does anyone with more skill in writing cmdlets have an idea how I can easily accomplish this?