I have PowerShell logon script for Windows 10 which runs under system context, this script eventually triggers another powershell script using below code…
Do you know it’s not getting executed, or are you just not -seeing- anything? Anything running under System would not have automatic ability to interact with the logged-on user’s GUI.
I’m also not sure why you’re running Explorer to run PowerShell. It wouldn’t surprise me if something in there is losing track of all the EXEs and command-line arguments. Really, you’re not doing anything different from just running the .ps1 file, you’re just taking a super-long way to get there.
The reason I used ‘ServiceUI.exe’ with Start-Process is that, logon PowerShell script runs under SYSTEM context and logged-in user simply doesn’t aware about whats going on his machine… login script downloads content from Azure cloud (contains ServiceUI, ProgressBar.ps1 and few other files), another script - ‘ProgressBar.ps1’ (in above example) does bit configuration on windows machine and does show progress bar…
issue is, logon script is running but ‘ProgressBar.ps1’ not getting triggered/executed…
hope i have made it simplified and using the logic correctly…
Just running it as a service isn’t going to give it access to the logged-on user’s UI. That’s a security boundary. As-is, I suspect Windows just doesn’t know what you’re trying to ask it to do; but more broadly I don’t think you’re going to be able to get it to do what you want. Have the main logon script show the progress bar, since it -does- have access to the logged-on user context. Logon scripts (as opposed to Startup scripts) do run under the user’s context. That’s the whole point of them.