Updated module dependencies
To enable the Wake flag, we need ConfigurationManager module. This was in the module manifest in Required Modules, however get-pc is functional without ConfigurationManager so it didn't make sense for get-pc to fail importing if ConfigurationManager wasn't present. Removing it from Required Modules and importing it at the bottom of Get-PC.psm1 allows the import to fail silently and the lost functionality isn't reported until user attempts to use the Wake flag (which is a good thing).
This commit is contained in:
parent
be0294c5ef
commit
c2cf5674f8
|
|
@ -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 = @()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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)`:"
|
||||
|
|
|
|||
Loading…
Reference in a new issue