MSFN Forum: Help: Script to rename a computer and edit the registry. - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Help: Script to rename a computer and edit the registry. Need assistance to create a simple script. Rate Topic: -----

#1 User is offline   Samio866 

  • Newbie
  • Group: Members
  • Posts: 11
  • Joined: 01-June 09

Posted 26 May 2010 - 02:57 PM

Hi Everyone,

Haven't been to the forums for a while but I'm glad to be back. The forums looks to have change somewhat but I'm sure the people here are still friendly. :thumbup

Situation: After imaging the system with a ghost image... we don't know what the computer will be named until its tied to another bigger machine by the serial port...:lol: However, once that information is found, we have to manually rename the computer and join it to what-ever workgroup.

Problem: Can or does someone have a script that asks what the new computer name will be and also modifies the registry to reflect a change in a program? I will give more details on what needs to be changed in the registry in a little bit... after finding out more information.


For now, I want to learn to create/or have a script that we can use in the initial deployment once its coupled to some other thing.

What should happen is that as we run this script or program.... it ask's

- What do you want the computer name?
We then type in "PC-100"

- What do you want the registry key changed to?
We then type in "100"

- Thanks for the information, please reboot to take effect.
We then press OK.


Shouldn't be too hard... Once I've figured out what needs to be changed in the registry, I'll post back.


#2 User is offline   Samio866 

  • Newbie
  • Group: Members
  • Posts: 11
  • Joined: 01-June 09

Posted 26 May 2010 - 03:12 PM

I found what needs to be altered in the registry. HKEY_CURRENT_USER/SOFTWARE/PROGRAM/ID

Type is REG_SZ
Data contains regular characters.....

I can edit the script to reflect the "program" and "id".

Thanks in advance.

#3 User is offline   allen2 

  • Not really Newbie
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,439
  • Joined: 13-January 06

Posted 26 May 2010 - 04:04 PM

To rename: http://support.microsoft.com/kb/298593
And reg.exe is here for your registry needs.

#4 User is offline   cluberti 

  • Gustatus similis pullus
  • Group: Supervisor
  • Posts: 11,000
  • Joined: 09-September 01
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 26 May 2010 - 04:39 PM

Technically this could also go into the programming section, but it seems unattended-specific so placing this here.

#5 User is offline   Outbreaker 

  • Member
  • PipPip
  • Group: Members
  • Posts: 195
  • Joined: 08-August 07

Posted 26 May 2010 - 07:41 PM

Change Computer name to: "Computer-(4 Random Numbers)" ->

Quote

WMIC ComputerSystem where name="%ComputerName%" CALL RENAME name="Computer-%RANDOM:~-4%"

Change Computers Domain or Workgroup ->

Quote

WMIC ComputerSystem where name="%ComputerName%" CALL JoinDomainOrWorkgroup name="WORKGROUP"

This post has been edited by Outbreaker: 26 May 2010 - 07:42 PM


#6 User is offline   Samio866 

  • Newbie
  • Group: Members
  • Posts: 11
  • Joined: 01-June 09

Posted 27 May 2010 - 07:20 AM

How can I put that in a format where it prompts and we input the additional information?

#7 User is offline   Outbreaker 

  • Member
  • PipPip
  • Group: Members
  • Posts: 195
  • Joined: 08-August 07

Posted 27 May 2010 - 09:07 AM

How do you want it like DOS input style ?

#8 User is offline   Samio866 

  • Newbie
  • Group: Members
  • Posts: 11
  • Joined: 01-June 09

Posted 27 May 2010 - 11:17 AM

Doesn't matter... as-long semi technical people can understand, input 2 or 3 characters, and the script handles the rest.

I completed a little script earlier today so I'm off to test it.

This post has been edited by Samio866: 27 May 2010 - 11:18 AM


#9 User is offline   cluberti 

  • Gustatus similis pullus
  • Group: Supervisor
  • Posts: 11,000
  • Joined: 09-September 01
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 27 May 2010 - 01:54 PM

This might be best run as an HTA which drives the WMIC calls from user input.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy