Created
January 2, 2013 22:45
-
-
Save aggieben/4439001 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| Function Ensure-Module { | |
| Param([string]$name) | |
| if (-not (Get-Module -name $name)) { | |
| if (Get-Module -ListAvailable |? { $_.name -eq $name }) { | |
| Import-Module -Name $name | |
| $true #if available, then import | |
| } | |
| } else { | |
| $false #not loaded, not available | |
| } else { | |
| $true #already loaded | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment