# Extract the list of all servers on which OneAgent is installed

**URL:** <https://community.dynatrace.com/t/extract-the-list-of-all-servers-on-which-oneagent-is-installed/37947>\
**Category:** Dynatrace Managed\
**Tags:** dynatrace-managed, oneagent, hosts-classic\
**Created:** [January 10, 2023, 4:39pm UTC](https://community.dynatrace.com/t/extract-the-list-of-all-servers-on-which-oneagent-is-installed/37947 "2023-01-10T16:39:08Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![yvan\_dauby](https://avatars.discourse-cdn.com/v4/letter/y/e274bd/32.png) [@yvan\_dauby](https://community.dynatrace.com/u/yvan_dauby)\
**Post date:** [January 10, 2023, 4:39pm UTC](https://community.dynatrace.com/t/extract-the-list-of-all-servers-on-which-oneagent-is-installed/37947/1 "2023-01-10T16:39:08Z")

</div>

Hi,

Happy new year 😉

From the menu Dynatrace → Manage → Deployment status, I need to export the list of all servers on which OneAgent is installed, in csv or xls.

Thank you so much for your support and your great collaboration.

---

<div class="post-metadata">

**Author:** ![Yosi\_Neuman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/yosi_neuman/32/9845_2.png) [@Yosi\_Neuman](https://community.dynatrace.com/u/Yosi_Neuman)\
**Post date:** [January 10, 2023, 4:56pm UTC](https://community.dynatrace.com/t/extract-the-list-of-all-servers-on-which-oneagent-is-installed/37947/2 "2023-01-10T16:56:26Z")

</div>

Hi&nbsp;[@yvan\_dauby](https://community.dynatrace.com/user/34631)

Try the attached python code

run it with your environment url (without leading&nbsp; **https://** and trailing **/** ) as first parameter and token as the second parameter.

The token need to get access to v1&nbsp; **entity/infrastructure/hosts** and&nbsp; **entity/infrastructure/processes** apis

HTHYos&nbsp;  
[dt-execl.zip](https://community.dynatrace.com/uploads/short-url/tc9pq6uYzJhZf08aLIF5tEeRdnE.zip) (2.15 KB)

---

<div class="post-metadata">

**Author:** ![yvan\_dauby](https://avatars.discourse-cdn.com/v4/letter/y/e274bd/32.png) [@yvan\_dauby](https://community.dynatrace.com/u/yvan_dauby)\
**Post date:** [January 10, 2023, 5:35pm UTC](https://community.dynatrace.com/t/extract-the-list-of-all-servers-on-which-oneagent-is-installed/37947/3 "2023-01-10T17:35:30Z")

</div>

thank you so much Yos. I will test and i give you a feedback 😉

Have a good evening.

Yvan

---

<div class="post-metadata">

**Author:** ![yvan\_dauby](https://avatars.discourse-cdn.com/v4/letter/y/e274bd/32.png) [@yvan\_dauby](https://community.dynatrace.com/u/yvan_dauby)\
**Post date:** [January 24, 2023, 11:26am UTC](https://community.dynatrace.com/t/extract-the-list-of-all-servers-on-which-oneagent-is-installed/37947/4 "2023-01-24T11:26:41Z")

</div>

Hi Yosi,

i tried your script but can you send me the same script with the value ../api/v2/entities/…, i have a old version i think. I get 404 error for all requests 😞

Thank you so much for your great collaboration 😉

Kind regards.

Yvan

---

<div class="post-metadata">

**Author:** ![Yosi\_Neuman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/yosi_neuman/32/9845_2.png) [@Yosi\_Neuman](https://community.dynatrace.com/u/Yosi_Neuman)\
**Post date:** [January 24, 2023, 12:09pm UTC](https://community.dynatrace.com/t/extract-the-list-of-all-servers-on-which-oneagent-is-installed/37947/5 "2023-01-24T12:09:05Z")

</div>

Hi&nbsp;[@yvan\_dauby](https://community.dynatrace.com/user/34631)

IMO 404 is not an issue of v1 or v2 endpoints

Check if you are running the the py as follows: **py dt-execl.py&nbsp;{your-env-id}.live.dynatrace.com {token id}**

HTH

Yos

---

<div class="post-metadata">

**Author:** ![yvan\_dauby](https://avatars.discourse-cdn.com/v4/letter/y/e274bd/32.png) [@yvan\_dauby](https://community.dynatrace.com/u/yvan_dauby)\
**Post date:** [January 24, 2023, 4:09pm UTC](https://community.dynatrace.com/t/extract-the-list-of-all-servers-on-which-oneagent-is-installed/37947/6 "2023-01-24T16:09:27Z")

</div>

Hi Yos,

that’s works correctly. Thank you so much. You are the best. Your script is the real good job !

I would like to get the number of the&nbsp;Host units by server for manage the licensing. What’s the modification i must to implement from your script ? Thank you so much 😉

---

<div class="post-metadata">

**Author:** ![Yosi\_Neuman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/yosi_neuman/32/9845_2.png) [@Yosi\_Neuman](https://community.dynatrace.com/u/Yosi_Neuman)\
**Post date:** [January 24, 2023, 4:38pm UTC](https://community.dynatrace.com/t/extract-the-list-of-all-servers-on-which-oneagent-is-installed/37947/7 "2023-01-24T16:38:45Z")

</div>

You are more than welcome&nbsp;[@yvan\_dauby](https://community.dynatrace.com/user/34631)

For HU report we used&nbsp;[@Julius\_Loman](https://community.dynatrace.com/user/3364)&nbsp; [Dynatrace License Reporting Scripts](https://github.com/Alanata-a-s/Dynatrace-License-Reporting-Scripts)&nbsp;its working like a charm !

HTH

Yos

---

<div class="post-metadata">

**Author:** ![yvan\_dauby](https://avatars.discourse-cdn.com/v4/letter/y/e274bd/32.png) [@yvan\_dauby](https://community.dynatrace.com/u/yvan_dauby)\
**Post date:** [January 25, 2023, 6:59am UTC](https://community.dynatrace.com/t/extract-the-list-of-all-servers-on-which-oneagent-is-installed/37947/8 "2023-01-25T06:59:01Z")

</div>

thank you so much Yos.

I will try the script for the reporting licence. I’ll keep you in touch.

Have a nice day.

Yvan

---

<div class="post-metadata">

**Author:** ![SyedMsd](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@SyedMsd](https://community.dynatrace.com/u/SyedMsd)\
**Post date:** [February 16, 2025, 9:58pm UTC](https://community.dynatrace.com/t/extract-the-list-of-all-servers-on-which-oneagent-is-installed/37947/9 "2025-02-16T21:58:21Z")

</div>

Hi&nbsp;  
I am getting this error

py.exe : Traceback (most recent call last):  
At line:1 char:1  
+ py.exe .\dt-execl.py https://{environmentid}.live.dynatrace.com dt0c01.2AVJU …  
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
+ CategoryInfo : NotSpecified: (Traceback (most recent call last)::String) [], RemoteException  
+ FullyQualifiedErrorId : NativeCommandError

File “.\dt-execl.py”, line 2, in \<module\>  
import requests  
ModuleNotFoundError: No module named ‘requests’

---

<div class="post-metadata">

**Author:** ![AntonPineiro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antonpineiro/32/49_2.png) [@AntonPineiro](https://community.dynatrace.com/u/AntonPineiro)\
**Post date:** [February 17, 2025, 7:59am UTC](https://community.dynatrace.com/t/extract-the-list-of-all-servers-on-which-oneagent-is-installed/37947/10 "2025-02-17T07:59:55Z")

</div>

Hi,

Looks like are missing “requests” Python package installed.

Best regards

---

<div class="post-metadata">

**Author:** ![SyedMsd](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@SyedMsd](https://community.dynatrace.com/u/SyedMsd)\
**Post date:** [February 17, 2025, 12:12pm UTC](https://community.dynatrace.com/t/extract-the-list-of-all-servers-on-which-oneagent-is-installed/37947/11 "2025-02-17T12:12:04Z")

</div>

Hi

Am runinng from powershell.&nbsp; Could you pls clarify?

---

<div class="post-metadata">

**Author:** ![AntonPineiro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antonpineiro/32/49_2.png) [@AntonPineiro](https://community.dynatrace.com/u/AntonPineiro)\
**Post date:** [February 17, 2025, 12:20pm UTC](https://community.dynatrace.com/t/extract-the-list-of-all-servers-on-which-oneagent-is-installed/37947/12 "2025-02-17T12:20:30Z")

</div>

Hi,

Base on before messages, that is a python script, it means, you should have Python installed + requests module.

Best regards
