Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Rename Computer Vbs Script

Posted on 2012-09-21
6
Medium Priority
?
939 Views
Last Modified: 2012-10-01
I need help with a script that will remotely rename a computer that is part of Active Directory. I would like to use psexec or something that will allow me to do this without login on to the computers. They are running windows 7. Thanks a lot.
0
Comment
Question by:begeorge
  • 3
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
akq-HH earned 1500 total points
ID: 38422020
no script needed....

netdom renamecomputer old-name /newname:new-name /userd:administrator

http://technet.microsoft.com/de-de/library/cc788029%28v=ws.10%29.aspx
0
 

Author Comment

by:begeorge
ID: 38433369
This command is great. However is there
A way to rename multiple machines at once? Thanks in advance
0
 
LVL 1

Assisted Solution

by:akq-HH
akq-HH earned 1500 total points
ID: 38443801
You could use powershell.

Here is an example:
Create a txt file with all computers and accounts (or use Excel and export to csv)

OldName,NewName,Account
pc1-old,pc1-new,AdminA
pc2-old,pc2-new,AdminB
pc3-old,pc3-new,AdminA

create a powershell script:
$computers = Import-Csv c:\scripts\computers.txt
foreach ($c in $computers) {
	"netdom renamecomputer $($c.OldName) /NewName:$($c.NewName) /UserD:$($c.Account)"
	#netdom renamecomputer $($c.OldName) /NewName:$($c.NewName) /UserD:$($c.Account)
}

Open in new window

Line 1 prints out all commands (line 2 would execute them directly)
And if you need different parameters, simply adjust your csv file.

Another easy way is to create all commands in Excel using string concatination and auto fill.
Copy and Paste the results to a console to execute them.

I tried to build a small sample but unfortunately my Excel Version is german. (german commands)
0
 

Author Comment

by:begeorge
ID: 38444331
Will this script prompt me for a password every time it executes line 2?
0
 
LVL 1

Expert Comment

by:akq-HH
ID: 38444799
Same password for all Computers? Add it to your command line. (/PasswordD:password)

Diffent Passwords?

Adjust your csv file like this....

OldName,NewName,Account,Password
pc1-old,pc1-new,AdminA,PassA
pc2-old,pc2-new,AdminB,PassB
pc3-old,pc3-new,AdminA,PassA

and add one additional parameter at the end of line 2:  /PasswordD:$($.c.Password)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Wouldn't it be nice if objects in Active Directory automatically moved into the correct Organizational Units? This is what AutoAD aims to do and as a plus, it automatically creates Sites, Subnets, and Organizational Units.
Scripts are great for performing batch jobs against users, however sometimes the GUI is all you need.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

571 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