Customer Key is missing
Problem 1:
During mass deployment (e.g., GPO) of the Cloudamize Windows agent, the installation completes. If the agent fails to register or becomes inactive, check the Cloudamize agent logs. Agents showing the error “Customer key is missing. Please reinstall Cloudamize Agent.” do not function correctly and cannot communicate with Cloudamize.
Solution: Update the customer key using the PowerShell script below by replacing the required values accordingly wherever needed and restarting the Cloudamize agent services.
PowerShell script
# ==========================================
# Purpose : Add the Cloudamize customer key
# to resolve the error:
# "Customer key is missing.
# Please reinstall Cloudamize Agent."
# Deployment : GPO
# Runs as : SYSTEM
# ==========================================
# Define the path to Property.xml file
$PropertyFile = "C:\ProgramData\CloudamizeAgent\VERSION\Property.xml"
# Define your Cloudamize customer key
# Replace this value with your actual key
$CustomerKey = "YOUR_CUSTOMER_KEY"
# Define the Cloudamize services to restart
$ServicesToRestart = @("Cloudamize Agent", "Cloudamize Watchdog")
# ============================================
# Step 1: Check if the Property.xml file exists
# ============================================
if (!(Test-Path $PropertyFile)) {
Write-Output "Property.xml file not found. Exiting."
exit 1
}
# =============================================
# Step 2: Load the XML content from Property.xml
# =============================================
[xml]$xml = Get-Content -Path $PropertyFile
# ===============================================
# Step 3: Locate the <customerkey> element in XML
# ===============================================
# $customerNode is a PowerShell variable that holds a reference to the <customerkey> XML element inside Property.xml.
$customerNode = $xml.SelectSingleNode("//customerkey")
# ============================================
# Step 4: Update the value attribute of <customerkey>
# ============================================
if ($customerNode -ne $null) {
# Set the "value" attribute to the new customer key
$customerNode.value = $CustomerKey
# Save the updated XML back to the same file
$xml.Save($PropertyFile)
Write-Output "Customer key updated in Property.xml successfully."
} else {
# Exit if <customerkey> element is not found
Write-Output "<customerkey> element not found in Property.xml."
exit 1
}
# ============================================
# Step 5: Restart Cloudamize services
# ============================================
foreach ($serviceName in $ServicesToRestart) {
# Check if the service exists
if (Get-Service -Name $serviceName -ErrorAction SilentlyContinue) {
# Restart the service forcefully
Restart-Service -Name $serviceName -Force
Write-Output "$serviceName restarted successfully."
} else {
# Output message if service not found
Write-Output "$serviceName service not found."
}
}
Puppet Manifest
# -------------------------------------------------------------------
# Puppet manifest to fix:
# "Customer key is missing. Please reinstall Cloudamize Agent."
#
# This script:
# 1. Locates the Property.xml file
# 2. Updates the <customerkey> value
# 3. Restarts Cloudamize Agent services
# -------------------------------------------------------------------
# -----------------------------
# VARIABLES
# -----------------------------
# Cloudamize Agent version directory
# Replace 'VERSION' with the actual installed version if required
$cloudamize_version = 'VERSION'
# Customer key to be updated in Property.xml
# Replace with the actual Cloudamize customer key
$customer_key = 'customerkey'
# Full path to the Property.xml file
$property_file = "C:/ProgramData/CloudamizeAgent/${cloudamize_version}/Property.xml"
# -----------------------------
# FILE VALIDATION
# -----------------------------
# Ensure the Property.xml file exists on the system
# Puppet will not modify the file content here,
# only ensure that the file is present
file { $property_file:
ensure => file,
}
# -----------------------------
# UPDATE CUSTOMER KEY
# -----------------------------
# Use PowerShell to update the <customerkey> value in Property.xml
# - Reads the file content
# - Replaces the existing customerkey value
# - Writes the updated content back to the same file
exec { 'update_cloudamize_customer_key':
command => "powershell.exe -Command \"(Get-Content '${property_file}') -replace '<customerkey value=.*?/>', '<customerkey value=\\\"${customer_key}\\\"/>' | Set-Content '${property_file}'\"",
# Run only if the customerkey tag exists in the file
onlyif => "powershell.exe -Command \"Select-String -Path '${property_file}' -Pattern '<customerkey value=.*?/>'\"",
# Ensure the file exists before attempting modification
require => File[$property_file],
}
# -----------------------------
# SERVICE RESTARTS
# -----------------------------
# Restart and ensure the Cloudamize Agent service is running
# The service will refresh automatically if the customer key is updated
service { 'Cloudamize Agent':
ensure => running,
enable => true,
subscribe => Exec['update_cloudamize_customer_key'],
}
# Restart and ensure the Cloudamize Watchdog service is running
# This ensures the agent stays active after configuration change
service { 'Cloudamize Watchdog':
ensure => running,
enable => true,
subscribe => Exec['update_cloudamize_customer_key'],
}
Chef Recipe
# ------------------------------------------------------------
# Chef recipe to fix:
# "Customer key is missing. Please reinstall Cloudamize Agent."
#
# This recipe:
# 1. Locates the Property.xml file
# 2. Updates the <customerkey> value
# 3. Restarts Cloudamize Agent services
# ------------------------------------------------------------
# -----------------------------
# VARIABLES
# -----------------------------
# Cloudamize Agent version directory
cloudamize_version = 'VERSION'
# Cloudamize customer key
# Replace with the actual customer key
customer_key = 'customerkey'
# Full path to Property.xml
property_file = "C:/ProgramData/CloudamizeAgent/#{cloudamize_version}/Property.xml"
# -----------------------------
# FILE VALIDATION
# -----------------------------
# Ensure Property.xml exists before attempting any changes
# This does not modify the file content
file property_file do
action :nothing
end
# -----------------------------
# UPDATE CUSTOMER KEY
# -----------------------------
# Use PowerShell to update the <customerkey> value inside Property.xml
# - Reads the file
# - Replaces the existing customerkey value
# - Writes the updated content back to the same file
execute 'update_cloudamize_customer_key' do
command <<-EOH
powershell.exe -Command "(Get-Content '#{property_file}') `
-replace '<customerkey value=.*?/>', '<customerkey value=\\"#{customer_key}\\"/>' |
Set-Content '#{property_file}'"
EOH
# Run only if the customerkey tag exists in the file
only_if "powershell.exe -Command \"Select-String -Path '#{property_file}' -Pattern '<customerkey value=.*?/>'\""
# Notify services to restart only if the file is modified
notifies :restart, 'service[Cloudamize Agent]', :immediately
notifies :restart, 'service[Cloudamize Watchdog]', :immediately
end
Problem 2:
When manually installing the Cloudamize agent on a Windows system, if the agent fails to register or becomes inactive, check the Cloudamize agent logs. If the log files show the error “Customer key is missing. Please reinstall Cloudamize Agent.” this indicates the customer key was not applied or recognized during installation, preventing agent registration.
Solution: Locate the Property.xml file at the location below on the server that is showing as inactive, update the customer key, and restart the services listed below.1-> C:\ProgramData\CloudamizeAgent\VERSION\Property.xml
2-> Update <customerkey value="customerkey"/>
3-> Restart agent services (Cloudamize Agent, Cloudamize Watchdog)
If you need any further assistance or support, please contact helpdesk@cloudamize.com for further assistance.