How to find PowerShell Static Classes and Methods?

后端 未结 4 405
忘掉有多难
忘掉有多难 2021-01-03 14:34

How can I find what Static Classes and Methods there is available in PowerShell 2.0?

4条回答
  •  甜味超标
    2021-01-03 15:15

    Mr driis, you are the man !!! Totally made my day !

    I just took the liberty to modify it a little bit so it returns the whole list without duplicates:

    PS C:\Users\Administrator> [AppDomain]::CurrentDomain.GetAssemblies() | foreach { $_.GetTypes() } | foreach { $_.GetMethods() } | where { $_.IsStatic } | select DeclaringType | Out-File assemblies.txt
    

    and then read the assemblies.txt file but only get unique rows :

    cat .\assemblies.txt Get-Unique
    

提交回复
热议问题