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 As String= "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"
Dim oldKey As String = "Outlook"
Dim newKey As String = "THT_Default"
'***********************************************
'***********************************************
Dim regKey As RegistryKey = Registry.LocalMachine
Dim regValue() As String = regKey.OpenSubKey(regSubKey).GetSubKeyNames
For Each s As String In regValue
If s = oldKey Then
Dim nRegValue() As String = regKey.OpenSubKey(regSubKey & oldKey).GetValueNames
For Each sv As String In nRegValue
Dim tv As String = regKey.OpenSubKey(regSubKey & oldKey).GetValue(sv)
regKey.CreateSubKey(regSubKey & newKey).SetValue(sv, tv)
Next
regKey.DeleteSubKey(regSubKey & oldKey)
End If
Next