none
Registry Edit RRS feed

  • Question

  • I am trying to edit a registry entry, but I only want to edited part of the string. Here is the entry and what I want to edit

    Name=ConnectionString

    Data='ServerDSN=Live113;UID=USER4686243;PWD=PWD4686243;ServerName=afomain09;Connection Lifetime=5;

    The only thing I want to edit is the ServerName=afomain09

    Is there a way to ignore the rest of the string or return what is already there with the exception of what I want to edit?

    Wednesday, November 26, 2014 10:02 PM

Answers

  • Sorry for the late reply.

    This worked great for one computer! But I need to use it on multiple computers and they each have their own UID and PWD. 

    How can I grab their independent UID and PWD and return it? 

    That is exactly the opposite of what you originally asked for. What I see you posting is that you do not know how to se PowerShell and PS variables and are looking for someone to incrementally edit this for you.

    I will post one more solution and a link.  I recommend using the link to learn what all of this means and how to use it. This is called scripting and it is done by crating a set of lines that are instructions on how to obtain a specific outcome.

    Here  is the solutions:

    $s="ServerDSN=Live113;UID=$uid;PWD=$pwd;servername=$servername;Connection Lifetime=5"

    Now you have all of the replacements you need.  You just have to learn how to run PowerShell so start here:

    http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx


    ¯\_(ツ)_/¯

    • Marked as answer by Peter8701 Tuesday, December 2, 2014 6:22 PM
    Tuesday, December 2, 2014 3:53 PM

All replies

  • Yes, there is. It largely depends on the tool you intend to use, e.g. reg.exe, VBScript, PowerShell. It would be a good idea if you posted your own script that gets you part of way.
    Wednesday, November 26, 2014 10:24 PM
  • I have been using powershell, but I think I'll need to change it to a VBScript because I'll be running it on Windows 7 and Windows XP computers.

    Here is what I have in Powershell so far:

    Set-ExecutionPolicy -ExecutionPolicy bypass -Force
    Set-Location HKLM:\SOFTWARE\Wow6432Node\PROFITsystems\PSI113\CLIENT\Paths

    Set-ItemProperty -Path 'Demo Data' -pspropert connectionstring -value 'ServerDSN=Demo113;UID=strUID;PWD=strPWD;servername=afomain15;Connection Lifetime=5;'

    Set-ItemProperty -Path 'Live Data' -pspropert connectionstring -value 'ServerDSN=Live113;UID=USER4684243;PWD=PWD4686243;servername=afomain15;Connection Lifetime=5'

    Set-ItemProperty -Path 'Live Data' -pspropert GenericConnectionString -value 'ServerDSN=Live113;UID=strUID;PWD=strPWD;servername=afomain15;Connection Lifetime=5;'

    Set-ItemProperty -Path 'Live Data' -pspropert Server -value afomain15

    The string with the UID and PWD is the string that I need to ignore everything except 'ServerName=afomain09'

    Thank you in advance for any and all your help and/suggestions!

    Wednesday, November 26, 2014 10:42 PM
  • It appears that you are creating these values.  Why not change them before you create them?

    Your quesiton is a bit vague.  What is the end purpose.  DOn't say how you are trying to do this say what you want to do.


    ¯\_(ツ)_/¯

    Wednesday, November 26, 2014 11:09 PM
  • I want to change the 'ServerName=afomain09' to 'ServerName=afomain15' without changing anything else in the string.
    Wednesday, November 26, 2014 11:26 PM
  • Like ths:

    $s='ServerDSN=Live113;UID=USER4684243;PWD=PWD4686243;servername=afomain15;Connection Lifetime=5'
    $s=$s -replace 'servername=afomain09','servername=afomain15

    Just "replace" the matching bits.


    ¯\_(ツ)_/¯


    • Edited by jrv Wednesday, November 26, 2014 11:41 PM
    • Proposed as answer by jrv Wednesday, November 26, 2014 11:42 PM
    Wednesday, November 26, 2014 11:41 PM
  • Sorry for the late reply.

    This worked great for one computer! But I need to use it on multiple computers and they each have their own UID and PWD. 

    How can I grab their independent UID and PWD and return it? 

    Tuesday, December 2, 2014 3:38 PM
  • Sorry for the late reply.

    This worked great for one computer! But I need to use it on multiple computers and they each have their own UID and PWD. 

    How can I grab their independent UID and PWD and return it? 

    That is exactly the opposite of what you originally asked for. What I see you posting is that you do not know how to se PowerShell and PS variables and are looking for someone to incrementally edit this for you.

    I will post one more solution and a link.  I recommend using the link to learn what all of this means and how to use it. This is called scripting and it is done by crating a set of lines that are instructions on how to obtain a specific outcome.

    Here  is the solutions:

    $s="ServerDSN=Live113;UID=$uid;PWD=$pwd;servername=$servername;Connection Lifetime=5"

    Now you have all of the replacements you need.  You just have to learn how to run PowerShell so start here:

    http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx


    ¯\_(ツ)_/¯

    • Marked as answer by Peter8701 Tuesday, December 2, 2014 6:22 PM
    Tuesday, December 2, 2014 3:53 PM
  • Thank you for the solution. And you are right I am very new to PowerShell and I was looking for someone else's knowledge to help speed up my process. Thank you again for your help.
    Tuesday, December 2, 2014 6:22 PM