我想尝试遍历应用程序在IIS中拥有的所有可用配置选项,这样我就可以通过PowerShell设置它们。我对IIS或PowerShell不是很熟悉,所以我会尽我最大的努力。以下输出是我尝试迭代应用程序的所有配置时得到的输出。
PS C:\Users\User01> $siteName = "CustomApp"
PS C:\Users\User01> $authentications = Get-WebConfiguration -filter "system.webServer/*" -PSPath "IIS:\Sites\Default Web Site\$siteName"
PS C:\Users\User01> foreach ($auth in $authentications) { Write-Host $auth }
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
PS C:\Users\User01> $authentications = Get-WebConfiguration -filter "system.webServer/*" -PSPath "IIS:\Sites\Default Web Site\$siteName" -Recurse
PS C:\Users\User01> foreach ($auth in $authentications) { Write-Host $auth }
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection
Microsoft.IIs.PowerShell.Framework.ConfigurationSection我应该怎么做才能获得实际的项目名称,而不是显示的项目名称?
发布于 2016-06-29 01:38:29
尝试使用-recurse函数遍历所有这些参数。
发布于 2020-04-09 19:05:58
试试这个而不是你的“Write-Host”
{$auth|gm}https://stackoverflow.com/questions/38063123
复制相似问题