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).
11 lines
495 B
PowerShell
11 lines
495 B
PowerShell
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)`:"
|
|
Invoke-CMClientAction -DeviceName $Computer -ActionType ClientNotificationWakeUpClientNow
|
|
Pop-Location
|
|
} |