Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behavior with Get-ObjectLog #263

Open
Silex opened this issue Jan 24, 2022 · 1 comment
Open

Unexpected behavior with Get-ObjectLog #263

Silex opened this issue Jan 24, 2022 · 1 comment
Labels
enhancement Items that are on the todo list for incorporating into PrtgAPI in a future release

Comments

@Silex
Copy link

Silex commented Jan 24, 2022

Describe the bug

This fails:

PS C:\Users\Philippe Vaucher> Get-ObjectLog -Id 2759 -Period Yesterday
Get-ObjectLog : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Get-ObjectLog -Id 2759 -Period Yesterday
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-ObjectLog], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,PrtgAPI.PowerShell.Cmdlets.GetObjectLog

This works:

PS C:\Users\Philippe Vaucher> Get-Sensor -Id 2759 | Get-ObjectLog -Period Yesterday

It's not that big of a deal but I was surprised.

What is the output of 'Get-PrtgClient -Diagnostic'?

PrtgApi 0.9.16 with latest PRTG installation.

Additional context

No response

@Silex Silex added the alleged-bug Bugs raised by people helpfully using the Bug Report template! label Jan 24, 2022
@Silex Silex changed the title Unespected behavior with Get-ObjectLog Unexpected behavior with Get-ObjectLog Jan 24, 2022
@lordmilko lordmilko added question Questions raised by people who don't know how to program or read the wiki :P enhancement Items that are on the todo list for incorporating into PrtgAPI in a future release and removed alleged-bug Bugs raised by people helpfully using the Bug Report template! question Questions raised by people who don't know how to program or read the wiki :P labels Jan 24, 2022
@lordmilko
Copy link
Owner

lordmilko commented Jan 24, 2022

Hi @Silex,

This behavior is intentional, as when I was implementing this I found there was no way to have a parameter set that allows specifying an -Id and -Period that doesn't also cause the PowerShell engine to have issues identifying which parameter set to use when attempting to bind an -Id by itself (which should map to a parameter set with an optional -StartDate and -EndDate)

Having another look at this today, I found a potential way I may be able to resolve this, so I will mark this as a potential Enhancement for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Items that are on the todo list for incorporating into PrtgAPI in a future release
Projects
None yet
Development

No branches or pull requests

2 participants