Want to manage registry of all users in windows7 #20123

Open
you-n-g opened this Issue Jan 11, 2017 · 5 comments

Projects

None yet

4 participants

@you-n-g
you-n-g commented Jan 11, 2017
ISSUE TYPE
  • Feature Idea
COMPONENT NAME

win_regedit

ANSIBLE VERSION

2.2.0

OS / ENVIRONMENT

windows7 && ubuntu 14.04

CONFIGURATION
- name: Create Registry Key
  win_regedit:
    key: HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\System
    value: Wallpaper
    data: C:\pic1.jpg
SUMMARY

I want use ansible to change all users's wallpaper.
I found a way here to change the wallpaper by changing registry.
However, I can only change the registry of current user by changing the key "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\System" .
But I want to change the registry of every user on this computer.

I only got one administrator account. Other users' credentials are not known.

EXPECTED RESULTS

I can change every users registry.

ACTUAL RESULTS

I can only change current user's registry.

Any comments will be appreciated :)

@abadger abadger removed the needs_triage label Jan 12, 2017
@you-n-g
you-n-g commented Jan 13, 2017 edited

I found this article
It says "If you want to change registry data for a user whose SID is not appearing under HKEY_USERS, you can either log in as that user and make the change, or you can load the registry hive of that user manually. See How To Load a Registry Hive if you need help. "

Is there any way I can load the registry hive with ansible?

@jhawkesworth
Contributor

I found this article which explains the basic principle

http://www.adminarsenal.com/admin-arsenal-blog/modifying-the-registry-of-another-user/

You could probably take the powershell example in the above and loop through it for each user. That could be an interesting challenge as you might need to exclude the system users and also if you have domain logins, not every machine will have had the user log in first, so there might not be a users folder for all users on all machines.

To me this feels more like a job for a custom powershell script but I guess no reason not to turn it into a module.

@you-n-g
you-n-g commented Jan 13, 2017

Thanks for your advice :) !

@jhawkesworth
Contributor

If you want to have a go at making a general purpose module then win_regedit.ps1 will contain a lot of the logic you'd need for actually making and checking for registry changes. I think it might be a mistake to try and make win_regedit module do this as well as everything else it does - modules get hard to maintain if they try to do lots of things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment