//**End Preparation Marker
// Set parameter annoucement file in public document folder
parameter "DestinationFile"="C:\Users\Public\Documents\Announcement.pdf"
// Delete any existing annoucement file and copy the new one
delete {parameter "DestinationFile"}
copy __Download\Announcement.pdf {parameter "DestinationFile"}
// Open PDF in default viewer
override run
runas=currentuser
run explorer.exe {parameter "DestinationFile"}
This script works fine to open pdf file but before it opens I want to minimize all windows on the user’s screen. Which command should I use? and where in the script please help?
I’ve tried this as a custom action and failed:
run explorer.exe shell:::{3080F90D-D7AD-11D9-BD98-0000947B0257}
the command works fine if run manually on user’s pc.
Now this is weird. It runs in debugger and minimizes all windows. But it does not work with override run and run as current user.
But when I ran this actionscript alone on a pc it completed but didn’t minimize.
Fixlet Debugger is running in your User Security Context, so I expect it would work from Fixlet Debugger.
The BigFix client runs as local system, so it would effectively minimize the windows for the System user, not your local user. Override is supposed to allow you to shift context to run as the currently logged on user, but my results are matching yours - running this with the override is allowing the execution of the command, but the effect of minimizing open windows did not occur.
Interesting observation while I was trying to get this to work. When launching the command, the agent starts a second instance of explorer.exe instead of using the existing process. I suspect that in the second instance, the windows all get minimized. Screenshot of the second instance in Task Manager. After a few minutes, the second instance dies off.
This does not help you with your stated goal, but might give a clue that progresses us that direction. I am running out of ideas on this one. Hoping some of the other folks might have some inspiration.
Found a way! Powershell. This Action script was successful in minimizing windows in my user session when launched by the BigFix Agent
action uses wow64 redirection {not x64 of operating system}
delete __createfile
createfile until END_OF_FILE
(New-Object -ComObject Shell.Application).MinimizeAll()
END_OF_FILE
delete powershell.ps1
move __createfile powershell.ps1
override run
runas=currentuser
run { pathname of file ((it as string) of value "Path" of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell" of native registry) } -ExecutionPolicy Bypass -File powershell.ps1