You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to set schedules for remote probes but running into an issue with the API. I've tried running the below command in PowerShell which returns as successful but I don't see that the probe settings have updated accordingly.
Get-Probe -id 17834 | Set-ObjectProperty -RawParameters @{ "scheduledependency" = 0 "schedule" = Get-PrtgSchedule "7 Days a week - 7 AM - 9 AM" } -Force
I've also tried to set this without using the RawParamters method since Schedule shows as a property when queried with Get-ObjectProperty but I get the below error when I try.
I can work around this by applying the schedule at the device level if needed but was hoping to set this at the probe level. Is there any way to do this?
Thanks in advance.
The text was updated successfully, but these errors were encountered:
lordmilko
added
the
question
Questions raised by people who don't know how to program or read the wiki :P
label
Aug 9, 2019
PrtgAPI does not currently natively support modifying settings under the Schedules, Dependencies and Maintenance Window section of PRTG as PRTG requires that all of the properties under this section be re-specified when submitting a request. If you submit a request without specifying certain properties, those properties will divert back to their default values.
This is unexpected behavior, and as such by requiring you use RawParameters in order to do this, it's not my fault if you mess up your system!
Your issue appears to be you are not using the correct raw parameters for modifying the schedule of an object. the schedule property should end in an underscore
Get-Probe-id 17834|Set-ObjectProperty-RawParameters @{ "scheduledependency"=0; "schedule_"=Get-PrtgSchedule"7 Days a week - 7 AM - 9 AM" } -Force
You can get a more detailed overview of the properties you can manipulate with on general objects with PrtgAPI by doing Get-Help ObjectSettings. As you will see, all of the schedule and dependency properties are listed as get-only (and in fact can only be retrieved by doing $object | Get-ObjectProperty)
Hello,
I am trying to set schedules for remote probes but running into an issue with the API. I've tried running the below command in PowerShell which returns as successful but I don't see that the probe settings have updated accordingly.
Get-Probe -id 17834 | Set-ObjectProperty -RawParameters @{ "scheduledependency" = 0 "schedule" = Get-PrtgSchedule "7 Days a week - 7 AM - 9 AM" } -Force
I've also tried to set this without using the RawParamters method since Schedule shows as a property when queried with Get-ObjectProperty but I get the below error when I try.
Get-Probe -id 17834 | Set-ObjectProperty Schedule 4910 Set-ObjectProperty : Cannot bind parameter 'Property'. Cannot convert value "Schedule" to type "PrtgAPI.ObjectProperty". Error: "Unable to match the identifier name Schedule to a valid enumerator name. Specify one of the following enumerator names and try again: Active, InheritLocation, Location, LocationName, InheritWindowsCredentials, WindowsDomain, WindowsUserName, WindowsPassword, InheritLinuxCredentials, LinuxUserName, LinuxLoginMode, LinuxPassword, LinuxPrivateKey, WbemProtocolMode, WbemPortMode, WbemPort, SSHPort, SSHElevationMode, SSHElevationSuUser, SSHElevationSudoUser, SSHElevationPassword, SSHEngine, InheritVMwareCredentials, VMwareUserName, VMwarePassword, VMwareProtocol, VMwareSessionMode, InheritSNMPCredentials, SNMPVersion, SNMPCommunityStringV1, SNMPCommunityStringV2, SNMPv3AuthType, SNMPv3UserName, SNMPv3Password, SNMPv3EncryptionType, SNMPv3EncryptionKey, SNMPv3Context, SNMPPort, SNMPTimeout, InheritDBCredentials, DBPortMode, DBPort, DBAuthMode, DBUserName, DBPassword, DBTimeout, InheritAmazonCredentials, AmazonAccessKey, AmazonSecretKey, InheritWindowsCompatibility, WmiDataSource, WmiTimeoutMethod, WmiTimeout, InheritSNMPCompatibility, SNMPDelay, SNMPRetryMode, SNMPOverflowMode, SNMPZeroValueMode, SNMPCounterMode, SNMPRequestMode, SNMPPortNameTemplate, SNMPPortNameUpdateMode, SNMPPortIdMode, SNMPInterfaceStartIndex, SNMPInterfaceEndIndex, InheritChannelUnit, BandwidthVolumeUnit, BandwidthSpeedUnit, BandwidthTimeUnit, MemoryUsageUnit, DiskSizeUnit, FileSizeUnit, InheritAccess, Name, Tags, Priority, DebugMode, Url, HttpRequestMethod, PostData, UseCustomPostContent, PostContentType, UseSNIFromUrl, InheritProxy, ProxyAddress, ProxyPort, ProxyUser, ProxyPassword, Timeout, PingPacketSize, PingMode, PingCount, PingDelay, AutoAcknowledge, InheritInterval, Interval, IntervalErrorMode, GraphType, ExeFile, ExeParameters, SetExeEnvironmentVariables, UseWindowsAuthentication, Mutex, WmiMode, Target, PingRemotePacketSize, ChannelDefinition, FactoryErrorMode, FactoryErrorFormula, FactoryMissingDataMode, StartStopped, NotifyChanged, MonitorPerformance, Database, UseCustomInstance, InstanceName, SqlEncryptionMode, SqlServerQuery, UseSqlInputParameter, SqlInputParameter, SqlTransactionMode, SqlProcessingMode, InheritTriggers, Comments, Host, Hostv4, Hostv6, ServiceUrl, AutoDiscoveryMode, AutoDiscoverySchedule" At line:1 char:42 + Get-Probe -id 17834 | Set-ObjectProperty Schedule 4910 + ~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Set-ObjectProperty], ParameterBindingException + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,PrtgAPI.PowerShell.Cmdlets.SetObjectProperty
I can work around this by applying the schedule at the device level if needed but was hoping to set this at the probe level. Is there any way to do this?
Thanks in advance.
The text was updated successfully, but these errors were encountered: