我想知道如果有人能向我解释我所看到的行为上的差异。
我试图find一个IIS站点的物理path。
此示例工作,正确返回PhysicalPath
Import-Module WebAdministration Get-ChildItem iis:\\sites | Select PhysicalPath
此示例不起作用。 PhysicalPath作为空/空返回。
Get-IISSite | select PhysicalPath
如果我是正确的,这两个示例应该返回一个Microsoft.Web.Administration.Site对象。 为什么第二个数据缺失?
让我们来看看:
Get-ChildItem iis:\ sites | get-Member | 在那里名字般的p * | sorting对象名称
TypeName: System.Object Name MemberType Definition ---- ---------- ---------- password NoteProperty string password= physicalPath NoteProperty string physicalPath=C:\inetpub\wwwroot PSChildName NoteProperty string PSChildName=Default Web Site PSDrive NoteProperty PSDriveInfo PSDrive=IIS PSIsContainer NoteProperty bool PSIsContainer=True PSParentPath NoteProperty string PSParentPath=WebAdministration::\\SANKNIGHT\Sites PSPath NoteProperty string PSPath=WebAdministration::\\SANKNIGHT\Sites\Default Web Site PSProvider NoteProperty IIsProviderInfo PSProvider=WebAdministration
Get-IISSite | 获得会员
TypeName: Microsoft.Web.Administration.Site Name MemberType Definition ---- ---------- ---------- ApplicationDefaults Property Microsoft.Web.Administration.ApplicationDefaults ApplicationDefault... Applications Property Microsoft.Web.Administration.ApplicationCollection Applications {get;} Attributes Property Microsoft.Web.Administration.ConfigurationAttributeCollection Attri... Bindings Property Microsoft.Web.Administration.BindingCollection Bindings {get;} ChildElements Property Microsoft.Web.Administration.ConfigurationChildElementCollection Ch... Delete Method void Delete()
它没有任何以P开头的成员,并且比Get-ChildItemless得多。 你可以看到他们不是同一个对象。
当使用Get-ChildItem时,每个提供者都提供了一些关于应该显示的提示。 我认为这是在:
$pshome\Modules\WebAdministration\iisprovider.format.ps1xml
因此,所有额外的信息都被添加了。