lordmilko / PrtgAPI

C#/PowerShell interface for PRTG Network Monitor
MIT License
301 stars 37 forks source link

Attempted to write progress on an uninitialized ProgressRecord #274

Closed benclaussen1 closed 2 years ago

benclaussen1 commented 2 years ago

Describe the bug

While updating our deprecated DNS sensors, I was going to remove the old ones when I received this error:

PS C:\> $DNSSensors | ogv -pass | Remove-Object -Force
Remove-Object : Attempted to write progress on an uninitialized ProgressRecord. If this is a Release build, please
report this bug along with the cmdlet chain you tried to execute. To disable PrtgAPI Cmdlet Progress in the meantime
use Disable-PrtgProgress.
At line:1 char:27
+ $DNSSensors | ogv -pass | Remove-Object -Force
+                           ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Remove-Object], InvalidOperationException
    + FullyQualifiedErrorId : System.InvalidOperationException,PrtgAPI.PowerShell.Cmdlets.RemoveObject

After running Disable-PrtgProgress my pipeline executed successfully.

Steps to reproduce

# This is specific to my actions which led to this error:

# Get a list of sensors
$DNSSensors = Get-Sensor -Filter (New-SearchFilter -Property Type -Operator Contains  -Value 'dns')

$DNSSensors | ogv -pass | Remove-Object -Force

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

PSVersion      : 5.1.19041.1320
PSEdition      : Desktop
OS             : Microsoft Windows 10 Enterprise
PrtgAPIVersion : 0.9.17
Culture        : en-US
CLRVersion     : 528372
PrtgVersion    : 22.1.74.1869
PrtgLanguage   : english.lng

Additional context

No response

lordmilko commented 2 years ago

Hi @benclaussen1,

Please be advised a new pre-release version of PrtgAPI has now been released which should include a fix for this issue. Please see the manual installation instructions for details on how to run this pre-release version.

This issue specifically only occurs when executing a pipeline in the form Variable -> Third Party Cmdlet PrtgAPI doesn't have special handling for (e.g. Out-GridView) -> PrtgAPI Cmdlet, so depending on how you use PowerShell this issue may or may not have a big impact in day to day usage of PrtgAPI

Regards, lordmilko

benclaussen1 commented 2 years ago

Awesome! Thanks for the prompt fix! I’m out of town until next week but will install when I return.

Out-GridView isn’t an everyday thing for me and PRTG. I submitted the issue since the error requested so ☺️

Have a good day!

Ben

Sent from a mobile device...


From: lordmilko @.***> Sent: Thursday, March 3, 2022 01:59 To: lordmilko/PrtgAPI Cc: Ben Claussen; Mention Subject: Re: [lordmilko/PrtgAPI] Attempted to write progress on an uninitialized ProgressRecord (Issue #274)

Hi @benclaussen1https://github.com/benclaussen1,

Please be advised a new pre-release version of PrtgAPI has now been released which should include a fix for this issue. Please see the manualhttps://github.com/lordmilko/PrtgAPI/wiki/Installation#manual installation instructions for details on how to run this pre-release version.

This issue specifically only occurs when executing a pipeline in the form Variable -> Third Party Cmdlet PrtgAPI doesn't have special handling for (e.g. Out-GridView) -> PrtgAPI Cmdlet, so depending on how you use PowerShell this issue may or may not have a big impact in day to day usage of PrtgAPI

Regards, lordmilko

— Reply to this email directly, view it on GitHubhttps://github.com/lordmilko/PrtgAPI/issues/274#issuecomment-1057735897, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALE7XUOXZUEID2RLLFIRZN3U6BPL7ANCNFSM5PLJZYTA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.***>

benclaussen1 commented 2 years ago

Tested this morning... Working perfectly for me. Thanks!