Error with variables and credentials

Product: PowerShell Universal
Version: 2.9.2

Hi,

I got this weird error since yesterday and I have no clue how to fix it.
We shut down our Scriptrunner Server 2 weeks ago, all necessary scripts were running fine on PU.
Yesterday I started to transfer the “nice to have” scripts and I created a new variable needed for one script. After that the credential variables weren’t available anymore. I can’t choose any when running a script which has a [PSCredential] parameter neither can I choose a RunAs credential. The error I get see below (sorry for the German).
I have deleted the new variable, edited the variables.ps1 with a restart of the PSU Service but nothing helps. The scripts I had configured to run with specific credentials before still work.
Any ideas how to narrow it down or fix this are welcome.

Regards

Sven

2022-03-31 09:34:06.999 +02:00 [INF] Invoking script New-PU-Group.ps1
2022-03-31 09:34:07.002 +02:00 [DBG] ParentJobId: 0
2022-03-31 09:34:07.041 +02:00 [INF] Job 62 started.
2022-03-31 09:34:07.064 +02:00 [DBG] Job 62 bound to port 50349.
2022-03-31 09:34:07.064 +02:00 [DBG] Starting C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe with command line  -NoProfile -Command "& { [System.Reflection.Assembly]::LoadFrom('C:\Program Files (x86)\Universal\Host\host.dll') | Out-Null; [UniversalHost.AgentService]::StartJob(50349, 11820, $False, 49713) }"
2022-03-31 09:34:07.064 +02:00 [INF] Starting job using Process.
2022-03-31 09:34:07.649 +02:00 [DBG] Agent Output: Exception:System.Management.Automation.SetValueInvocationException: Ausnahme beim Festlegen von "CreateRunspace": "Der Wert "static runspace GetRunspace()" vom Typ "System.Management.Automation.PSMethod" kann nicht in den Typ "System.Func`1[System.Management.Automation.Runspaces.Runspace]" konvertiert werden." ---> System.Management.Automation.PSInvalidCastException: Der Wert "static runspace GetRunspace()" vom Typ "System.Management.Automation.PSMethod" kann nicht in den Typ "System.Func`1[System.Management.Automation.Runspaces.Runspace]" konvertiert werden.
2022-03-31 09:34:07.649 +02:00 [DBG] Agent Output:    bei System.Management.Automation.LanguagePrimitives.ThrowInvalidCastException(Object valueToConvert, Type resultType)
2022-03-31 09:34:07.649 +02:00 [DBG] Agent Output:    bei System.Management.Automation.LanguagePrimitives.ConvertNoConversion(Object valueToConvert, Type resultType, Boolean recurse, PSObject originalValueToConvert, IFormatProvider formatProvider, TypeTable backupTable)
2022-03-31 09:34:07.649 +02:00 [DBG] Agent Output:    bei CallSite.Target(Closure , CallSite , Type , Object )
2022-03-31 09:34:07.649 +02:00 [DBG] Agent Output:    --- Ende der internen Ausnahmestapelberwachung ---
2022-03-31 09:34:07.649 +02:00 [DBG] Agent Output:    bei System.Management.Automation.ExceptionHandlingOps.ConvertToMethodInvocationException(Exception exception, Type typeToThrow, String methodName, Int32 numArgs, MemberInfo memberInfo)
2022-03-31 09:34:07.649 +02:00 [DBG] Agent Output:    bei CallSite.Target(Closure , CallSite , Type , Object )
2022-03-31 09:34:07.649 +02:00 [DBG] Agent Output:    bei System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
2022-03-31 09:34:07.649 +02:00 [DBG] Agent Output:    bei System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
2022-03-31 09:34:07.649 +02:00 [DBG] Agent Output:    bei System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2022-03-31 09:34:10.061 +02:00 [DBG] Job 62 status Completed.
2022-03-31 09:34:10.063 +02:00 [INF] Job 62 completed

Are you seeing any errors regarding variables.ps1 in your notifications or logs? It seems like it’s failing to process the variables.ps1 file properly.

No there seems to be no error on (re)starting the service. These are the first entries after restarting the service

