【发布时间】:2013-08-30 17:55:44
【问题描述】:
我很好奇是否有人可以描述如何通过绑定实例枚举可用的 ADSI 方法为[ADSI]$instance.psbase.Invoke()?
研究发现"refer to the docs for the ADSI interface"。但我对这个答案并不特别满意。
如果我实例化:
[ADSI]$lhost_group="WinNT://./Administrators,group"
然后尝试:
@($lhost_group.psbase.Invoke("Members")) | foreach-object {$_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)}
Powershell 将为组中包含的每个对象返回GetProperty("Name") 中的out。
如何枚举通过任何给定 ADSI 接口可用的所有可用方法和属性?
This answer from Shay Levy 是另一个使用[ADSI]$_.GetTypes().InvokeMember() 和[ADSI]$_.psbase.Invoke() 的语法示例。
【问题讨论】:
-
我想为这个问题添加我自己的赏金,但我不知道怎么做?
-
我不认为你可以增加额外的赏金。与聊天中人口最多的房间里的人核对一下(在顶部工具栏上)。
-
好的,我已经阅读了文档^^,必须等待赏金结束才能开始新的......太糟糕了
-
感谢 C.B. 非常有趣!
标签: powershell reflection syntax system.reflection