Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
bla
bla
bla
"RegisteredOrganization"="New Company Name Here"
"RegisteredOwner"="New Owner Name Here"
bla
bla
bla
strTemplateRegFile = "C:\TemplateRegFile.reg"
strNewRegFile = "C:\NewRegFile.reg"
strNewUser = InputBox("Please enter a new user name:", "User name", "New User")
strNewCompany = InputBox("Please enter a new company name:", "Computer name", "New Company")
If Trim(strNewUser) <> "" And Trim(strNewCompany) <> "" Then
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Const intForReading = 1
Const intUniCode = -1
Set objTemplateRegFile = objFSO.OpenTextFile(strTemplateRegFile, intForReading, False, intUniCode)
strContents = objTemplateRegFile.ReadAll
objTemplateRegFile.Close
Set objTemplateRegFile = Nothing
strContents = Replace(strContents, "Clone User", strNewUser)
strContents = Replace(strContents, "Clone Company", strNewCompany)
Set objNewRegFile = objFSO.CreateTextFile(strNewRegFile, True, intUniCode)
objNewRegFile.Write strContents
objNewRegFile.Close
Set objNewRegFile = Nothing
strCommand = "regedit /s """ & strNewRegFile & """"
'objShell.Run strCommand, 1, True
MsgBox "New registry settings imported."
Else
If Trim(strNewUser) = "" Then MsgBox "New user was empty. Registry settings not changed."
If Trim(strNewCompany) = "" Then MsgBox "New company was empty. Registry settings not changed."
End If
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"RegisteredOrganization"="Clone Company"
"RegisteredOwner"="Clone User"
ASKER
ASKER
ASKER
new.reg file contents (This file is actually about 1000 lines of info, but the date you need is listed here, and is the only instance starting with "Registered...")
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"RegisteredOrganization"="John Smith"
"RegisteredOwner"="IT Department"
=============================================================
clone.reg file contents...
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\.NETFramework\1.1\S867460]
"InstalledBy"="Clone User"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\MSXML4SP2\Q936181]
"InstalledBy"="Clone User"
[HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Registration]
"NAME"="Clone User"
"COMPAN"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\CyberLink\PowerDVD8]
"UserName"="Clone User"
"Company"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\0B79C053C7D38EE4AB9A00CB3B5D2472\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\0E23E40C6140D434FA9B96967D309AFE\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4F57260AB42358E4596E782BDC274910\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\6030E61781384634B8F8C04C9E73B6CA\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\68AB67CA330100007706010000000020\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\68AB67CA7DA73301B7448A0100000030\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\8A0F842331866D117AB7000B0D610007\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\9040110900063D11C8EF10054038389C\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\9040150900063D11C8EF10054038389C\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\90401A0900063D11C8EF10054038389C\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\9040B30900063D11C8EF10054038389C\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{2BF2E31F-B8BB-40A7-B650-98D28E0F7D47}]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{6BE2A4A4-99FB-48ED-AE1E-4E850389F804}]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\PowerQuest\PartitionMagic\8.0\UserInfo]
"Name"="Clone User"
"Company"="Clone Company"
strCloneRegFile = "d:\ee\Reg\Clone.reg"
strNewRegFile = "d:\ee\Reg\new.reg"
'Array configuration Is
'<Field Name>;<Default Value in Clone File>
arrFields = Array(_
"RegisteredOrganization;Clone Company", _
"RegisteredOwner;Clone User" _
)
Set regExpression = New RegExp
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Const intForReading = 1
Set objCloneRegFile = objFSO.OpenTextFile(strCloneRegFile, intForReading, False)
strCloneContents = objCloneRegFile.ReadAll
objCloneRegFile.Close
Set objCloneeRegFile = Nothing
Set objNewRegFile = objFSO.OpenTextFile(strNewRegFile, intForReading, False)
strNewContents = objNewRegFile.ReadAll
objNewRegFile.Close
Set objNewRegFile = Nothing
For Each strFieldAndDefault In arrFields
strField = Split(strFieldAndDefault, ";")(0)
strDefault = Split(strFieldAndDefault, ";")(1)
'i=InStr(1,strCloneContents,"""" & strField & """=""" & strDefault & """"
'if i>0 then
With regExpression
.Global = True
.IgnoreCase = true
'Match a space (\s)
.Pattern = """" & strField & """="".*"""
End With
Set colMatches = regExpression.Execute(strNewContents)
If colMatches.Count > 0 Then
For Each objMatch In colMatches
strValue = objMatch.Value
strReplaceValue=Split(strValue,"""=""")(1)
wscript.echo strReplaceValue
if Len(strReplaceValue)>0 then
strReplaceValue=Left(strReplaceValue, len(strReplaceValue)-1)
wscript.echo strReplaceValue
strCloneContents=Replace(strCloneContents,strDefault,strReplaceValue)
end if
Next
Else
strValue = ""
End If
Next
'strContents = Replace(strContents, "Clone User", strNewUser)
strContents = Replace(strContents, "Clone Company", strNewCompany)
Set objCloneRegFile = objFSO.CreateTextFile(strCloneRegFile & ".txt", True, intUniCode)
objCloneRegFile.Write strCloneContents
objCloneRegFile.Close
Set objCloneRegFile = Nothing
strCommand = "regedit /s """ & strCloneRegFile & """"
'objShell.Run strCommand, 1, True
MsgBox "New registry settings imported."
strCloneRegFile = "d:\ee\Reg\Clone.reg"
strNewRegFile = "d:\ee\Reg\new.reg"
'Array configuration Is
'<Field Name>;<Default Value in Clone File>
arrFields = Array(_
"RegisteredOrganization;Clone Company", _
"RegisteredOwner;Clone User" _
)
Set regExpression = New RegExp
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Const intForReading = 1
Const intUniCode = 0
Set objCloneRegFile = objFSO.OpenTextFile(strCloneRegFile, intForReading, False, intUniCode)
strCloneContents = objCloneRegFile.ReadAll
objCloneRegFile.Close
Set objCloneeRegFile = Nothing
Set objNewRegFile = objFSO.OpenTextFile(strNewRegFile, intForReading, False, intUniCode)
strNewContents = objNewRegFile.ReadAll
objNewRegFile.Close
Set objNewRegFile = Nothing
For Each strFieldAndDefault In arrFields
strField = Split(strFieldAndDefault, ";")(0)
strDefault = Split(strFieldAndDefault, ";")(1)
With regExpression
.Global = True
.IgnoreCase = true
'Match a space (\s)
.Pattern = """" & strField & """="".*"""
End With
Set colMatches = regExpression.Execute(strNewContents)
If colMatches.Count > 0 Then
For Each objMatch In colMatches
strValue = objMatch.Value
strReplaceValue=Split(strValue,"""=""")(1)
if Len(strReplaceValue)>0 then
strReplaceValue=Left(strReplaceValue, len(strReplaceValue)-1)
strCloneContents=Replace(strCloneContents,strDefault,strReplaceValue)
end if
Next
Else
strValue = ""
End If
Next
'strContents = Replace(strContents, "Clone User", strNewUser)
strContents = Replace(strContents, "Clone Company", strNewCompany)
Set objCloneRegFile = objFSO.CreateTextFile(strCloneRegFile & ".txt", True, intUniCode)
objCloneRegFile.Write strCloneContents
objCloneRegFile.Close
Set objCloneRegFile = Nothing
strCommand = "regedit /s """ & strCloneRegFile & """"
'objShell.Run strCommand, 1, True
MsgBox "New registry settings imported."
ASKER
ASKER
ASKER
ASKER
================changeuc.bat=========================
@Echo Off
Echo Extracting New Owner and Orginization info from Registry
Echo Please Wait....
REG EXPORT "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" C:\DRIVERS\UCUPDATE\new.reg
Echo Extracting Complete!
Echo Processing Extracted data...
C:\DRIVERS\UCUPDATE\clonereplace.vbs
Echo Processing Complete!
Echo Merging new Data into Registry...
REG IMPORT C:\DRIVERS\UCUPDATE\processed.reg
Echo Data merge complete!
Echo System is now fully customized for the new owner!!!
================clonereplace.vbs=====================
strCloneRegFile = "C:\DRIVERS\UCUPDATE\clone.reg"
strNewRegFile = "C:\DRIVERS\UCUPDATE\new.reg"
'Array configuration Is
'<Field Name>;<Default Value in Clone File>
arrFields = Array(_
"RegisteredOrganization;Clone Company", _
"RegisteredOwner;Clone User" _
)
Set regExpression = New RegExp
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Const intForReading = 1
Const intUniCode = -1
Set objCloneRegFile = objFSO.OpenTextFile(strCloneRegFile, intForReading, False, intUniCode)
strCloneContents = objCloneRegFile.ReadAll
objCloneRegFile.Close
Set objCloneeRegFile = Nothing
Set objNewRegFile = objFSO.OpenTextFile(strNewRegFile, intForReading, False, intUniCode)
strNewContents = objNewRegFile.ReadAll
objNewRegFile.Close
Set objNewRegFile = Nothing
For Each strFieldAndDefault In arrFields
strField = Split(strFieldAndDefault, ";")(0)
strDefault = Split(strFieldAndDefault, ";")(1)
With regExpression
.Global = True
.IgnoreCase = true
'Match a space (\s)
.Pattern = """" & strField & """="".*"""
End With
Set colMatches = regExpression.Execute(strNewContents)
If colMatches.Count > 0 Then
For Each objMatch In colMatches
strValue = objMatch.Value
strReplaceValue=Split(strValue,"""=""")(1)
if Len(strReplaceValue)>0 then
strReplaceValue=Left(strReplaceValue, len(strReplaceValue)-1)
strCloneContents=Replace(strCloneContents,strDefault,strReplaceValue)
end if
Next
Else
strValue = ""
End If
'MsgBox "Replacing User: " & strDefault & ", with user: " & strValue
Next
strContents = Replace(strContents, "Clone User", strNewUser)
strContents = Replace(strContents, "Clone Company", strNewCompany)
Set objCloneRegFile = objFSO.CreateTextFile("C:\DRIVERS\UCUPDATE\processed.reg", True, intUniCode)
objCloneRegFile.Write strCloneContents
objCloneRegFile.Close
Set objCloneRegFile = Nothing
================clone.reg (Manually created)================
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\.NETFramework\1.1\S867460]
"InstalledBy"="Clone User"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\MSXML4SP2\Q936181]
"InstalledBy"="Clone User"
[HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Registration]
"NAME"="Clone User"
"COMPAN"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\CyberLink\PowerDVD8]
"UserName"="Clone User"
"Company"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\0B79C053C7D38EE4AB9A00CB3B5D2472\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\0E23E40C6140D434FA9B96967D309AFE\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4F57260AB42358E4596E782BDC274910\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\6030E61781384634B8F8C04C9E73B6CA\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\68AB67CA330100007706010000000020\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\68AB67CA7DA73301B7448A0100000030\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\8A0F842331866D117AB7000B0D610007\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\9040110900063D11C8EF10054038389C\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\9040150900063D11C8EF10054038389C\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\90401A0900063D11C8EF10054038389C\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\9040B30900063D11C8EF10054038389C\InstallProperties]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{2BF2E31F-B8BB-40A7-B650-98D28E0F7D47}]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{6BE2A4A4-99FB-48ED-AE1E-4E850389F804}]
"RegOwner"="Clone User"
"RegCompany"="Clone Company"
[HKEY_LOCAL_MACHINE\SOFTWARE\PowerQuest\PartitionMagic\8.0\UserInfo]
"Name"="Clone User"
"Company"="Clone Company"
"RegisteredOwner"="Clone User"
Set objShell = CreateObject("WScript.Shell")
strCommand = "REG EXPORT ""HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion"" C:\DRIVERS\UCUPDATE\new.reg"
objShell.Run strCommand, 1, True
strCloneRegFile = "C:\DRIVERS\UCUPDATE\clone.reg"
strNewRegFile = "C:\DRIVERS\UCUPDATE\new.reg"
'Array configuration Is
'<Field Name>;<Default Value in Clone File>
arrFields = Array(_
"RegisteredOrganization;Clone Company", _
"RegisteredOwner;Clone User" _
)
Set regExpression = New RegExp
Set objFSO = CreateObject("Scripting.FileSystemObject")
Const intForReading = 1
Const intUniCode = -1
Set objCloneRegFile = objFSO.OpenTextFile(strCloneRegFile, intForReading, False, intUniCode)
strCloneContents = objCloneRegFile.ReadAll
objCloneRegFile.Close
Set objCloneeRegFile = Nothing
Set objNewRegFile = objFSO.OpenTextFile(strNewRegFile, intForReading, False, intUniCode)
strNewContents = objNewRegFile.ReadAll
objNewRegFile.Close
Set objNewRegFile = Nothing
For Each strFieldAndDefault In arrFields
strField = Split(strFieldAndDefault, ";")(0)
strDefault = Split(strFieldAndDefault, ";")(1)
With regExpression
.Global = True
.IgnoreCase = true
'Match a space (\s)
.Pattern = """" & strField & """="".*"""
End With
Set colMatches = regExpression.Execute(strNewContents)
If colMatches.Count > 0 Then
For Each objMatch In colMatches
strValue = objMatch.Value
strReplaceValue=Split(strValue,"""=""")(1)
if Len(strReplaceValue)>0 then
strReplaceValue=Left(strReplaceValue, len(strReplaceValue)-1)
strCloneContents=Replace(strCloneContents,strDefault,strReplaceValue)
end if
Next
Else
strValue = ""
End If
'MsgBox "Replacing User: " & strDefault & ", with user: " & strValue
Next
strContents = Replace(strContents, "Clone User", strNewUser)
strContents = Replace(strContents, "Clone Company", strNewCompany)
Set objCloneRegFile = objFSO.CreateTextFile("C:\DRIVERS\UCUPDATE\processed.reg", True, intUniCode)
objCloneRegFile.Write strCloneContents
objCloneRegFile.Close
Set objCloneRegFile = Nothing
strCommand = "REG IMPORT C:\DRIVERS\UCUPDATE\processed.reg"
objShell.Run strCommand, 1, True
VBScript (Visual Basic Scripting Edition) is an interpreted scripting language developed by Microsoft that is modeled on Visual Basic, but with some important differences. VBScript is commonly used for automating administrative and other tasks in Windows operating systems (by means of the Windows Script Host) and for server-side scripting in ASP web applications. It is also used for client-side scripting in Internet Explorer, specifically in intranet web applications.
TRUSTED BY
http://www.eggheadcafe.com/forumarchives/scriptingVisualBasicscript/Aug2005/post23621926.asp
http://nerds-central.blogspot.com/2008/03/recursive-registry-hive-listing-for.html
Once you've located a value, it is very simple to change it.