2022-03-30 14:15:44.822 +02:00 [INF] User profile is available. Using 'C:\Windows\system32\config\systemprofile\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
2022-03-30 14:15:55.532 +02:00 [DBG] Configured logging.
2022-03-30 14:15:55.532 +02:00 [DBG] Reading configuration file variables.ps1
2022-03-30 14:15:55.576 +02:00 [DBG] Reading configuration file roles.ps1
2022-03-30 14:15:56.270 +02:00 [DBG] Reading configuration file environments.ps1
2022-03-30 14:16:00.838 +02:00 [DBG] Starting C:\Program Files\PowerShell\7\pwsh.exe with command line  -NoProfile -Command "& { [System.Reflection.Assembly]::LoadFrom('C:\Program Files (x86)\Universal\Host\host.dll') | Out-Null; [UniversalHost.AgentService]::StartModuleDiscovery('7.2.1', 49681) }"
2022-03-30 14:16:00.838 +02:00 [INF] Starting module discovery using Process.
2022-03-30 14:16:00.843 +02:00 [DBG] Reading configuration file scripts.ps1
2022-03-30 14:16:00.838 +02:00 [DBG] Starting C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe with command line  -NoProfile -Command "& { [System.Reflection.Assembly]::LoadFrom('C:\Program Files (x86)\Universal\Host\host.dll') | Out-Null; [UniversalHost.AgentService]::StartModuleDiscovery('Windows PowerShell 5.1', 49681) }"
2022-03-30 14:16:00.846 +02:00 [INF] Starting module discovery using Process.
2022-03-30 14:16:08.775 +02:00 [DBG] Reading configuration file authentication.ps1
2022-03-30 14:16:08.920 +02:00 [DBG] Reading configuration file endpoints.ps1
2022-03-30 14:16:08.921 +02:00 [DBG] Reading configuration file schedules.ps1
2022-03-30 14:16:09.075 +02:00 [INF] Scheduling script 4 on schedule 55 23 * * * with time zone Europe/Berlin.
2022-03-30 14:16:09.078 +02:00 [INF] Scheduling job '1' with schedule 55 23 * * * on time zone Europe/Berlin
2022-03-30 14:16:09.135 +02:00 [DBG] Reading configuration file publishedFolders.ps1
2022-03-30 14:16:09.136 +02:00 [DBG] Reading configuration file ratelimits.ps1
2022-03-30 14:16:09.136 +02:00 [DBG] Reading configuration file triggers.ps1
2022-03-30 14:16:09.137 +02:00 [DBG] Reading configuration file terminals.ps1
2022-03-30 14:16:09.138 +02:00 [DBG] Reading configuration file loginPage.ps1
2022-03-30 14:16:09.153 +02:00 [DBG] Reading configuration file dashboards.ps1
2022-03-30 14:16:09.154 +02:00 [DBG] Loading dashboard assets.
2022-03-30 14:16:09.156 +02:00 [DBG] Loading framework from asset directory: C:\ProgramData\PowerShellUniversal\Dashboard\Frameworks\UniversalDashboard\2.9.9
2022-03-30 14:16:09.494 +02:00 [DBG] Loading framework from asset directory: C:\ProgramData\PowerShellUniversal\Dashboard\Frameworks\UniversalDashboard\3.10.1
2022-03-30 14:16:09.568 +02:00 [DBG] Agent Output: 
2022-03-30 14:16:14.283 +02:00 [INF] Using object serializer: Quartz.Simpl.BinaryObjectSerializer, Quartz
2022-03-30 14:16:14.285 +02:00 [DBG] TaskSchedulingThreadPool configured with max concurrency of 100 and TaskScheduler ThreadPoolTaskScheduler.
2022-03-30 14:16:14.323 +02:00 [INF] Initialized Scheduler Signaller of type: Quartz.Core.SchedulerSignalerImpl
2022-03-30 14:16:14.323 +02:00 [INF] Quartz Scheduler created
2022-03-30 14:16:14.324 +02:00 [INF] RAMJobStore initialized.
2022-03-30 14:16:14.325 +02:00 [INF] Scheduler meta-data: Quartz Scheduler (v3.3.3.0) 'QuartzScheduler' with instanceId 'NON_CLUSTERED'
  Scheduler class: 'Quartz.Core.QuartzScheduler' - running locally.
  NOT STARTED.
  Currently in standby mode.
  Number of jobs executed: 0
  Using thread pool 'Quartz.Simpl.DefaultThreadPool' - with 100 threads.
  Using job-store 'Quartz.Simpl.RAMJobStore' - which does not support persistence. and is not clustered.

