Agent not getting installed on Windows VMs

Hello,

We have a situation with Windows Servers where the agent is not getting installed. (Also the agent PowerShell script is not present on C:\ drive)
Can you tell me on what stage the PowerShell script is getting downloaded on C:\ drive and then on what stage the script is triggered to install the agent ?
If I copy a script from a server where the agent got installed during the provision stage, I can successfully install the agent manually.
Any clue how to debug this ?

Thanks,
Augustin Farcas

Hi,

Assume you have unchecked the cloud-init option?
Regards,
Marcus

Hello,

Yes, cloud-init is unchecked and in some vlans the agent is installed and in other vlans the agent is not getting installed.
The network rules seems to be the same.
In any vlan where the agent is not installed, I am able to install the agent if I download manually the powershell script.
For vlans where the agent is getting installed, I can find the powershell scrit on C: drive.
For vlans where the agent is not getting installed, the script is not there.
And now I`m trying to see when the script gets downloaded on C: drive and from where.

Thanks,
Augustin Farcas

Hello Augustin

Is this a VMware Cloud that you are deploying? If so, can you confirm that the template has the option to automatically update VMware tools disabled?

Kind regards
Ümit

What is your agent install method and RPC mode on your clouds? Sounds like you are probably defaulting to WinRM, which you potentially have issues with WinRM connectivity to push the agent. The agent installs during finalize.

Hello,

With the same template everything is working OK in other clouds\vlans.
Only some specific clouds\vlans are affected.
Inside our template we have the latest version of vmware tools.
All network ports are open and we can install the agent manually after the VM is deployed.
We had a call with Morpheus support team and we send them all the logs for review.

Thanks,
Augustin

Hello guys,

We were able to fix the agent installation issue by creating a new task and add it in the provision phase of the VM:
SCRIPT:


$Morpheus_agent = get-service -Name “Morpheus Windows Agent” -errorAction Ignore

If($Morpheus_agent){
write-host “Morpheus agent is installed”
}

else {
$insf = “${env:commonprogramfiles(x86)}\install_morph_agent.ps1”

[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}

try {

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

}

Catch {}

$s = $false

$a = 0

Do {

try {

	(New-Object System.Net.WebClient).DownloadFile("https://YOUR_URL/api/server-script/agentInstall?apiKey=<%=server.apiKey%>", $insf)

	$s=$true

	break

} Catch {

	$a++

	Start-Sleep -s 10

}

} While ($a -lt 5)

if($s) {

echo "Success"

} else {

echo "Failed after 5 attempts"

exit 1	

}

try {

C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -File $insf	

}

Catch {

exit 1

}
}

Thanks

Your script insinuates that the agent is in your template and already on the machine, that should not be the case.

I connect to the VM via winrm with a predefined local account from the template, in the provisioning phase, right after the VM is powered ON.

Here I will download the PowerShell script to install the agent:

try {

(New-Object System.Net.WebClient).DownloadFile("https://YOUR_URL/api/server-script/agentInstall?apiKey=<%=server.apiKey%>", $insf)

$s=$true

break

} Catch {

$a++

Start-Sleep -s 10

}

Here I will install the agent via the downloaded script:

try {

C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -File $insf	

}

I did 50+ VMs and it is working as expected.