Show desktop (minimize all windows and then open the pdf)

Hi All,

Please help me with this script.

//**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.

Try escaping that open curly brace?

override run 
runas=currentuser 
run explorer.exe shell:::{{3080F90D-D7AD-11D9-BD98-0000947B0257}

There might be another issue here. I tested and the command ran, but my open windows did not minimize.

   Command succeeded override run  (action:243)
   Command succeeded override runas=currentuser (action:243)
   Command succeeded run explorer.exe shell:::{3080F90D-D7AD-11D9-BD98-0000947B0257} (action:243)
1 Like

If you run this in cmd:

explorer.exe shell:::{3080F90D-D7AD-11D9-BD98-0000947B0257}

You will see that it works. I tried this on Windows 10.

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.

Any suggestion what else can be done to minimize the screen. Or any idea that can bring up the pdf file to users attention when it opens?

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
4 Likes

I just successfully tested a very similar approach to minimize all :slight_smile:

override run
    hidden=true
    runas=currentuser
run powershell -command "(new-object -com shell.application).minimizeall()"
4 Likes

Thank you so much @Aram

This resolved the issue. I really enjoy being part of this community. Thanks to you all.

Thank you so much @brolly33

I really appreciate all your effort in this.