加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

如何从Microsoft.IIs.PowerShell.Framework.ConfigurationElemen

发布时间:2020-12-14 02:03:05 所属栏目:Windows 来源:网络整理
导读:如果我在power shell中运行命令: C:Get-Website 它输出 Name ID State Physical Path Bindings---- -- ----- ------------- --------Default Web Site 1 %SystemDrive%inetpubwwwroot http *:80: net.tcp 808:* net.pipe * net.msmq localhost msmq.form
如果我在power shell中运行命令:

C:Get-Website

它输出

Name             ID   State      Physical Path                  Bindings
----             --   -----      -------------                  --------
Default Web Site 1               %SystemDrive%inetpubwwwroot  http *:80:
                                                                net.tcp 808:*
                                                                net.pipe *
                                                                net.msmq localhost
                                                                msmq.formatname 
                                                                localhost

但是,如果我尝试只选择绑定:

C:Get-Website | where {$_.Name -eq "Default Web Site"} | select Bindings

它返回:

bindings : Microsoft.IIs.PowerShell.Framework.ConfigurationElement

如何将此对象的内容提取为有用的格式?

解决方法

bindings属性是一个集合,因此您必须使用ExpandProperty参数:

Get-Website -Name "Default Web Site" | select -ExpandProperty Bindings

进一步向下钻取:

get-website -name "Default Web Site" | select -ExpandProperty Bindings | Select -ExpandProperty Collection

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读