When using a gMSA to run PowerShell Universal process under, script execution doesn’t work if using different credentials.
This have been testet with a PowerShell v7.1.5 enviroment (persistent).
Debug logging was also enabled for every LogLevel entry, but that didn’t seem to give more logs for some reason.
A script was created to run under the PS7 enviroment with custom credentials.
When running the script the error “Error executing job: Did not receive port from client process.” was recieved and there is no indication of the error in the Application Event Log or the PSU log.
But the PowerShellCore event log show the following Warning, which indicates that the “User: domain\StandardSVC” doesn’t have access to PSU’s gMSA temp folder.
Error Message = The specified drive root "C:\Users\gMSA~1\AppData\Local\Temp\" either does not exist, or it is not a folder.
Fully Qualified Error ID = DriveRootError
Provider name = FileSystem
Context:
Severity = Warning
Host Name = ConsoleHost
Host Version = 7.1.5
Host ID = 085c49fe-f3f4-41d9-a98b-fe53f8131252
Host Application = C:\Program Files\PowerShell\7\pwsh.dll -NoProfile -Command & { [System.Reflection.Assembly]::LoadFrom('C:\Program Files (x86)\Universal\Host\host.dll') | Out-Null; [UniversalHost.AgentService]::StartJob(59361, 6644, $True, 59312) }
Engine Version =
Runspace ID =
Pipeline ID =
Command Name =
Command Type =
Script Name =
Command Path =
Sequence Number = 4
User = domain\StandardSVC
Connected User =
Shell ID = Microsoft.PowerShell
The account ‘domain\StandardSVC’ was then assigned full access to the gMSA’s user profile folder.
Trying to run the script again a new error was recieved “Error executing job: Access is denied.” and i cannot find anything regarding the “Accesss is denied” error in
In the gMSA temp folder empty files is created called “psu..txt” and every new files a created about every 15 seconds.
Task Manager shows more than one new pwsh.exe processes getting started and stopped shortly after. It looks like it wouldn’t stop before i restarted the PSU service.
In the PSU log we now see the following error multiple times:
2021-11-08 10:41:11.686 +01:00 [ERR] Error in ConcurrentJobFilter
System.NullReferenceException: Object reference not set to an instance of an object.
at UniversalAutomation.Services.Automation.ConcurrentJobFilter.TryPerforming(PerformingContext filterContext) in D:\a\universal\universal\src\UniversalAutomation\Services\Automation\ConcurrentJobFilter.cs:line 71
at UniversalAutomation.Services.Automation.ConcurrentJobFilter.OnPerforming(PerformingContext filterContext) in D:\a\universal\universal\src\UniversalAutomation\Services\Automation\ConcurrentJobFilter.cs:line 34
2021-11-08 10:41:26.690 +01:00 [ERR] Error in ConcurrentJobFilter
System.NullReferenceException: Object reference not set to an instance of an object.
at UniversalAutomation.Services.Automation.ConcurrentJobFilter.TryPerforming(PerformingContext filterContext) in D:\a\universal\universal\src\UniversalAutomation\Services\Automation\ConcurrentJobFilter.cs:line 71
at UniversalAutomation.Services.Automation.ConcurrentJobFilter.OnPerforming(PerformingContext filterContext) in D:\a\universal\universal\src\UniversalAutomation\Services\Automation\ConcurrentJobFilter.cs:line 34
2021-11-08 10:42:01.960 +01:00 [ERR] Error in job thread
System.NullReferenceException: Object reference not set to an instance of an object.
at UniversalAutomation.ExecutionService.<>c__DisplayClass19_0.<<ExecutePowerShell>b__4>d.MoveNext() in D:\a\universal\universal\src\UniversalAutomation\Services\Automation\ExecutionService.cs:line 584
2021-11-08 10:42:11.720 +01:00 [ERR] Error in ConcurrentJobFilter
System.NullReferenceException: Object reference not set to an instance of an object.
at UniversalAutomation.Services.Automation.ConcurrentJobFilter.TryPerforming(PerformingContext filterContext) in D:\a\universal\universal\src\UniversalAutomation\Services\Automation\ConcurrentJobFilter.cs:line 71
at UniversalAutomation.Services.Automation.ConcurrentJobFilter.OnPerforming(PerformingContext filterContext) in D:\a\universal\universal\src\UniversalAutomation\Services\Automation\ConcurrentJobFilter.cs:line 41
2021-11-08 10:42:11.720 +01:00 [ERR] Error in ConcurrentJobFilter
System.NullReferenceException: Object reference not set to an instance of an object.
at UniversalAutomation.Services.Automation.ConcurrentJobFilter.TryPerforming(PerformingContext filterContext) in D:\a\universal\universal\src\UniversalAutomation\Services\Automation\ConcurrentJobFilter.cs:line 71
at UniversalAutomation.Services.Automation.ConcurrentJobFilter.OnPerforming(PerformingContext filterContext) in D:\a\universal\universal\src\UniversalAutomation\Services\Automation\ConcurrentJobFilter.cs:line 41
2021-11-08 10:42:16.956 +01:00 [ERR] Error in ConcurrentJobFilter
System.NullReferenceException: Object reference not set to an instance of an object.
at UniversalAutomation.Services.Automation.ConcurrentJobFilter.TryPerforming(PerformingContext filterContext) in D:\a\universal\universal\src\UniversalAutomation\Services\Automation\ConcurrentJobFilter.cs:line 71
at UniversalAutomation.Services.Automation.ConcurrentJobFilter.OnPerforming(PerformingContext filterContext) in D:\a\universal\universal\src\UniversalAutomation\Services\Automation\ConcurrentJobFilter.cs:line 41
2021-11-08 10:42:31.965 +01:00 [ERR] Error in ConcurrentJobFilter
System.NullReferenceException: Object reference not set to an instance of an object.
at UniversalAutomation.Services.Automation.ConcurrentJobFilter.TryPerforming(PerformingContext filterContext) in D:\a\universal\universal\src\UniversalAutomation\Services\Automation\ConcurrentJobFilter.cs:line 71
at UniversalAutomation.Services.Automation.ConcurrentJobFilter.OnPerforming(PerformingContext filterContext) in D:\a\universal\universal\src\UniversalAutomation\Services\Automation\ConcurrentJobFilter.cs:line 41
2021-11-08 10:42:41.733 +01:00 [ERR] Error in ConcurrentJobFilter
System.NullReferenceException: Object reference not set to an instance of an object.
at UniversalAutomation.Services.Automation.ConcurrentJobFilter.TryPerforming(PerformingContext filterContext) in D:\a\universal\universal\src\UniversalAutomation\Services\Automation\ConcurrentJobFilter.cs:line 71
at UniversalAutomation.Services.Automation.ConcurrentJobFilter.OnPerforming(PerformingContext filterContext) in D:\a\universal\universal\src\UniversalAutomation\Services\Automation\ConcurrentJobFilter.cs:line 41
2021-11-08 10:42:56.740 +01:00 [ERR] Error in ConcurrentJobFilter
System.NullReferenceException: Object reference not set to an instance of an object.
at UniversalAutomation.Services.Automation.ConcurrentJobFilter.TryPerforming(PerformingContext filterContext) in D:\a\universal\universal\src\UniversalAutomation\Services\Automation\ConcurrentJobFilter.cs:line 71
at UniversalAutomation.Services.Automation.ConcurrentJobFilter.OnPerforming(PerformingContext filterContext) in D:\a\universal\universal\src\UniversalAutomation\Services\Automation\ConcurrentJobFilter.cs:line 41
The PowerShellCore event log also indicate that new pwsh processes is started but there is no errors or warnings.
The Security event log only shows audit success for the “domain\StandardSVC” user account so the access denied doesn’t look to be permissions related and the account already have ‘logon as a batch job’ permission.
If I change the PSU service to run under the LocalSystem account the issue ins’t there.
I haven’t tried to run the PSU service under a standard user account, so i don’t know if it’s only a problem with gMSA.
Am i doing something wrong or missing something?
Other issues I noticed when trying to debug this issue:
- Retry limit cannot be changed for a script after it was created (the setting doesn’t save)
- Editing a variable doesn’t show the current value in the edit box.
- Editing an enviroment doesn’t show current value of “persistent runspace”. The ‘checkbox’ is always disabled.
- After restart of the PSU service a Dashboard shows as “Stopped” even though it’s started. Pressing start button resolves this until next service restart.
I haven’t got a GitHub account so i cannot post it there.
Product: PowerShell Universal
Version: 2.4.1