-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathPRTGAdminModule.psm1
638 lines (479 loc) · 22.1 KB
/
PRTGAdminModule.psm1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
######ignore invalid SSL Certs##########
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
######setup details, access related.
$auth = "username=api_access&passhash=1669687025"
$PRTGHost = "192.168.0.89"
##############################################
############Get-prtgSensorInGroup#############
##############################################
# will return ALL sensors listed in PRTG, for a given Group (via its ID) (limited to 2500)
#default is the root (ID=0)
#its important to remember that a "Group" is also a device, and probe etc.
#eg
#Get-prtgSensorInGroup 8011
function Get-prtgSensorInGroup([string]$StartingID=0)
{
$url = "http://$PRTGHost/api/table.xml?content=sensors&output=csvtable&columns=objid,probe,group,device,sensor,status,message,lastvalue,priority,favorite,tags&id=$StartingID&count=2500&$auth"
$request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore
convertFrom-csv $request -WarningAction SilentlyContinue
} # end function
##############################################
############Get-prtgDevicesInGroup####################
##############################################
# will return ALL Devices listed in PRTG, for a given Group (via its ID) (limited to 2500)
#default is the root (ID=0)
#if you want to find 1 device(ID=8011), then use: Get-prtgDevicesInGroup | where {$_.ID -eq 8011}
#anther example, seaching for an IP
#Get-prtgDevicesInGroup | where {$_.host -eq "10.81.8.36"}
#you may also want to return many devices, eg
#Get-prtgDevicesInGroup | where {$_.host -like "10.81.8.*"}
function Get-prtgDevicesInGroup ([string]$StartingID=0)
{
#if ($script:devicesCached -eq $false){
$url = "http://$PRTGHost/api/table.xml?content=devices&output=csvtable&columns=objid,probe,groupid,device,host,downsens,partialdownsens,downacksens,upsens,warnsens,pausedsens,unusualsens,undefinedsens,tags,comments&id=$StartingID&count=2500&$auth"
$request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore
$getprtgDeviceRet = convertFrom-csv ($request.content) -WarningAction SilentlyContinue
$getprtgDeviceRet
# write-host "got devices from website..."
# $script:devicesCached = $true
#}else{
# write-host "got groups from cache..."
# $getprtgDeviceRet
#}
} # end function
##############################################
############Get-prtgGroupsInGroup####################
##############################################
# will return ALL Groups listed in PRTG, for a given Group (via its ID) (limited to 2500)
#default is the root (ID=0)
#will will list all the group recurively under the listed group (ie, not JUST the children)
#eg, return al lthe groups in the local probe
# get-prtgGroupsInGroup 1
function get-prtgGroupsInGroup ([string]$StartingID=0)
{
$url = "http://$PRTGHost/api/table.xml?content=groups&output=csvtable&columns=objid,probe,group,name,downsens,partialdownsens,downacksens,upsens,warnsens,pausedsens,unusualsens,undefinedsens&count=2500&id=$StartingID&$auth"
$request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore
$getprtgGroupret = convertFrom-csv ($request) -WarningAction SilentlyContinue
#write-host "got groups from website..."
$getprtgGroupret
} # end function
##############################################
############Set-prtgDeviceProperty############
##############################################
# Sets a property of a device
function Set-prtgDeviceProperty ([string]$DeviceID,[string]$PropertyName,[string]$Value)
{
$url = "http://$PRTGHost/api/setobjectproperty.htm?id=$DeviceID&name=$PropertyName&value=$Value&$auth"
$request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore
} # end function
##############################################
############Get-prtgSensorChannels############
##############################################
function Get-prtgSensorChannels ([string]$SensorID)
{
#this does not retuen the channelID - rather important for somethings.
$url = "http://$PRTGHost/api/table.xml?content=channels&output=csvtable&columns=name,lastvalue_&id=$SensorID&$auth"
$request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore
convertFrom-csv ($request) -WarningAction SilentlyContinue
} # end function
function Get-prtgSensorChannelIDs ([string]$SensorID)
{
#this does retuen the channelID - but not the last value
$url = "http://$PRTGHost/controls/channeledit.htm?_hjax=true&id=$SensorID&$auth"
$request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore
$ret = $request.AllElements.FindByName("channel") | select -ExpandProperty outerText
$temp = ""|select ChannelID,ChannelName,LastValue
$rets = $ret -split "\)"
foreach ($ret3 in $rets)
{
$temp.ChannelName = $ret3 -split "ID"[0]
$temp.ChannelID = $ret3 -split "ID"[1]
$temp
}
} # end function
##############################################
##############Get-prtgSensorData##############
##############################################
function Get-prtgSensorData ([string]$SensorID,[datetime]$StartDate,[datetime]$EndDate)
{
$StartDate2 = get-date $StartDate -format "yyyy-MM-dd-hh-mm-ss"
$EndDate2 = get-date $EndDate -format "yyyy-MM-dd-hh-mm-ss"
#/api/historicdata.csv?id=objectid&avg=0&sdate=2016-01-20-00-00-00&edate=2016-01-21-00-00-00
$url = "http://$PRTGHost/api/historicdata.csv?id=$SensorID&avg=3600&sdate=$StartDate2&edate=$EndDate2&$auth"
#$url
$request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore
convertFrom-csv ($request) -WarningAction SilentlyContinue
} # end function
##############################################
#######Get-prtgSensorChannelPrediction########
##############################################
function Get-prtgSensorChannelPrediction ($SensorID,$ChannelName,$AgeOfFirstSampleInDays,$Limit,[bool]$Debug)
{
$NewDate = [DateTime]::Now.Subtract([TimeSpan]::FromDays($AgeOfFirstSampleInDays))
$NewDate = get-date $NewDate -format "yyyy-MM-dd hh:mm:ss"
if($debug){"Checking Historical Data from $NewDate"}
$ChannelNameRaw = $ChannelName + "(RAW)"
$OldData = [long](Get-prtgSensorData -SensorID $SensorID -StartDate $NewDate -EndDate $NewDate | where {$_.$ChannelNameRaw -like "*.*" } | select $ChannelNameRaw -first 1)."$ChannelNameRaw"
if($debug){"Historical Data equals $OldData"}
$CurrentDate = get-date -format "yyyy-MM-dd hh:mm:ss"
if($debug){"Current Date equals $CurrentDate"}
#I really have to change the line below to to use /10 but rather replace "0.","." - then test.
$NewData = [long](Get-prtgSensorChannels -SensorID $SensorID | where {$_.channel -eq "$ChannelName"} | select "Last Value(RAW)")."last value(RAW)" /10
if($debug){"Current Data equals $NewData"}
if($debug){"Limit equals equals $Limit"}
$r = 1
if($Limit -gt $NewData)
{ #eg, 100 percent
if($NewData -gt $OldData)
{ # its raising, eg disk space use is growing
#=(limit-newdata)/((newdata-olddata)/timeunits)
$ret = ($Limit-$NewData)/(($NewData-$OldData)/$AgeOfFirstSampleInDays)
}
else
{# eg, we are freeing space up! this is good
if($debug){"We will not hit the limit"}
$ret = 999
}
}
else
{ # its small, like zero
if($NewData -gt $OldData)
{ # eg, we are freeing space up! this is good
if($debug){"We will not hit the limit"}
$ret = 999
}
else
{# its falling, eg free disk space is gown down
#=new/((old-new)/timeunits)
$ret = $NewData / (($OldData-$NewData)/$AgeOfFirstSampleInDays)
}
}
if($debug){"Days Till Limit is reached equals $ret"}
[int]$ret = $ret
"" + $ret + ":OK"
} # end function
##############################################
############Get-prtgDeviceProperty############
##############################################
# Gets a property of a device
function Get-prtgDeviceProperty ([string]$DeviceID,[string]$PropertyName)
{
$url = "http://$PRTGHost/api/getobjectproperty.htm?id=$DeviceID&name=$PropertyName&$auth"
[xml]$request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore
$request.ChildNodes.result
} # end function
##############################################
############Add-prtgSensorToDevice############
##############################################
# add's a sensor to a device (good for updating templates- adding a new sensor to 100's of devices)
#eg add one sensor to a group of devices
#add-prtgSensorToDevice -SensorScriptBlock {Get-prtgSensorInGroup | where {$_.id -eq 8328}} -DevicesScriptBlock {Get-prtgDevicesInGroup 7633}
#eg, add sensor 5520 to device 6409
#add-prtgSensorToDevice -SensorScriptBlock {Get-prtgSensorInGroup | where {$_.id -eq 5520}} -DevicesScriptBlock {Get-prtgDevicesInGroup | where {$_.id -eq 6409}}
#eg add a pages_left sensor to all devices with a tag of "printer"
#TODO
function Add-prtgSensorToDevice
{
[CmdletBinding()]
param(
[Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$false)]
[scriptblock]$DevicesScriptBlock,
[Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$false)]
[scriptblock]$SensorScriptBlock
)
process
{
if ($SensorScriptBlock -ne $null -and $DevicesScriptBlock -ne $null)
{
##loop thru all the devices.
$Devices = &([scriptblock]::Create($DevicesScriptBlock))
foreach($Device in $Devices)
{
$DeviceID = $device.id
"DeviceID=$DeviceID"
##Loop thru all the sensors.
$Sensors = &([scriptblock]::Create($SensorScriptBlock))
foreach($Sensor in $Sensors)
{
$SensorID = $Sensor.id
"SensorID=$SensorID"
$NewName=$Sensor.Sensor
$url = "http://$PRTGHost/api/duplicateobject.htm?id=$SensorID&Targetid=$DeviceID&name=$NewName&$auth"
$url
$request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore
} # end foreach - Sensor
} # end foreach - Device
} # end if
} # end process
} # end function
##############################################
############Add-prtgSensorToDevice2###########
##############################################
# add's a sensor to a device (good for updating templates- adding a new sensor to 100's of devices)
#it also returns the ID's of what it added
#eg add one sensor to a group of devices
#add-prtgSensorToDevice -SensorScriptBlock {Get-prtgSensorInGroup | where {$_.id -eq 8328}} -DevicesScriptBlock {Get-prtgDevicesInGroup 7633}
#eg, add sensor 5520 to device 6409
#add-prtgSensorToDevice -SensorScriptBlock {Get-prtgSensorInGroup | where {$_.id -eq 5520}} -DevicesScriptBlock {Get-prtgDevicesInGroup | where {$_.id -eq 6409}}
#eg add a pages_left sensor to all devices with a tag of "printer"
#TODO
function Add-prtgSensorToDevice2
{
[CmdletBinding()]
param(
[Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$false)]
[scriptblock]$DevicesScriptBlock,
[Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$false)]
[scriptblock]$SensorScriptBlock
)
process
{
if ($SensorScriptBlock -ne $null -and $DevicesScriptBlock -ne $null)
{
##loop thru all the devices.
$Devices = &([scriptblock]::Create($DevicesScriptBlock))
foreach($Device in $Devices)
{
$DeviceID = $device.id
#"DeviceID=$DeviceID"
##Loop thru all the sensors.
$Sensors = &([scriptblock]::Create($SensorScriptBlock))
foreach($Sensor in $Sensors)
{
$SensorID = $Sensor.id
#"SensorID=$SensorID"
$NewName=$Sensor.Sensor
$url = "http://$PRTGHost/api/duplicateobject.htm?id=$SensorID&Targetid=$DeviceID&name=$NewName&$auth"
#$url
$request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore
write-output $request.headers.location.split("=")[1]
} # end foreach - Sensor
} # end foreach - Device
} # end if
} # end process
} # end function
##############################################
############Add-prtgDevice############
##############################################
# adds a new device in PRTG
#example
#Add-prtgDevice -NewIP "5.5.5.5" -TemplateID 5682 -DestGroupID 6408 -NewDeviceName "Hi_I_Am_New"
#example, import from CSV. where the fields are newip, TemplateID, DestGroupID, NewDeviceName
#Import-Csv -Delimiter "`t" -path c:\prtgimport.csv | Add-prtgDevice
function Add-prtgDevice
{
[CmdletBinding()]
param(
[Parameter(Mandatory=$True,ValueFromPipelineByPropertyName=$true)]
[string]$NewIP,
[Parameter(Mandatory=$True,ValueFromPipelineByPropertyName=$true)]
[string]$TemplateID,
[Parameter(Mandatory=$True,ValueFromPipelineByPropertyName=$true)]
[string]$DestGroupID,
[Parameter(Mandatory=$True,ValueFromPipelineByPropertyName=$true)]
[string]$NewDeviceName
)
Process
{
#$NeWIP = "2.2.2.2"
#$TemplateID = "5539"
#$DestGroupID = "5538"
#$NewDeviceName = "Server1"
"" + "adding sensor$NewIP"
#Duplicate the sensor (Server replies with a redirect to new objects webpage, e.g. /sensor.htm?id=10214, parse id 10214 from the URL):
$url = "http://$PRTGHost/api/duplicateobject.htm?id=$TemplateID&name=$NewDeviceName&targetid=$DestGroupID&$auth"
$request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore
$newID = $request.Headers.Location.Split("=")[1]
#add in the correct IP (host) the new sensor:
$url = "http://$PRTGHost/api/setobjectproperty.htm?id=$newID&name=host&value=$newIP&$auth"
$request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore
#Resume monitoring for the new sensor:
$url = "http://$PRTGHost/api/pause.htm?id=$newID&action=1&$auth"
$request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore
} #end process
} # end function
##############################################
#######Get-PRTGActiveAdvancedSchedule#########
##############################################
#looks in the comments for a given sensor, and grabs what is between the "{AdvancedSchedule}" and "{/AdvancedSchedule}" tags.
# eg:
#{AdvancedSchedule}
#Channel,Start,Stop,UpperWarn,UpperError,LowerWarn,LowerError
#0,07:00,12:30,1,2,3,4
#0,12:31,6:59,5,6,7,8
#{/AdvancedSchedule}
#
Function Get-PRTGActiveAdvancedSchedule{
param
(
$DeviceID
)
##get the comments
[string]$ret = Get-prtgDeviceProperty -DeviceID $DeviceID -PropertyName comments
#strip the headers
$q1 = $ret.IndexOf("{AdvancedSchedule}")
$q2 = $ret.IndexOf("{/AdvancedSchedule}")
$ret = $ret.Substring($q1+18,($q2-$q1)-18)
#$ret = $ret.Replace("{AdvancedSchedule}","")
#$ret = $ret.Replace("{/AdvancedSchedule}","")
#get rid of the blank lines
$ret2 = $ret -creplace '(?m)^\s*\r?\n',''
$ret3 = convertFrom-csv ($ret2)
#return just the active entries
$ret3 | where {$_.start -lt (get-date).TimeOfDay -and $_.stop -gt (get-date).TimeOfDay}
}
##############################################
###########Set-PRTGChannelSettings############
##############################################
#warning: this is not part of the standard API - and might be removed at any time.
#warning: this is really useful!
#this lets you update channel properties. To get a list of properties you can change you will
# need to examine the post data (using browser tools) when making changes to a channel via the PRTG web interface.
function Set-PRTGChannelSettings{
param(
$DeviceID,
$ChannelID,
$Property,
$Value
)
$url = "http://$PRTGHost/editsettings?$Property" + "_" + $ChannelID + "=" + "$value&id=$DeviceID&$auth"
#$url
$request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore
}
##############################################
###########Get-PRTGChannelSettings############
##############################################
#warning: this is not part of the standard API - and might be removed at any time.
#warning: this is really useful!
#this lets you update channel properties. To get a list of properties you can change you will
# need to examine the post data (using browser tools) when making changes to a channel via the PRTG web interface.
function Get-PRTGChannelSettings{
param(
$DeviceID,
$ChannelID
)
$url = "http://$PRTGHost/controls/channeledit.htm?_hjax=true&id=$DeviceID&channel=$ChannelID&$auth"
$request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore
$ret = $request.AllElements | select name,value | where {$_.name -like "*_*"}
foreach ($line in $ret)
{
$line.name = $line.name -replace "_$ChannelID",""
}
$ret
}
function Set-PRTGAdvancedSchedules{
$DeviceswithAdvancedSchedules = Get-prtgSensorInGroup | where {$_.Tags -like "*AdvancedSchedule*"}
Foreach ($Device in $DeviceswithAdvancedSchedules){
$Schedules = Get-PRTGActiveAdvancedSchedule -DeviceID $Device.ID
Foreach ($Schedule in $Schedules){
If ($Schedule.UpperError -ne ""){
Set-PRTGChannelSettings -DeviceID $Device.ID -ChannelID $Schedule.channel -Property limitmaxerror -Value $Schedule.UpperError
}
If ($Schedule.LowerError -ne ""){
Set-PRTGChannelSettings -DeviceID $Device.ID -ChannelID $Schedule.channel -Property limitminerror -Value $Schedule.LowerError
}
If ($Schedule.UpperWarn -ne ""){
Set-PRTGChannelSettings -DeviceID $Device.ID -ChannelID $Schedule.channel -Property limitmaxwarning -Value $Schedule.UpperWarn
}
If ($Schedule.LowerWarn -ne ""){
Set-PRTGChannelSettings -DeviceID $Device.ID -ChannelID $Schedule.channel -Property limitminwarning -Value $Schedule.LowerWarn
}
}
}
}
#example:
#Set-PRTGObjectPause -ObjectID 2003 -Minutes 5 -Message "Please Wait - Server Rebooting"
function Set-PRTGObjectPause{
param
(
$ObjectID,
$Message,
$Minutes
)
##ObjectID can be a sensor, device or Group
$url = "http://$PRTGHost/api/pauseobjectfor.htm?id=$ObjectID&duration=$minutes&pausemsg=$Message&$auth"
$request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore
}
##############################################
##############Set-PRTGObjectResume############
##############################################
####unpause!
function Set-PRTGObjectResume{
param
(
$ObjectID
)
#Resume monitoring for the new sensor:
$url = "http://$PRTGHost/api/pause.htm?id=$ObjectID&action=1&$auth"
$request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore
}
function Set-PRTGPauseThisServer{
param
(
$Message,
$Minutes
)
$myIPs = Get-NetIPAddress -AddressFamily IPv4 | where { $_.InterfaceAlias -notmatch 'Loopback'} |Select IPAddress
$t = "" | select ipaddress
$t.ipaddress = hostname
$myips += $t
$t = "" | select ipaddress
$t.ipaddress = "$env:computername.$env:userdnsdomain"
$myips += $t
#$myips
foreach ($ip in $MYIPs){
$q = Get-prtgDevicesInGroup | where {$_.host -eq $IP.ipaddress}
foreach ($x in $q){
Set-PRTGObjectPause -ObjectID $x.ID -Minutes $Minutes -Message "$Message"
}
}
}
function Set-PRTGResumeThisServer{
$myIPs = Get-NetIPAddress -AddressFamily IPv4 | where { $_.InterfaceAlias -notmatch 'Loopback'} |Select IPAddress
$t = "" | select ipaddress
$t.ipaddress = hostname
$myips += $t
$t = "" | select ipaddress
$t.ipaddress = "$env:computername.$env:userdnsdomain"
$myips += $t
#$myips
foreach ($ip in $MYIPs){
$q = Get-prtgDevicesInGroup | where {$_.host -eq $IP.ipaddress}
foreach ($x in $q){
$url = "http://$PRTGHost/api/pause.htm?id=" + $x.ID + "&action=1&$auth"
$request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore
}
}
}
function Get-PRTGChannelDetailExportForDevices
{
param
(
$ObjectID
)
$Devices = Get-prtgDevicesInGroup -StartingID $ObjectID
foreach ($Device in $Devices)
{
$Sensors = Get-prtgSensorInGroup -StartingID $Devices.id
Foreach ($Sensor in $Sensors)
{
$Channels = Get-prtgSensorChannels -SensorID $Sensor.id
Foreach ($Channel in $Channels)
{
$ret = Get-PRTGChannelSettings -DeviceID $Device.id -ChannelID $Channel.id
$ret
}
}
}
}