2022-03-30 14:16:14.326 +02:00 [INF] Quartz scheduler 'QuartzScheduler' initialized
2022-03-30 14:16:14.326 +02:00 [INF] Quartz scheduler version: 3.3.3.0
2022-03-30 14:16:14.331 +02:00 [INF] Scheduler QuartzScheduler_$_NON_CLUSTERED started.
2022-03-30 14:16:14.363 +02:00 [DBG] Batch acquisition of 1 triggers
2022-03-30 14:16:14.378 +02:00 [DBG] Producing instance of Job 'DEFAULT.f4c74497-3a1a-45ca-959c-7869f3716696', class=UniversalDashboard.Services.SessionTimeoutJob
2022-03-30 14:16:14.381 +02:00 [DBG] Batch acquisition of 0 triggers
2022-03-30 14:16:14.475 +02:00 [DBG] Calling Execute on job DEFAULT.f4c74497-3a1a-45ca-959c-7869f3716696
2022-03-30 14:16:14.478 +02:00 [DBG] Trigger instruction : NoInstruction
2022-03-30 14:16:14.771 +02:00 [INF] Scheduler QuartzScheduler_$_NON_CLUSTERED shutting down.
2022-03-30 14:16:14.772 +02:00 [INF] Scheduler QuartzScheduler_$_NON_CLUSTERED paused.
2022-03-30 14:16:14.773 +02:00 [DBG] Shutting down threadpool...
2022-03-30 14:16:14.773 +02:00 [DBG] Shutdown of threadpool complete.
2022-03-30 14:16:14.775 +02:00 [INF] Scheduler QuartzScheduler_$_NON_CLUSTERED Shutdown complete.
2022-03-30 14:16:14.775 +02:00 [INF] Using object serializer: Quartz.Simpl.BinaryObjectSerializer, Quartz
2022-03-30 14:16:14.776 +02:00 [DBG] TaskSchedulingThreadPool configured with max concurrency of 100 and TaskScheduler ThreadPoolTaskScheduler.
2022-03-30 14:16:14.776 +02:00 [INF] Initialized Scheduler Signaller of type: Quartz.Core.SchedulerSignalerImpl
2022-03-30 14:16:14.776 +02:00 [INF] Quartz Scheduler created
2022-03-30 14:16:14.776 +02:00 [INF] RAMJobStore initialized.
2022-03-30 14:16:14.776 +02:00 [INF] Scheduler meta-data: Quartz Scheduler (v3.3.3.0) 'QuartzScheduler' with instanceId 'NON_CLUSTERED'
  Scheduler class: 'Quartz.Core.QuartzScheduler' - running locally.
  NOT STARTED.
  Currently in standby mode.
  Number of jobs executed: 0
  Using thread pool 'Quartz.Simpl.DefaultThreadPool' - with 100 threads.
  Using job-store 'Quartz.Simpl.RAMJobStore' - which does not support persistence. and is not clustered.

2022-03-30 14:16:14.776 +02:00 [INF] Quartz scheduler 'QuartzScheduler' initialized
2022-03-30 14:16:14.776 +02:00 [INF] Quartz scheduler version: 3.3.3.0
2022-03-30 14:16:14.776 +02:00 [INF] Scheduler QuartzScheduler_$_NON_CLUSTERED started.
2022-03-30 14:16:14.777 +02:00 [DBG] Batch acquisition of 1 triggers
2022-03-30 14:16:14.777 +02:00 [DBG] Producing instance of Job 'DEFAULT.e6fd544e-b2e7-4738-83db-3d21ad8eadc5', class=UniversalDashboard.Services.SessionTimeoutJob
2022-03-30 14:16:14.777 +02:00 [DBG] Batch acquisition of 0 triggers
2022-03-30 14:16:14.777 +02:00 [DBG] Calling Execute on job DEFAULT.e6fd544e-b2e7-4738-83db-3d21ad8eadc5
2022-03-30 14:16:14.777 +02:00 [DBG] Trigger instruction : NoInstruction
2022-03-30 14:16:15.562 +02:00 [DBG] Agent Output: 
2022-03-30 14:16:40.570 +02:00 [DBG] Batch acquisition of 0 triggers