No change to code but new errors

Tool: Visual Studio Code, PSScriptPad, PowerShell Module
Version: v5.29.4

Suddenly getting errors on parts of my code that were not recently changed.

Cursors.Default : The term ‘Cursors.Default’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At C:\BitBucket\ts_security\anti-phishing\TabbedForm.ps1:284 char:18

  • $Form1.Cursor = Cursors.Default;
  •                 ~~~~~~~~~~~~~~~
    • CategoryInfo : ObjectNotFound: (Cursors.Default:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

New-Object : Cannot find an overload for “PSCredential” and the argument count: “2”.
At C:\BitBucket\ts_security\anti-phishing\TabbedForm.ps1:297 char:34

  • … l:CredIDA = New-Object System.Management.Automation.PSCredential ($KP …
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidOperation: (:slight_smile: [New-Object], MethodException
    • FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

Confirmed this with the user of my app and then on my own system as well. PCs were recently patched so I suspect this is due to that but not sure what to look for or change.

The Cursors.Default is a little strange since that looks like some invalid syntax. You may be able to avoid that error by simply removing that line since the Cursors.Default is likely redundant. I don’t know why an update to anything would cause that issue.

As for the PSCredential issue, can you let me know how you are getting the user name and password for that pscredential? I’ve seen similar issues to this if the password isn’t a valid SecureString object and sometimes interacting with a password store stops working for some reason and this error can pop up.

Hi Adam, that password is being pulled via KeePass using the module PoshKeePass. This same code didn’t give that error before and we pull 3 credentials in the code the exact same way. From your earlier analysis you should still have the code to review that section if you want to look that over or I can email you if you need it. Thanks for responding as always your help is greatly appreciated.