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