我可能沒有一個準確的標題這個問題,但我只是在學習PowerShell,我現在很困惑。我有以下的情況再加上我想知道如何通過.NET函數看(在這個問題結束)例如,我有:獲取成員和在Powershell中通過.Net導航
System.DirectoryServices.DirectoryEntry
我設置爲一個變量,像這樣:
$test = new-object System.DirectoryServices.DirectoryEntry
如果我想這樣做的方法,我做的:
這將返回許多不同的名稱和membertypes但我只想membertype method
,但如果我這樣做:
$test | gm -membertype method
我沒有得到任何結果。不過,如果我做
$test.get_children()
它會列出不同的名稱和路徑...... 所以我的問題是爲什麼,如果這是一個方法,現在顯示出來,當我撥打GM -membertype method
?
而且,如果我做
,$test.get_children() | gm
我獲得各種不同的方法,但如果我這樣做
$test.get_children() | gm
我什麼也得不到,但properties
爲何不顯示的方法呢?我還應該注意到我無法使用任何Membertype方法,$test.get_childre() | gm
這對我來說沒有多大意義。有人可以解釋這一點,以及如何確定我可以用特定的.NET功能做什麼。另一個這樣的例子是:
$domain = [System.DirecotryServices.ActiveDirectory.Domain]
我如何可以導航通過這個?所以我想象我應該做System。 - >看看什麼是可用的,並挑選的DirectoryServices - >,看看是可用的編緝從那裏
[system.directoryservices.activedirectory.domain] | gm – 2013-05-03 17:26:25
我想你看到的另一件事是由於適配器([adsi])powershell對該類的影響。如果你做$ test.psbase |你會看到你正在尋找的結果。 – 2013-05-03 17:27:41