Installing and Configuring Anyware Manager as a Service Idle Shutdown
The following section outlines how to install and configure idle shutdown on remote workstations not provisioned by Anyware Manager as a Service on Windows and Linux.
Any remote workstations provisioned by Anyware Manager as a Service has this feature installed and configured by default. If idle shutdown has been installed and configured on remote workstations that were not provisioned by Anyware Manager as a Service and are not managed by Anyware Manager as a Service, then the administrator may be required to log into their cloud environment to reboot these remote workstations whenever the idle shutdown powers them off.
This setting may not suit all customers' needs and can be customized to suit.
Service Account and Access Prerequisites
Powering the remote workstation on or off from the Anyware Manager as a Service at session start, or from the web interface, requires that the remote workstation exists in a cloud environment with appropriate service account credentials that supports power management with Anyware Manager as a Service.
Installing on Windows¶
After installing the PCoIP Agent, run the following commands in PowerShell:
$idleTimerRegKeyValue = <idle-time-in-minutes>
$enableAutoShutdown = <$true-or-$false>
# Detect agent type
$is64 = $false
$serviceName = "CAMIdleShutdown"
$path = "C:\Program Files (x86)\Teradici\PCoIP Agent\bin"
if (!(Test-Path -path $path)) {
$path = "C:\Program Files\Teradici\PCoIP Agent\bin"
$is64 = $true
}
cd $path
# Install Service
$ret = .\IdleShutdownAgent.exe -install
# Check for success
if( !$? ) {
$msg = "Failed to install {0} because: {1}" -f $serviceName, $ret
Write-Host $msg
throw $msg
}
# Configure Service
$idleTimerRegKeyPath = "HKLM:SOFTWARE\WOW6432Node\Teradici\CAMShutdownIdleMachineAgent"
if ($is64) {
$idleTimerRegKeyPath = "HKLM:SOFTWARE\Teradici\CAMShutdownIdleMachineAgent"
}
$idleTimerRegKeyName = "MinutesIdleBeforeShutdown"
if (!(Test-Path $idleTimerRegKeyPath)) {
New-Item -Path $idleTimerRegKeyPath -Force
}
New-ItemProperty -Path $idleTimerRegKeyPath -Name $idleTimerRegKeyName -Value $idleTimerRegKeyValue -PropertyType DWORD -Force
# Disable service if desired
$svc = Get-Service -Name $serviceName
if (!$enableAutoShutdown) {
$msg = "Attempting to disable {0} service" -f $serviceName
Write-Host $msg
try {
if ($svc.Status -ne "Stopped") {
Start-Sleep -s 15
$svc.Stop()
$svc.WaitForStatus("Stopped", 180)
}
Set-Service -InputObject $svc -StartupType "Disabled"
$status = if ($?) { "succeeded" } else { "failed" }
$msg = "Disabling {0} service {1}" -f $svc.ServiceName, $status
Write-Host $msg
}
catch {
throw "Failed to disable CAMIdleShutdown service."
}
}
Configuring on Windows¶
For the PCoIP Agent for Windows the settings must be retrieved from the registry. The following steps outline how to configure these settings for Windows:
-
For PCoIP Agent versions 2.15 and earlier, the settings are stored in:
HKLM\SOFTWARE\WOW6432Node\Teradici\CAMShutdownIdleMachineAgent
PCoIP Agent version 19.05 and later, the settings are stored in:HKLM\SOFTWARE\Teradici\CAMShutdownIdleMachineAgent
PCoIP Agent Versions
PCoIP Agent versions 2.15 and earlier are 32-bit, and versions 19.05 and later are 64-bit.
The table below outlines the settings and defaults:
Type | Name | Default | Description |
---|---|---|---|
DWORD | PollingIntervalMinutes | 15 minutes | Polling interval in minutes for checking the CPU utilization. Must be between 1 and 60. |
DWORD | MinutesIdleBeforeShutdown | 240 minutes | Number of minutes the machine must be considered idle before it can be shutdown. The timer starts only when all active users have disconnected (or logged off), and is reset if any user connects. Must be between 5 and 10000. |
DWORD | CPUUtilizationLimit | 20% | Value between 0 and 100 representing CPU utilization percentage. If CPU utilization is below this value the machine is considered idle and shutsdown if maintained for MinutesIdleBeforeShutdown. |
DWORD | EnableCAMDebug | 0 | Additional debugging messages to the event log when this value is non-zero. |
- After installation the service is enabled by default. To enable or disable the service explicitly, run:
or
Set-Service CAMIdleShutdown -StartupType "Automatic"
Set-Service CAMIdleShutdown -StartupType "Disabled"
- MinutesIdleBeforeShutdown can be configured through the Microsoft Azure ARM provisioning template as the autoShutdownIdleTime setting in the parameters file. Once the autoShutdownIdleTime setting is installed on a remote workstation, you can configure the setting by pushing the desired registry key settings directly to the specific remote workstation.
Installing on Linux¶
After installing the PCoIP Agent, run the following commands in the command line:
AUTO_SHUTDOWN_IDLE_TIMER=<Desired-Idle-Time>
ENABLE_AUTO_SHUTDOWN=<true-or-false>
mkdir /tmp/idleShutdown
wget "https://raw.githubusercontent.com/HPInc/Anyware-Idle-Shutdown/master/remote-workstations/new-agent-vm/Install-Idle-Shutdown.sh
awk '{ sub("\r$", ""); print }' /tmp/idleShutdown/Install-Idle-Shutdown-raw.sh > /tmp/idleShutdown/Install-Idle-Shutdown.sh && sudo chmod +x /tmp/idleShutdown/Install-Idle-Shutdown.sh
INSTALL_OPTS="--idle-timer ${AUTO_SHUTDOWN_IDLE_TIMER}"
if [[ "${ENABLE_AUTO_SHUTDOWN}" = "false" ]]; then
INSTALL_OPTS="${INSTALL_OPTS} --disabled"
fi
sudo /tmp/idleShutdown/Install-Idle-Shutdown.sh "${INSTALL_OPTS}"
Configuring on Linux¶
For the PCoIP Agent for Linux, the idle shutdown is configured through a system service and can be configured through the accompanying service and timer .conf and files.
The table below outlines the settings and defaults:
Location | Setting | Default | Description |
---|---|---|---|
/etc/systemd/system/CAMIdleShutdown.service.d/CAMIdleShutdown.conf | MinutesIdleBeforeShutdown | 240 minutes | Number of minutes the machine must be considered idle before it can be shutdown. The timer starts only when all active users have disconnected (or logged off), and is reset if any user connects. NOTE: This includes SSH sessions. |
/etc/systemd/system/CAMIdleShutdown.service.d/CAMIdleShutdown.conf | CPUUtilizationLimit | 20% | Value between 0 and 100 representing CPU utilization percentage. If average CPU utilization is below this value the machine is considered idle and shutsdown if maintained for MinutesIdleBeforeShutdown. |
/etc/systemd/system/CAMIdleShutdown.timer.d/CAMIdleShutdown.conf | OnUnitActiveSec | 15 minutes | Polling interval in minutes for checking the CPU utilization. |
- To apply any changes, you need to run the following command:
systemctl daemon-reload
- After installation the service is enabled by default. To enable or disable the service explicitly, run:
or
systemctl enable CAMIdleShutdown.timer systemctl start CAMIdleShutdown.service systemctl start CAMIdleShutdown.timer
systemctl stop CAMIdleShutdown.service systemctl stop CAMIdleShutdown.timer systemctl disable CAMIdleShutdown.timer
- MinutesIdleBeforeShutdown can be configured through the Microsoft Azure ARM provisioning template as the autoShutdownIdleTime setting in the parameters file. Once the autoShutdownIdleTime setting is installed on a remote workstation, you can configure the setting by pushing the desired registry key settings directly to the specific remote workstation.