Issues with Published Script

Hi,

Sorry coming back for more help. Hope you don’t mind, but my python knowledge just isn’t up to trying to troubleshoot these issues. This monitor script below, seemed to be working for us before, but for some reason now it generates errors.

https://scripts.itarian.com/frontend/web/topic/generates-the-alert-if-any-software-uninstalledinstalled-or-updated

The errors we see are the following, please be aware that the script it running on windows 10 and 11 machines. The first error seems to be occurring on windows 11 machines and the second on windows 10 from time to time. I cut and pasted the script directly from the site into a new custom monitor. Strange thing in that it did seem to run a few months ago, but now doesn’t at all.

Would be grateful for any help on this, as it’s a script we’d really like to have working 100%.

Best Regards

Darren

Custom Script Monitor : Standard Output: - Error Output: Traceback (most recent call last):

  • File “”, line 45, in *
  • File “”, line 43, in programsinstalled*
  • File “”, line 28, in collectprograms*
    UnboundLocalError: local variable ‘oK’ referenced before assignment

and

Custom Script Monitor : Standard Output: - Error Output: File “”, line 116
print “Installed softwares are :”
^
IndentationError: unindent does not match any outer indentation level

1 Like

Hi @daz1971

Sorry for the delayed response. We have shared your issue with script developers to investigate and provide a solution.

Kind Regards,
PremJK

Hi @daz1971 ,

Please import this JSON file and provide your feedback
20221213_1_exported_procedures.json (6.1 KB)

Note: Indentation error mostly happens when you edit or paste the code.

Kind Regards,
PremJK

1 Like

Hi PremJK,

Again, thank you for coming back to me. I’ll try the json file you posted now and see how things go.

Best Regards.

Darren

Hi @PremJkumar

Sorry for asking, but is there anyway this script could be altered so it just alerts on new software installed and not alert on updated or uninstalled software?

Thanks Again for all your Help

Hi @daz1971 ,

Sure, it’s possible. We will request our script developers and provide you with a new script.

Kind Regards,
PremJK

Hi @PremJkumar

thank you again for this, very much appreciated once again.

Best Regards

Darren

Hi @daz1971 ,

Please try this script which will provide you an alert when new software is installed
https://scripts.itarian.com/frontend/web/topic/script-to-alert-if-any-new-software-installed

Kind Regards,
PremJK

1 Like

The “UnboundLocalError: local variable referenced before assignment” error occurs in Python when you try to access a local variable before it has been assigned a value. This is typically caused by a typo, or by using the same name for a local variable and a global variable in the same scope or when you forget to assign a value to a local variable before using it.

    x = x + 1
    print(x) // This code will result in the error

to solve this…

    x = 0 //assign a value to the local variable
    x = x + 1
    print(x)

To resolve the “UnboundLocalError: local variable referenced before assignment” error, you need to assign a value to the local variable before you use it. Another way to resolve this error is to use the global keyword to access the global variable with the same name.