Я написал сценарий PS, в котором он будет экспортировать все данные сайта IIS и сведения о пуле приложений в лист Excel, но когда я использую команду Get-IISSite , физический путь и подробности привязки не отображаются в консоли вывода, как показано ниже, код выглядит следующим образом. Пожалуйста, помогите мне решить проблему, с которой я столкнулся при экспорте данных IIS и пула приложений
Код
#Clearing the Console host in PS
Clear-Host
$Computers = Get-Content "C:\TEMP\servers.txt"
Invoke-Command -ComputerName $Computers -ScriptBlock {
# Changed to newer IISAdministration Module to match Get-IISAppPool
$Websites = Get-IISSite
foreach ($Website in $Websites) {
$AppPool = Get-IISAppPool -Name $Website.Applications[0].ApplicationPoolName
[PSCustomObject]@{
Website_Name = $Website.Name
Website_Id = $Website.Id -join ';'
Website_State = $Website.State -join ';'
Website_PhysicalPath = Get-ChildItem -Path IIS:\Sites\P #$Website.PhysicalPath -join ';'
Website_Bindings = $Website.Bindings.Collection -join ';'
Website_Attributes = ($Website.Attributes | ForEach-Object { $_.name + "=" + $_.value }) -join ';'
AppPool_Name = $AppPool.Name -join';'
AppPool_State = $AppPool.State -join ';'
AppPool_ManagedRuntimeVersion = $AppPool.ManagedRuntimeVersion -join ';'
AppPool_ManagedPipelineMode = $AppPool.ManagedPipelineMode -join ';'
AppPool_StartMode = $AppPool.StartMode -join ';'
}
}
} | Export-Excel -Path C:\users\$env:username\documents\Site_App-pool_Details.xlsx -AutoSize -BoldTopRow
OutPut
Website_Name : Test
Website_Id : 2
Website_State : Started
Website_PhysicalPath :
Website_Bindings :
Website_Attributes : name=Test;id=2;serverAutoStart=False;state=
1
AppPool_Name : Test
AppPool_State : Started
AppPool_ManagedRuntimeVersion : v4.0
AppPool_ManagedPipelineMode : Integrated
AppPool_StartMode : OnDemand
PSComputerName : AAA
RunspaceId : 47d..
When i use the command **Get-Website** i will get all the output details of the IIS site but not the IIS App-pool details the code is a below
Output
Website_Name : Test
Website_Id : 2
Website_State : Started
Website_PhysicalPath : C:\AAA
Website_Bindings : http 10.62.:Test.com
Website_Attributes : name=Test;id=2;serverAutoStart=False;state=
1
AppPool_Name :
AppPool_State :
AppPool_ManagedRuntimeVersion :
AppPool_ManagedPipelineMode :
AppPool_StartMode :
PSComputerName : AAA
RunspaceId : 15d..
Пожалуйста, помогите мне, например, как получить все сведения о сайте IIS и пуле приложений, используя любую из команд из обоих ( Get-Website или Get-WebSite)
Заранее спасибо.