![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Re: Update registry with part of Computers Name "Danc383@xxxxxx" <Danc383hotmailcom@xxxxxx> wrote in message news 8780D55-D6DE-44E8-8572-45F58420B68D@xxxxxxQuote: > Hi, > > Please can someone help? > > I have no idea where to start with this.. > > I need a script that when run will find the computers name e.g. > "TSNET-WKS06" > Then updates the registry with the last 2 digits of the computer name > > Key to be updated: > [HKEY_LOCAL_MACHINE\SOFTWARE\LOCDES\SYSIFO\Terminal] > "TerminalId"="1" > > New Value > "TerminalId"="06" > ======== Option Explicit Dim objNetwork, strComputer, objShell ' Retrieve NetBIOS name of computer. Set objNetwork = CreateObject("Wscript.Network") strComputer = objNetwork.ComputerName ' Assign value in local registry. Set objShell = CreateObject("Wscript.Shell") objShell.RegWrite "HKLM\Software\LOCDES\SYSIFO\Terminal\TerminalId, Right(strComputer, 2), "REG_SZ" -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Update registry with part of Computers Name "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote: Your address is still invalid! Quote: > Assuming the script is run on the computer, one solution could be: > ======== > Option Explicit > Dim objNetwork, strComputer, objShell > > ' Retrieve NetBIOS name of computer. > Set objNetwork = CreateObject("Wscript.Network") > strComputer = objNetwork.ComputerName > > ' Assign value in local registry. > Set objShell = CreateObject("Wscript.Shell") > objShell.RegWrite "HKLM\Software\LOCDES\SYSIFO\Terminal\TerminalId, > Right(strComputer, 2), "REG_SZ" REG.EXE ADD "HKLM\Software\LOCDES\SYSIFO\Terminal" /v "TerminalId" /t REG_SZ /d "%COMPUTERNAME:~-2" /f Stefan |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Retrieve Remote Registry Key from netowrk computers | PowerShell | |||
| Won't start after update download...first part | Vista installation & setup | |||
| turn off remote computers - part 2 | PowerShell | |||
| Update or Instal Vista fails "Windows could not update registry da | Vista General | |||
| Install fail at Testing Computers Performance part | Vista installation & setup | |||