Since Invoke-HKCUSettingsForAllUsers just executes a scriptblock for every user profile fed into it, and since it references a $UserProfile object with properties NTAccount, SID, and ProfilePath, it can be used for much more than just setting registry keys. Off the top of my head I can think of using it with:
basically anything that you can put $UserProfile.ProfilePath into.
Since this all works just fine, can anyone think of any reason why this function should not be named something like Invoke-ScriptBlockForAllUsers? It allows one to do rather a lot more than just set registry values… Rather nice.
Does anyone have any interesting ways they’ve used this function?