diff --git a/Get-PC.psd1 b/Get-PC.psd1 index 982b823..30ebe88 100644 --- a/Get-PC.psd1 +++ b/Get-PC.psd1 @@ -51,7 +51,7 @@ Copyright = '(c) 2019 Chuck Beddow. All rights reserved.' # ProcessorArchitecture = '' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @('ConfigurationManager') +# RequiredModules = @() # Assemblies that must be loaded prior to importing this module # RequiredAssemblies = @() diff --git a/Get-PC.psm1 b/Get-PC.psm1 index 68eacb4..c41a632 100644 --- a/Get-PC.psm1 +++ b/Get-PC.psm1 @@ -18,3 +18,6 @@ ForEach ($folder in $functionFolders) } $publicFunctions = (Get-ChildItem -Path "$PSScriptRoot\Public" -Filter '*.ps1').BaseName Export-ModuleMember -Function $publicFunctions + +# Optional modules to import for certain functions +Import-Module ConfigurationManager # -Wake \ No newline at end of file diff --git a/Private/Invoke-Wake.ps1 b/Private/Invoke-Wake.ps1 index 0a618e9..be55e16 100644 --- a/Private/Invoke-Wake.ps1 +++ b/Private/Invoke-Wake.ps1 @@ -1,4 +1,8 @@ function Invoke-Wake($Computer) { + if (-not (Get-Module ConfigurationManager)) { + Write-Warning "ConfigurationManager module not available! Please install Configuration Manager Console to use this feature" + return + } Write-Host "Attemping to wake up $Computer, check in a few minutes" Push-Location Set-Location "$(Get-PSDrive -PSProvider CMSite)`:"