I am using the following Powershell script in hopes of identifying Started service applications by server.
Spot checking the results shows something unexpected. For instance, I know Lotus Notes Connector is Stopped on all servers in my farm but the script returns it.
What other additional properties must I test for to be sure I am seeing the exact same results as shown in Central Admin "Manage Services on Servers" page?
[System.Collections.ArrayList]$ReportInfo = New-Object System.Collections.ArrayList($null)
$servers = (get-spfarm).servers
foreach ($server in $servers)
{
foreach($service in $server.serviceinstances)
{
if($service.TypeName -eq "Lotus Notes Connector"){
Write-Host stop;
}
if ($service.status = "Online")
{
Write-Host "Server" $server.Name "`tService: " $service.TypeName;
$servicInfo = @{}
$servicInfo.Server = $service.Server.Name;
$servicInfo.Service = $service.TypeName;
$ReportInfo.Add((New-Object PSObject -Property $servicInfo))>$null;
}
}
}
Write-Host "Exporting CSV"
$ReportInfo | Export-Csv "Services.csv" -NoTypeInformation -Encoding UTF8 -Delimiter '|'