cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dynatrace professional practical certification exam powershell issue

NickMcEwen
Frequent Guest

Hello all, 

 

I recently sat the DT professional practical exam one thing I didnt expect was how much trouble I would have with the powershell install and I regret not familiarising myself with the install of oneagent via Powershell commands.

I am more familiar with Linux install and didnt think PS would be an issue, as the command would just work .....right? Actually I was so wrong as copying and pasting the command provided once I generated the token in the DT managed environment gave me the command per usual: 

 

 

powershell -command “$ProgressPreference = ‘SilentlyContinue’; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri https://{environmentid}.live.dynatrace.com/api/v1/deployment/installer/agent/windows/default/latest?arch=x86’ -Headers @{ ‘Authorization’ = ‘Api-Token dt0c01.xxxxxxxxxxx’ } -OutFile ‘Dynatrace-OneAgent-Windows-1.303.62.20241129-131342.exe’”

 

 

 

The problem is that when I ran the command in the windows box provided in the exam I received no file and just the next command prompt with no progress. I ended up just manually installing the .exe file 
I checked the version of PS and the TLS1.2 and these are in line with the recommended versions

Has anyone else seen this or know why this happens?

 

Example below shows no output, running as Administrator makes no difference.

NickMcEwen_0-1737000813580.png

 

3 REPLIES 3

SerkanYALCINER
Observer

Hello

Ensure that the {environmentid} is replaced with the correct value.
Test the URL directly in a browser or using a tool like curl or Postman to verify that it works and downloads the file.
Check if there are any network restrictions (firewall, proxy, etc.) blocking the request.

Use Test-NetConnection to confirm that the machine can reach the Dynatrace server.
Test-NetConnection -ComputerName "{environmentid}.live.dynatrace.com" -Port 443

Try it like this:
powershell -command "
$ProgressPreference = 'SilentlyContinue';
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
Invoke-RestMethod -Uri 'https://{environmentid}.live.dynatrace.com/api/v1/deployment/installer/agent/windows/default/latest?arch=x86' -Headers @{ 'Authorization' = 'Api-Token dt0c01.xxxxxxxxxxx' } -OutFile 'Dynatrace-OneAgent-Windows.exe';
Write-Host 'Download completed.'
"

Thanks Serkan for your reply. 

I launched my own windows 2019 server and tested the command you suggested with the Invoke-Restmethod -Uri example: 

powershell -command "
$ProgressPreference = 'SilentlyContinue';
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
Invoke-RestMethod -Uri

OR 

Invoke-WebRequest -Uri

This unfortunately yielded the same result I had before with no output not even the Write-Host 'Download Completed' it just had no output and after 2 seconds went back to the 'PS C:\users\Adminstrator>' prompt. 

I looked into the issue with some colleagues and we found the problem was with the variable $ProgressPreference = 'SilentlyContinue'; I removed this and the file successfully downloaded. 

 

powershell -command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-RestMethod -Uri 'https://.... -OutFile 'Dynatrace-OneAgent-Windows.exe'; Write-Host 'Download Completed'"

 

 
I also tested with setting the variable below and this also successfully downloaded the one agent file. 

 

Set-Variable ProgressPreference 'SilentlyContinue'; powershell -command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri 'https://... -OutFile 'Dynatrace-OneAgent-Windows.exe'; Write-Host 'Download Completed'" 

 

 
Thanks for your help with this issue. 

AntonioSousa
DynaMight Guru
DynaMight Guru

Powershell is also notorious for downloading very slowly, even in high bandwidth connections...

Antonio Sousa

Featured Posts