1. Thanks for that; can you also explain how to make the change instant without having to log off/on again just like control panel would do it.
    I know that it involves sending some kind of message to explorer (I think!) but I’ve no idea how to do it in PowerShell (or even if it’s possible)

  2. Scott Kuntzelman

    Aman – I found the (to my mind) simplest way to do this from this post:

    I use this for my code:
    $signature = @’
    public static extern uint SystemParametersInfo(
    uint uiAction,
    uint uiParam,
    string pvParam,
    uint fWinIni);

    $type = Add-Type -MemberDefinition $signature -Name Win32Utils -Namespace SystemParametersInfo -PassThru

    $null = $type::SystemParametersInfo(20, 0, “C:\temp\dilbert$today.bmp”, 3)

    (I have already downloaded the dilbert cartoon and converted it to bitmap previously).

  3. Scott Kuntzelman

    Sorry – I left out a step. Prior to calling the last line “$null = $type::…”, set the background color.
    Set-ItemProperty -Path ‘HKCU:\Control Panel\Colors\’ -Name Background -Value “0 66 98”

    This sets the background color, adds the Dilbert cartoon in the center and changes immediately without logging out.

Leave a Reply

Your email address will not be published. Required fields are marked *