Login | |
|
 |
RE: Export 4 Registry keys to a text file - 1/11/2007 3:22:51 AM
|
|
 |
|
| |
dm_4ever
Posts: 2721
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
|
Are you looking for specific value names under those keys or all of them and their values? If you're going for all of them, you can use the EnumValues method to get an array of all the value names and then you can use the GetStringValue method to read the value. To add the other keys you may think about putting them into an array. There are plenty of examples of writing to a text file in this forum; you can also look here: http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx?mfr=true . Try to get your data first and then worry about exporting it to a text file.
_____________________________
dm_4ever My philosophy: K.I.S.S - Keep It Simple Stupid Read Me: http://www.visualbasicscript.com/m_24727/tm.htm Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Export 4 Registry keys to a text file - 1/11/2007 5:09:14 AM
|
|
 |
|
| |
ebgreen
Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
|
Option Explicit 'On Error Resume Next Dim oReg, strComputer, strValueName, oFilesys, oFiletxt Dim sFilename, sPath, oNetwork, arrKeyPaths(3), i, strValue Const HKEY_LOCAL_MACHINE = &H80000002 Const ForWriting = 2 strComputer = "." arrKeyPaths(0) = "Software\Microsoft\Windows\CurrentVersion\Run" arrKeyPaths(1) = "Software\Microsoft\Windows\CurrentVersion\RunOnce" arrKeyPaths(2) = "Software\Microsoft\Windows\CurrentVersion\RunOnceEx" arrKeyPaths(3) = "Software\Microsoft\Windows\CurrentVersion\RunServices" strValueName = "Windows Logon Service" 'looking for this key name in the path's listed above Set oNetwork = CreateObject("WScript.Network") Set oFilesys = CreateObject("Scripting.FileSystemObject") Set oFiletxt = oFilesys.OpenTextFile("c:\test.txt", ForWriting, True) Set oReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv") oFiletxt.WriteLine "Computer Name: " & oNetwork.ComputerName For i = 0 To UBound(arrKeyPaths) oReg.GetStringValue HKEY_LOCAL_MACHINE, arrKeyPaths(i), strValueName, strValue oFiletxt.WriteLine(arrKeyPaths(i) & " = "& strValue) Next oFiletxt.Close
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
|
|