1

Possible Duplicate:
Schedule Windows XP wallpaper change without additional apps I think this is not a duplicate because I asked how to change the background of a different user not the current one logged on. I already know how to do that. Please vote to reopen my question.

I was wondering how to change the desktop background of a specific user. I understand that you have to look into HKEY_USERS but I don't know where to go from there. I need to do this in a batch file too. This is for windows xp.

3
  • This link may help you about all. superuser.com/questions/57140/… Best Regards
    – Hamed JML
    May 30, 2012 at 11:37
  • Thanks :) That does help too :) and I don't think my question is a duplicate... It has a difference in that I want to change the background of a user that is not currently logged on. Just saying :)
    – Nick
    May 30, 2012 at 12:06
  • I agree, this isn't an exact duplicate. I've voted to re-open the question.
    – Indrek
    May 30, 2012 at 12:18

1 Answer 1

2

This can be done with PowerShell:

$user = Get-WMIObject -Query "select * from Win32_UserAccount where Name='<username>'"
$path = 'Registry::HKEY_USERS\' + $user.SID + '\Control Panel\Desktop\'
Set-ItemProperty -path $path -name Wallpaper -value 'C:\path\to\wallpaper.jpg'
rundll32.exe user32.dll UpdatePerUserSystemParameters

Explanation:

  • The first line gets the given user's information using WMI. Specifically, you need the SID that identifies this user under the HKEY_USERS registry hive. For more information, see Get-WMIObject, Win32_UserAccount class and Querying with WQL.
  • The second line simply builds the path to the correct registry key.
  • The third line sets the value of the given entry under the given registry key. See Set-ItemProperty for more information.
  • The fourth line forces a refresh of the wallpaper. This is only needed if the specified user is logged in and you need the change to take effect immediately.
1
  • Cheers man :) just what I needed!
    – Nick
    May 30, 2012 at 12:04

Not the answer you're looking for? Browse other questions tagged .