Unfortunatelly I receive following error after running this task:
An error occurred when executing task 'Set-Certificate'.
Error: One or more errors occurred.
Object reference not set to an instance of an object.
This error is caused by Output_DataReady event - after AddSslCertificate command output.Count is greater than zero, but output.Read() returns null, which later turns into NullReferenceException during Debug.Log call at the end of the while loop. What's more interesting, this also causes PowerShell script to stop running.
After I've added another null check at outputItem, everything works properly and the end-result of the PowerShell script is visible in IIS.
Hello,
I tried to run a following PowerShell script (based on following code from Stack Overflow):
based on following task:
Unfortunatelly I receive following error after running this task:
This error is caused by
Output_DataReady
event - afterAddSslCertificate
commandoutput.Count
is greater than zero, butoutput.Read()
returns null, which later turns intoNullReferenceException
duringDebug.Log
call at the end of the while loop. What's more interesting, this also causes PowerShell script to stop running.After I've added another null check at
outputItem
, everything works properly and the end-result of the PowerShell script is visible in IIS.