Я хотел бы отобразить результаты 4 циклов foreach как:
Server
IIS Site:
App Pool:
Service:
Вместо:
Server
IIS Site:
Server
App Pool:
Server
Service:
Код:
foreach ($server in $servers)
{
foreach ($IISsite in $IISsites) { }
foreach ($appPool in $appPools) { }
foreach ($service in $services) { }
}
CheckSitesAppPoolsServices -servers "SERVER1" -IISsites ("Default Web Site")
CheckSitesAppPoolsServices -servers "SERVER1" -appPools ("DefaultAppPool")
CheckSitesAppPoolsServices -servers "SERVER1" -services ("User Profile Service", "App Readiness")
Фактические результаты:
Review Sites, App Pools and Service on SERVER1
Default Web Site....................................... Started
Review Sites, App Pools and Service on SERVER1
DefaultAppPool......................................... Started
Review Sites, App Pools and Service on SERVER1
User Profile Service................................... Running
App Readiness.......................................... Stopped
Я бы хотел, чтобы результаты отображались следующим образом:
Review Sites, App Pools and Service on SERVER1
Site: Default Web Site....................................... Started
App Pool: DefaultAppPool......................................... Started
Service: User Profile Service................................... Running
Service: App Readiness.......................................... Stopped