I've recently learned of this script and am trying to get it setup to run as a scheduled task. However, before I do that, I need to address this issue, in which the module prompts for credentials (even after multiple, manual runs). After entering domain admin credentials, the following error is displayed to the host:
ConvertTo-SecureString : Key not valid for use in specified state.
At C:\...pathToScript...\vcheck\Plugins\43 Windows
vCenter Warning Event Logs.ps1:7 char:123
+ ... als.Password | ConvertTo-SecureString))
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [ConvertTo-SecureString], C
ryptographicException
+ FullyQualifiedErrorId : ImportSecureString_InvalidArgument_Cryptographic
Error,Microsoft.PowerShell.Commands.ConvertToSecureStringCommand
New-Object : Exception calling ".ctor" with "2" argument(s): "Cannot process
argument because the value of argument "password" is null. Change the value of
argument "password" to a non-null value."
At C:\...pathToScript...\vcheck\Plugins\43 Windows
vCenter Warning Event Logs.ps1:7 char:11
+ $creds = New-Object
System.Management.Automation.PsCredential($LoadedCredential ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvoca
tionException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.Power
Shell.Commands.NewObjectCommand
If I hit "Cancel" instead of entering credentials, the script continues. This is preventing the scheduled execution of vCheck, because no credential prompt is displayed and the script just waits.
How would I resolve this? Thanks.