Robot Posted December 22, 2009 Posted December 22, 2009 Hey, I need to change some Registry DWORD Values on multiple PCs. All of the values that I need to change are within the following strpath... HKEY_CURRENT_USER\Software\Zultys\MXUser\C%058%092Program Files%092Zultys%092MXIE%092Bin%092\Users\User.Name\Settings The issue that I am having is that on one PC, which is used by a users with the username User.1 the registry string is HKEY_CURRENT_USER\Software\Zultys\MXUser\C%058%092Program Files%092Zultys%092MXIE%092Bin%092\Users\User.1\Settings On another PC with User.2 logging in, the string is HKEY_CURRENT_USER\Software\Zultys\MXUser\C%058%092Program Files%092Zultys%092MXIE%092Bin%092\Users\User.2\Settings Is there any way of getting past this? I have tried putting %username% in place of where their usernames appear but this did not work. Cheers.
ChrisH Posted December 22, 2009 Posted December 22, 2009 What method are you using to try and do this? In VB script you could build the line by expanding the username environment variable. eg Set oShell = CreateObject( "WScript.Shell" ) strUser=oShell.ExpandEnvironmentStrings("%UserName%") strRegKey = "HKCU\Software\Zultys\MXUser\C%058%092 Program Files%092Zultys%092MXIE%092Bin%092\Users\" & strUser & "\Settings" ' add reg key code here 1
Robot Posted December 22, 2009 Author Posted December 22, 2009 (edited) What method are you using to try and do this? In VB script you could build the line by expanding the username environment variable. eg Set oShell = CreateObject( "WScript.Shell" ) strUser=oShell.ExpandEnvironmentStrings("%UserName%") strRegKey = "HKCU\Software\Zultys\MXUser\C%058%092 Program Files%092Zultys%092MXIE%092Bin%092\Users\" & strUser & "\Settings" ' add reg key code here Edit - Spoke too soon Thanks Chris... Could I ask for some help on writing the rest to change the DWORD Values too please, I have just give it a go and received an error in my code I tried ... Set oShell = CreateObject( "WScript.Shell" ) strUser=oShell.ExpandEnvironmentStrings("%UserName%") strRegKey = "HKCU\Software\Zultys\MXUser\C%058%092 Program Files%092Zultys%092MXIE%092Bin%092\Users\" & strUser & "\Settings\UserPresence" ' add reg key code here strValueName = "BeRightBackTimeoutActive" dwValue = 82 Am I missing something or doing it wrong all together?? Thanks : ) Edited December 22, 2009 by Robot
ChrisH Posted December 22, 2009 Posted December 22, 2009 Set oShell = CreateObject( "WScript.Shell" ) strUser=oShell.ExpandEnvironmentStrings("%UserName%") strRegKey = "HKCU\Software\Zultys\MXUser\C%058%092 Program Files%092Zultys%092MXIE%092Bin%092\Users\" & strUser & "\Settings" oShell.RegWrite strRegKey & "BeRightBackTimeoutActive",82,"REG_DWORD" Should be something like that. I may have my methods mixed up so untested at your own risk etc etc. 1
ChrisH Posted December 22, 2009 Posted December 22, 2009 If it still shows an error it may need an extra "\" on the end of the path. 1
Robot Posted December 22, 2009 Author Posted December 22, 2009 If it still shows an error it may need an extra "\" on the end of the path. Nope, went straight through and did what I wanted. Thanks very much
ChrisH Posted December 22, 2009 Posted December 22, 2009 Nope, went straight through and did what I wanted. Thanks very much No problem.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now