Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to change registry settings

Status
Not open for further replies.

bowflyer

IS-IT--Management
Apr 10, 2006
27
US
I need to make some changes in the registry and would like to automate this as much as possible. We have recently gone through a rebranding and need to change everyones communicator login with as little interaction as possible.

I have identified the location in the registry where this setting is held but how to automate?

change "tomj@xxxxbiz.com" to "tom.jones@x4biz.com"

I was hoping for something that could ask for the users new email address, and make the change for them with out them having to do anything else.
 
Don't know what IM you are using so you need to fill in the registry path, but this should work.

Code:
Dim WSHShell
Set WSHShell = CreateObject("Wscript.Shell")

RegPath = "HKCU\Software\RestOfPath\ValueToRead"

IMMail = Split(WSHShell.RegRead RegPath,"@")

If LCase(IMMail(1)) <> "x4biz.com" Then
	WSHShell.RegWrite RegPath, LCase(IMMail(0)) & "@x4biz.com", REG_SZ
End If

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
I get what you are getting at but I also need to change the name.

This is the reg key

[HKEY_CURRENT_USER\Software\Microsoft\Communicator]
"UserMicrosoft RTC Instant Messaging"="tomj@xxxxbiz.com"


I guess ideally I would like it to prompt for what the name will be (they enter "tom.jones@x4biz.com") and apply it to the registry, maybe even say "completed"



thanks a ton for you help

 
Look at the documentation for RegWrite

Use an input box to prompt for the change you want.

or download the docs to reference:

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Code:
If LCase(IMMail(1)) <> "x4biz.com" Then
    NewIM = InputBox("Enter your new IM address")
    WSHShell.RegWrite RegPath, NewIM, REG_SZ
End If

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Dim WSHShell
Set WSHShell = CreateObject("Wscript.Shell")

RegPath = "HKCU\Software\Microsoft\Communicator\UserMicrosoft RTC Instant Messaging"

IMMail = Split(WSHShell.RegRead RegPath,"@")

If LCase(IMMail(1)) <> "x4biz.com" Then
NewIM = InputBox("Enter your Email address")
WSHShell.RegWrite RegPath, NewIM, REG_SZ
End If


I'm getting an error on line 6, char 33
 
Give this ai try instead

IMMail = Split(WSHShell.RegRead(RegPath),"@")

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
getting further now line 10 char 5 invalid procedure or argument

Dim WSHShell
Set WSHShell = CreateObject("Wscript.Shell")

RegPath = "HKCU\Software\Microsoft\Communicator\UserMicrosoft RTC Instant Messaging"

IMMail = Split(WSHShell.RegRead(RegPath),"@")

If LCase(IMMail(1)) <> "x4biz.com" Then
NewIM = InputBox("Enter your Email address")
WSHShell.RegWrite RegPath, NewIM, REG_SZ
End If
 
I have also been experimenting with this, but geeting no where!
----------------------

Dim Input

Input = InputBox("Please Enter your Email Address")

RegPath = "HKCU\Software\Microsoft\Communicator"
RegObj = "UserMicrosoft RTC Instant Messaging"

WSHShell.RegWrite RegPath, RegObj, Input, "REG_SZ"

MsgBox ("Your MS Communicator Settings have been successfully changed. You will need

to sign out and sign back in to complete the process")
 
Sorry I was in a rush when I banged this code out for you. The REG_SZ needs to be enclosed in quotes.

WSHShell.RegWrite RegPath, NewIM, "REG_SZ"

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Markdmac, thanks a ton...

I ended up trimming it down a bit
----
Dim WSHShell
Set WSHShell = CreateObject("Wscript.Shell")

RegPath = "HKCU\Software\Microsoft\Communicator\UserMicrosoft RTC Instant Messaging"

Input = InputBox("Please Enter your Email Address")
WSHShell.RegWrite RegPath, Input, "REG_SZ"
---
thanks for your help, it is working great.

any ideas on what to add to get it to stop and start communicator.exe in the processes after it makes the above change?


 
By using your "trimmed down" version the user will be asked each time the script runs. I wrote mine with the expectation you would set it as a login script. It will then only ask the user once.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
the reason I realized that the user needs to give is because with the rebranding some users opted for name changes also. some of the changes are not consistent.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top