Export registry key value to text or csv

Hello

I'm trying to find a vbscript that will do the following:

1. Look for the key "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\General"
2. Get the value for "UserTemplates" in this key
3. Output the information into a text file with the %computername% and if possible the %username% of the user that's logged into the system, to make easier for finding the user.

The idea behind this is to gather all the paths from a lot of computers and see which ones are using a network path for the User Templates path, as opposed to a path on their local C-Drive  (where it should be).

Targets are Windows XP users. Systems are on a domain. The script output results can be saved to a shared \\server path.
garryshapeAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gintu01Commented:
Select the key then file > Export.  it allows you to select .txt files when saving.
0
johnb6767Commented:
This is simpole batch, not vbs... Thought I would offer it anyway....  :)
@echo off
echo %computername%/%username% >>\\server\share\OfficeGeneral.txt
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>>\\server\share\OfficeGeneral.txt
reg query "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\General" /v "UserTemplates">>\\server\share\OfficeGeneral.txt
echo>>\\server\share\OfficeGeneral.txt

Open in new window

0
johnb6767Commented:
Typo on last line of code.... (surprising huh?)

echo>>\\server\share\OfficeGeneral.txt

should be

echo.>>\\server\share\OfficeGeneral.txt

Adds a space between sections... Not needed, just helps pretty the output....
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

WindowsITAdminCommented:
Here http://gallery.technet.microsoft.com/ScriptCenter/en-us/801ea35e-75d0-4c9f-abb7-47f65a89b478 is a script to read the registry key, then put it into a .txt file.
0
garryshapeAuthor Commented:
Thanks, that works great. The batch works right off the bat. The VBScript helps but I'll need to modify with some research.

Thanks again.
0
mcsweenSr. Network AdministratorCommented:
Here is the VBScript version you asked for...

Option Explicit
On Error Resume Next

Dim wShell, fso, adInfo, strTemplatesVal, strServerShare, strOutFile

strServerShare = "\\SomeServer\SomeShare\"

Const reg1 = "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\General\UserTemplates"

Set wShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set adInfo = CreateObject("ADSystemInfo")

strTemplatesVal = wShell.RegRead(reg1)

Set strOutFile = fso.CreateTextFile(strServerShare & adInfo.ComputerName & "-" & adInfo.UserName & ".txt",true)

If strTemplatesVal <> Null Then
 strOutFile.Write strTemplatesVal
Else
 strOutFile.Write "Key does not Exist " & reg1
End If

Open in new window

0
WindowsITAdminCommented:
If you need help with the vbs script i'll be pleased of helping you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.