Get-FunctionUsage – PowerShell Code Dependency Analysis

While I was sifting through old PowerShell code to include in GEM Automation,  I found a script I wrote that allows you to find function dependencies in your PowerShell code. This is useful when you want to find things that might get broken by refactoring a certain function or module. It works by looking for modules and scripts in the specified path and then import the modules and their functions and look for those in all the PowerShell code in the specified path.

You can then import the resulting file in Excel for further/easier analysis:

Get-FunctionUsage_Excel

 

I haven’t tried visualizing the data with NodeXL yet, once I do I will update this post to give you an idea of what that looks like.

You can find the script here:

Get-FunctionUsage.ps1

This will be included in future releases of GEM Automation.

Enjoy!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s