Quantcast
Viewing all articles
Browse latest Browse all 3066

Renaming HKCU KEY with VBS

I need to rename an outlook profile for all our users and i would like to add it to one of our VBS logon scripts to rename a key inHKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles

I thought i could use the below but it isn't running with line 5 character 23. Are there any script gurus who could assist?

'***********************************************

        '***********************************************
        'reset values as needed...
        Const HKCU = &H80000001
        Dim regSubKey AsString= "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"
        Dim oldKey AsString = "Outlook"
        Dim newKey AsString = "THT_Default"
        '***********************************************
        '***********************************************

        Dim regKey As RegistryKey = Registry.LocalMachine
        Dim regValue() AsString = regKey.OpenSubKey(regSubKey).GetSubKeyNames

        ForEach s AsStringIn regValue
            If s = oldKeyThen
                Dim nRegValue() AsString = regKey.OpenSubKey(regSubKey & oldKey).GetValueNames
                ForEach sv AsStringIn nRegValue
                    Dim tv AsString = regKey.OpenSubKey(regSubKey & oldKey).GetValue(sv)
                    regKey.CreateSubKey(regSubKey & newKey).SetValue(sv, tv)
                Next
                regKey.DeleteSubKey(regSubKey & oldKey)
            EndIf
        Next


Viewing all articles
Browse latest Browse all 3066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>