New
#20
Last edited by Brink; 23 Mar 2012 at 12:41. Reason: added quote
Thanks for the quick response Brink! Unfortunately I do not have access to the GPOs for the domain (and the folks who do are clueless...) so I am forced to accomplish simple Group policy tasks with complicated scripts and deployments via SCCM. Thanks again, lets hope someone knows a way to push this fix with a script.
If you aren't a domain admin, you won't be able to push out policy. You could write logon scripts, but unless you can assign logon scripts to individuals in AD, they would be useless. I'm not familiar with SCCM, as we don't use it on our domain. Exactly what does it allow you, as a non-domain admin, to do in the domain?
Hi keg,
I should clarify: I am a domain admin, just not with access to the DC or GPOs. We have a tiered access model, so only a few people have access to the DCs and I am not one of them. However I have access to pretty much everything else.
SCCM is a tool that allows you to push software and run reports on domain PCs from a central console. We would be dead without it; its a great tool. We use it to install software on up to 1500 PCs at once - push security updates to software, remove unapproved software, report on system hardware, deploy reg hacks... Typically when I need to deploy a fix that I can't get the GPO guys to make, I build a script and deploy it via SCCM, which will ensure 100% compliance every time. This solution is as reliable as a GPO, but more complex for sure.
M
Here is some code to deploy that should accomplish the task for you. It parses all user profiles on the computer, loads their HKCU hives and then sets the appropriate registry key.
Note that I have just provided the code, as I am not familiar with SCCM and so you will need to incorporate it into a suitable script that can be deployed. I recommend that you test it first before deploying it on a wider scale.
Acknowledgements to Nick Moseley, t3chn1ckCode:' ################################################ ' Start of Routine ' ################################################ Option Explicit Const ForAppending = 8 Const HKLM = &H80000002 ' ################################################ ' HKCU reference and value to be used ' ################################################ Const sDwordUserKey = "\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" Const sDwordUserKeyValueName = "Start_PowerButtonAction" Const sDwordUserKeyValue = "1" ' ################################################ ' Main ' ################################################ Dim oReg, oFSO, oFile, oUserSubkey, aUserProfiles, oShell Dim sProfileLCase, sRegExe, sRegLoad, sRegUnload, sHiveName, sSubPath, sProfile, sValueName, sKeyPathUserProfiles, sValue, ReturnVal Set oReg = GetObject("winmgmts:\\.\root\default:StdRegProv") Set oShell = CreateObject ("WScript.Shell") Set oFSO = CreateObject ("Scripting.FileSystemObject") ' ################################################ ' Begin configuration of existing user profiles ' ################################################ sValueName = "ProfileImagePath" sKeyPathUserProfiles = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" sRegExe = "C:\Windows\system32\reg.exe" oReg.EnumKey HKLM, sKeyPathUserProfiles, aUserProfiles ' ################################################ ' Start of users loop ' ################################################ For Each oUserSubkey In aUserProfiles sSubPath = sKeyPathUserProfiles & "\" & oUserSubkey oReg.GetExpandedStringValue HKLM,sSubPath,sValueName,sValue sProfile = Split(sValue, "\") sProfileLCase = LCase(sProfile(2)) If sProfileLCase = "system32" Then ElseIf sProfileLCase = "localservice" Then ElseIf sProfileLCase = "networkservice" Then ElseIf sProfileLCase = "serviceprofiles" Then Else ' ################################################ ' Load user's profile hive into a temp location ' ################################################ sHiveName = "TempHive_" & sProfileLCase sRegLoad = " LOAD HKLM\" & sHiveName & " """ & sValue & "\ntuser.dat""" oShell.Run sRegExe & sRegLoad, 0, True ' ################################################ ' Call Subroutine to change registry key ' ################################################ SetConfigUserHive (sHiveName) ' ################################################ ' Unload user's profile hive ' ################################################ sRegUnload = " UNLOAD HKLM\" & sHiveName oShell.Run sRegExe & sRegUnload, 0, True End If Next ' ################################################ ' End of users loop ' ################################################ ' Default User Profile ' ################################################ sHiveName = "TempHive_DefaultUser" sRegLoad = " LOAD HKLM\" & sHiveName & " ""C:\Documents and Settings\Default User\ntuser.dat""" oShell.Run sRegExe & sRegLoad, 0, True ' ################################################ ' Call Subroutine to change registry key ' ################################################ SetConfigUserHive (sHiveName) sRegUnload = " UNLOAD HKLM\" & sHiveName oShell.Run sRegExe & sRegUnload, 0, True ' ################################################ ' Routine exit point ' ################################################ WScript.Quit () ' ################################################ ' Subroutine to change registry key ' ################################################ Sub SetConfigUserHive (sTempHive) Dim sTempHiveStringKeyPath, sTempHiveDwordKeyPath ' ################################################ ' Path of registry key ' ################################################ sTempHiveDwordKeyPath = sTempHive & sDwordUserKey ' ################################################ ' Create Dword registry key if non-existant ' ################################################ If oReg.GetDwordValue(HKLM, sTempHiveDwordKeyPath & "\", sDwordUserKeyValueName) <> 0 Then ReturnVal = oReg.CreateKey(HKLM, sTempHiveDwordKeyPath) End If ' ################################################ ' Create Dword value ' ################################################ ReturnVal = oReg.SetDwordValue(HKLM, sTempHiveDwordKeyPath & "\", sDwordUserKeyValueName, sDwordUserKeyValue) End Sub ' ################################################ ' End of Subroutine ' ################################################
Thanks for such good explanations, but none of these methods work for me. I can change the setting via the power button properties and it shows logoff which is what I want. If I go to the Registry, the value is 1 (log off). The policies are set for log off.
BUT the button still says "Shutdown!"
Any ideas on how to fix this?
Thanks
Hello Tom, and welcome to Seven Forums.
Does your Power button with "Shut down" in the Start Menu happen to have a little shield on it as well??
If so, then this is normal and indicates that you have Windows Updates that need to be installed. Clicking on this "Shut down" button with the shield icon will have Windows 7 install the updates first then shut down. Afterwards your power button will return to what you had it set for.
If this is the case, then you could use the tutorial below to turn this off by not allowing it.
Shut Down Windows - Change "Install Updates and Shut Down" as Default
Hope this helps, :)
Shawn
Last edited by Brink; 31 Aug 2012 at 12:43. Reason: typo
Shawn.
You were RIGHT ON! I powered down and there were updates waiting. Now button is set to Log Off
Thanks a million!
How about "undock"?
In my case (on a lenovo t61p laptop), the start menu power button arrow pulldown list includes the item "undock". The button itself currently defaults to "hibernate", presumably because in the win 7 power options dialog I have set the physical power button to hibernate the machine.
I would like the default button value to be "undock." However, if I go to start menu properties, that is not listed as one of the options to default to. Similarly, your list of hex values to set in the registry does not include the "undock" item. Any idea how I can get that start menu button to default to "undock"? BTW, selecting undock in the pulldown menu truly does undock the machine, so it is not a no-op.
Thanks.