Good afternoon,
I created an arraylist of services from a server. In that arraylist I have seven columns.
DisplayName,Service,Application,StartMode,State,PathName
I would like to at the end of my script check where Application -eq a specific name then append a new column to the array list and populate that one entry with Role = Client for instance.
Then my output would be similar to
DisplayName Service Application StartMode State PathName Role
Job Mgr JBMGR MyApp Auto Running \\server\c$\Program Files \MyApp\Jobmgr.exe Client
$ApplicationDiscovered.Add((New-Object PSObject -Property @{
'State' = $AppFound.State
'Application' = $AppFound.Application
'Service' = $AppFound.Service
'DisplayName' = $AppFound.DisplayName
'PathName' = $AppFound.PathName
'StartMode' = $AppFound.StartMode
}))
I was thinking
If ($ApplicationDiscovered.Application -eq "MyApp") {$applicationdiscovered | add-member -membertype noteproperty -name Role -value 'Client}
But of course that appends role to the end and a value by itself rather that at the end of the row which has application MyApp in end.
of something along those lines. Please let me know where I am in error as my brain is fried currently. THank you