That may explain the problem I had with using it a few weeks ago - thanks for the information!
Since Espi clarified that Win7 doesn't use UpdatePerUserSystemParameters, but instead uses SystemParametersInfo (thanks Espi!), I did some web searching and found someone who is successfully using SystemParametersInfo to update the foreground settings without needing to log off: http://powershellreflections.wordpress.com/2011/08/02/control-your-screensaver-with-powershell I did confirm that it works with the screen saver timeout that is posted on the page. Of course this only applies to the screen saver setting, but the code should be adaptable to the specific areas that the GP is targeting. Although, I'm not sure if it will work with the GPs at all without a relogin, but may be worth looking into. I would recommend looking at the comments section since it reveals how the author of the page above used the numbers 14 and 15 for uiAction (or you can just convert the corresponding Hex value to Decimal). -Aakash Shah From: [email protected] [mailto:[email protected]] On Behalf Of James Rankin Sent: Tuesday, October 22, 2013 11:34 AM To: [email protected] Subject: Re: [NTSysADM] Desktop refresh Ah, now that rings a bell with what I think I read about it earlier. On 22 October 2013 19:20, Micheal Espinola Jr <[email protected]<mailto:[email protected]>> wrote: It shouldn't throw an error on Windows 7, but it also doesn't actually work on Windows 7 either. The chatter is that Windows 7 uses the SystemParametersInfo function - but I've yet to see a working commandline expression for it. -- Espi On Tue, Oct 22, 2013 at 10:53 AM, James Rankin <[email protected]<mailto:[email protected]>> wrote: I did find that - it throws an error on Windows 7 if I remember correctly. Although I didn't test very long...it may just need elevation or something On 22 October 2013 18:49, Aakash Shah <[email protected]<mailto:[email protected]>> wrote: I came across this a few weeks ago. It may or may not help you (it didn't work for my specific situation), but the command below tells Explorer to update itself (this is case sensitive btw): rundll32.exe user32.dll, UpdatePerUserSystemParameters For instance, when you make a change in the Screen Saver tab, it is really just making a change in the registry. However, it appears that Windows calls the command above to refresh the settings after making a setting change. While the above approach didn't work for the GP I was targeting, it may be worth trying for your scenario. If you do, run a gpupdate operation first followed by the command above. I'd be curious to see if this helps for your situation. -Aakash Shah From: [email protected]<mailto:[email protected]> [mailto:[email protected]<mailto:[email protected]>] On Behalf Of Micheal Espinola Jr Sent: Tuesday, October 22, 2013 2:40 AM To: [email protected]<mailto:[email protected]> Subject: Re: [NTSysADM] Desktop refresh I recommend the logoff or reboot. Killing the shell can have repercussions depending on apps that are running: Certain apps can become impossible to bring back to the foreground. Certain tray apps will not recover back into the system tray. Etc. YMMV, but it can happen. -- Espi On Tue, Oct 22, 2013 at 2:20 AM, James Rankin <[email protected]<mailto:[email protected]>> wrote: Guess this one needs a logoff (or at least a restart of the shell), because gpupdate doesn't cut it in this situation :-( On 22 October 2013 10:06, Micheal Espinola Jr <[email protected]<mailto:[email protected]>> wrote: yea - thats what gpupdate is for - but it depends on what in the policy is being updated. Something may require a logoff,while others a reboot. -- Espi On Tue, Oct 22, 2013 at 1:27 AM, James Rankin <[email protected]<mailto:[email protected]>> wrote: Well, the shell, rather, my bad. Basically I am changing some GPO settings mid-session, and they apply to explorer.exe (restricting drives in My Computer), so I need to give explorer a bit of a kick to pick up the changed settings from the Registry. So far, all I managed to come up with is terminating and restarting explorer - does the trick, to be fair. Actually (thinking out loud), I wonder if gpupdate might do the same thing if I run it? On 22 October 2013 09:21, Ken Schaefer <[email protected]<mailto:[email protected]>> wrote: What do you mean by "refresh" the desktop? The "desktop" is just a shell folder(s) From: [email protected]<mailto:[email protected]> [mailto:[email protected]<mailto:[email protected]>] On Behalf Of James Rankin Sent: Tuesday, 22 October 2013 7:17 PM To: [email protected]<mailto:[email protected]> Subject: [NTSysADM] Desktop refresh One final thing - is there any way to programatically sort of "refresh" the desktop? At the moment I'm having to kill and restart explorer.exe, which does the trick, but feels like smashing a door down with a sledgehammer rather than subtly picking the lock. Cheers, -- James Rankin Technical Consultant (ACA, CCA, MCTS) http://appsensebigot.blogspot.co.uk -- James Rankin Technical Consultant (ACA, CCA, MCTS) http://appsensebigot.blogspot.co.uk -- James Rankin Technical Consultant (ACA, CCA, MCTS) http://appsensebigot.blogspot.co.uk -- James Rankin Technical Consultant (ACA, CCA, MCTS) http://appsensebigot.blogspot.co.uk -- James Rankin Technical Consultant (ACA, CCA, MCTS) http://appsensebigot.blogspot.co.uk

