[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Create a vbscript from a an exported REG File

Posted on 2007-10-08
7
Medium Priority
?
839 Views
Last Modified: 2008-01-09
Good Morning,

I hope someone can help. I have exported a Registry entry as shown below;

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\WirelessLive]

[HKEY_CURRENT_USER\Software\WirelessLive\eMailSMS]
"Form"="2"
"Reply"=" 1"
"Number"="+44"
"CCEmail"="1"
"NoModify"="0"
"AlphaNumber"=""
"Signature"=""
"Options"="0"
"Expires"="0"


What I would like to do is to create a vbscript for the above

Kind Regards,

Mus.
0
Comment
Question by:Barnardos_2LS
  • 3
  • 2
  • 2
7 Comments
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20039009
Hi,

'Import Registry Settings

set oFile  = CreateObject("scripting.FileSystemObject")    
set oShell = CreateObject("wscript.shell")
           
    sRegFile = "C:\WINDOWS\DESKTOP\ENTRY.REG"
       
        if oFile.FileExists(sregfile) then
        iReturn = oShell.Run("regedit.exe /s" & sRegFile)
            if iReturn <> 0 then
              wscript.echo "Import Reg Settings Failed! " & err.number & ":" & err.description
            end if
    else
        wscript.echo "Registry Import Failed."
    end if

set ofile = nothing
set oshell = nothing

Will this help?
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 20039070
You can also use the RegWrite method of the WScript.Shell object....
http://msdn2.microsoft.com/en-us/library/yfdfhz1b.aspx

Regards,

Rob.
0
 
LVL 1

Author Comment

by:Barnardos_2LS
ID: 20039617
Hi Chandru,

Thanks for this, what i would like to do is actually to write these values in without using the dektop as I will be using a GPO to run at logon to drop this entry into the registry.

Is there a way we could use RegistryEdit or RegistryWrite commands to establish this.

Reagards,

Mus.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Expert Comment

by:chandru_sol
ID: 20041336
You can store this file in a common share or your netlogon share or we could use the script as suggested by Rob.

I will try and put it in that way and see if it works out for you.
0
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20041362
Can you let me know what are the registry? string or .....?
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 1500 total points
ID: 20045793
This will enter all of the values, as REG_SZ values (string)....

'==========
Dim objShell, bKey

Set objShell = WScript.CreateObject("WScript.Shell")

objShell.RegWrite"HKCU\Software\WirelessLive\eMailSMS\Form", "2", "REG_SZ"
objShell.RegWrite"HKCU\Software\WirelessLive\eMailSMS\Reply", "1", "REG_SZ"
objShell.RegWrite"HKCU\Software\WirelessLive\eMailSMS\Number", "+44", "REG_SZ"
objShell.RegWrite"HKCU\Software\WirelessLive\eMailSMS\CCEmail", "1", "REG_SZ"
objShell.RegWrite"HKCU\Software\WirelessLive\eMailSMS\NoModify", "0", "REG_SZ"
objShell.RegWrite"HKCU\Software\WirelessLive\eMailSMS\AlphaNumber", "", "REG_SZ"
objShell.RegWrite"HKCU\Software\WirelessLive\eMailSMS\Signature", "", "REG_SZ"
objShell.RegWrite"HKCU\Software\WirelessLive\eMailSMS\Options", "0", "REG_SZ"
objShell.RegWrite"HKCU\Software\WirelessLive\eMailSMS\Exires", "0", "REG_SZ"

MsgBox "Done"
'==========

Regards,

Rob.
0
 
LVL 1

Author Comment

by:Barnardos_2LS
ID: 20136944
Good Morning Rob,

Thankls for this, it worked a treat.

Kind Regards,

Mus.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Loops Section Overview
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question