开发者

POWERSHELL; Recursive Get-Member for Com Object

开发者 https://www.devze.com 2022-12-30 05:42 出处:网络
I have a statement \"New-Object -com Indesign.Application.Cs5开发者_JAVA技巧| Get-Member\" It works as expected for the top level.

I have a statement "New-Object -com Indesign.Application.Cs5开发者_JAVA技巧 | Get-Member" It works as expected for the top level.

How would one recurse the entire object tree and output results in a readable/spreadsheet format (if possible).


The built-in way to do this is use Format-Custom like so:

Get-Process -id $pid | Format-Custom -Property * -Depth 4

If you want to recurse deeper I think you need to bump up the default value of $FormatEnumerationLimit (defaults to 4). Be careful though, I used to bump this to 100 and in certain cases when using fc, PowerShell would seem to hang. It was either caught in a cycle (probably not) or the operation was just going to take longer than I was willing to wait. BTW the short version of the above:

$FormatEnumerationLimit = 10
gps -id $pid | fc * -dep 10
0

精彩评论

暂无评论...
验证码 换一张
取 消