This topic contains 3 replies, has 2 voices, and was last updated by
July 6, 2018 at 2:58 pm #104035ParticipantPoints: 11Rank: Member
I have PowerShell logon script for Windows 10 which runs under system context, this script eventually triggers another powershell script using below code…
Start-Process -filepath "C:\windows\temp\ServiceUI.exe" -argumentlist "-process:explorer.exe C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File C:\temp\ProgressBar.ps1" -Wait -NoNewWindow
Unfortunately, another script not getting executed for unknown reason, not sure, if I'm missing something with above command.
Can someone please help?
July 6, 2018 at 3:49 pm #104039KeymasterPoints: 1,759Rank: Community Hero
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.
July 6, 2018 at 4:03 pm #104045ParticipantPoints: 11Rank: Member
Thanks for response.
I see script not getting executed..
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..
July 6, 2018 at 4:04 pm #104047KeymasterPoints: 1,759Rank: Community Hero
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.
The topic ‘call another script using logon script’ is closed to new replies.