16 Jan 2025 03:29 AM - edited 16 Jan 2025 05:12 AM
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.
Solved! Go to Solution.
16 Jan 2025 11:46 AM
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.'
"
16 Jan 2025 09:53 PM - edited 16 Jan 2025 09:54 PM
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.
16 Jan 2025 07:35 PM
Powershell is also notorious for downloading very slowly, even in high bandwidth connections...