What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags

View all Tags

PRTG Management via shell / bash / ps




I would like to help my devops to create devices / sensors automatically:

  • Every time I create a VM in VCenter (Hyper-V, whatever), a script should get executed
  • This script connects to PRTG-Server, Clones existing (paused) device into a new Name / IP-Device
  • Unpauses this device and
  • Get the Object-ID of this new device into a field in VCenter / Hyper-V / whatever...

Is this possible - on which way? If not, is there basically a way to sent http-api-calls via powershell?


api devop powershell skript vcenter

Created on Sep 13, 2019 1:31:13 PM

Last change on Sep 13, 2019 6:06:59 PM by  Sven Roggenhofer [Paessler Technical Support]

1 Reply



I'm not sure whether vCenter and Hyper-V have the ability to perform custom actions on specific events, however I would recommend setting up a Scheduled Task to periodically run on some server (such as the PRTG Core); this will connect to both PRTG and vCenter, figure out which devices are missing from PRTG and then create those devices for you.

You can control vCenter and PRTG using PowerShell via the VMware PowerCLI and PrtgAPI

Connect-VIServer vcenter-1

    Connect-PrtgServer prtg.example.com (New-Credential username password)

$cloneSource = Get-Device -Id 1234

$vms = Get-VM
$devices = Get-Device | select -expand Name

$missingVMs = $vms | where { $_.Name -notin $devices }

foreach($vm in $missingVMs)
    Write-Host "Creating device for VM '$($vm.Name)'"
    $newDevice = $cloneSource | Clone-Object -DestinationId $cloneSource.ParentId $vm.Name
    $newDevice | Resume-Object
    $vm | Set-VM $vm -Notes "PRTG Device $($newDevice.Id)"

You would likely want to customize this a bit so that VMs that are stored in certain groups/have certain names etc are cloned from specific PRTG devices and then stored in custom groups, rather than storing all of your created devices under the parent of the clone source. Depending on your setup you may instead want to store your PRTG notes on the VM in a custom attribute / annotation, etc



Created on Sep 14, 2019 12:02:43 AM

Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.