-
-
Save ChrisLGardner/3eb1096f140659c460f2a441423de3a2 to your computer and use it in GitHub Desktop.
Extract module dependency information from a script. **Note**: will show errors for commands not available on your system.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#requires -Module Reflection | |
function Find-Dependencies { | |
param($Path) | |
Get-ParseResults $Path | | |
Find-Token { $_ -is "System.Management.Automation.Language.CommandAst" } | | |
Get-Command -Name { $_.CommandElements[0].Value } -ea continue | # Errors will appear for commands you don't have available | |
Sort Source, Name | | |
Group Source | | |
Select @{N="Module";e={$_.Name}}, @{N="Used Commands";E={$_.Group}} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment