Advertisement
stephanlinke

[PRTG] Clone Sensor and get new ID of cloned sensor

Jun 21st, 2016
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $Server            = "your-prtg"
  2. $Username          = "your-prtg-user"
  3. $Passhash          = "the-users-passhash"
  4. $SourceSensorId    = 5555        # The ID of the already configured sensor (as a template)
  5. $TargetDevice      = 5612
  6. $response = [System.Net.WebRequest]::Create("http://$Server/api/duplicateobject.htm?id=$SourceSensorId&name=Test&targetid=$TargetDevice&username=$username&passhash=$passhash").GetResponse();
  7. # extract the sensor id, every number with at least 4 digits counts as id
  8. $newSensorID = $response.ResponseUri.Query -match "(\d{4,})";
  9. $newSensorID = $matches[0];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement