Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

marked as duplicate by Sathya May 30 '12 at 12:02

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
This link may help you about all. superuser.com/questions/57140/… Best Regards –  Hamed JML May 30 '12 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 :) –  Nicholas May 30 '12 at 12:06
    
I agree, this isn't an exact duplicate. I've voted to re-open the question. –  Indrek May 30 '12 at 12:18
add comment

1 Answer

up vote 1 down vote accepted

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.
share|improve this answer
    
Cheers man :) just what I needed! –  Nicholas May 30 '12 at 12:04
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.