-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.Resolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-DevEx-SDKhosting PowerShell as a runtime, PowerShell's APIs, PowerShell Standard, or development of moduleshosting PowerShell as a runtime, PowerShell's APIs, PowerShell Standard, or development of modules
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
I am experiencing a problem when running the PowerShell SDK in a kiosk (AssignedAccess) environment in a WindowsBackgroundService. When I am using the library in a non-kiosk environment it works fine. But the weird thing is that once I am in the kiosk or when I get back from it, I am always getting an exception. I already asked this on StackOverflow but without any solutions.
Expected behavior
$user = "ExamX"
$Sid = (Get-LocalUser -Name $user).SID.Value
Remove-LocalUser -SID $Sid
Clear-AssignedAccess
sc.exe stop "ExamX Service"
sc.exe delete "ExamX Service"
$path = "HKLM:\SOFTWARE\ExamX\ExamInfo\"
Remove-Item -Recurse $path -ErrorAction SilentlyContinueActual behavior
Exception Trace System.TypeInitializationException: The type initializer for 'System.Management.Automation.ExperimentalFeature' threw an exception.
---> System.TypeInitializationException: The type initializer for 'System.Management.Automation.Configuration.PowerShellConfig' threw an exception.
---> System.ArgumentNullException: Value cannot be null. (Parameter 'path1')
at System.IO.Path.Combine(String path1, String path2)
at System.Management.Automation.Configuration.PowerShellConfig..ctor()
at System.Management.Automation.Configuration.PowerShellConfig..cctor()
--- End of inner exception stack trace ---
at System.Management.Automation.ExperimentalFeature..cctor()
--- End of inner exception stack trace ---
at System.Management.Automation.Runspaces.AsyncResult.EndInvoke()
at System.Management.Automation.PowerShell.EndInvoke(IAsyncResult asyncResult)
at ExamX_Service.WindowsService.PowershellHandler.Execute() in C:\ExamX\Service\ExamX_Service\ExamX_Service\PowershellHandler.cs:line 33
at ExamX_Service.WindowsService.WindowsBackgroundService.RunRecoveryScript(ILogger`1 logger) in C:\ExamX\Service\ExamX_Service\ExamX_Service\WindowsBackgroundService.cs:line 134
at ExamX_Service.WindowsService.WindowsBackgroundService.ExecuteAsync(CancellationToken stoppingToken) in C:\ExamX\Service\ExamX_Service\ExamX_Service\WindowsBackgroundService.cs:line 110Error details
No response
Environment data
I can't really execute this command due to the exception being thrownVisuals
No response
FeelProud and yoavt-semperis
Metadata
Metadata
Assignees
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.Resolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-DevEx-SDKhosting PowerShell as a runtime, PowerShell's APIs, PowerShell Standard, or development of moduleshosting PowerShell as a runtime, PowerShell's APIs, PowerShell Standard, or development of modules