Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sysprep script for renaming hostname/joining domain

Posted on 2010-09-07
3
Medium Priority
?
1,307 Views
Last Modified: 2013-12-12
I'm trying to come up with a script that can do this and I'm completely lost, and frankly I'm not even sure it's possible.

We have lost of machines, all of which  need a hostname of host****, being the numbers. So an example would be host0001, or host1274. All machines are identical so they can easily be sysprepped, it's just getting this hostname thing down.

I want the hostname automated. This would be fairly simple if it wasn't for the fact that this sysprep is also used on repaired/replacement computers. Which means the script needs to see that for ex:

host0383 is damaged, removed from the room, new system brought in its place, and set in. The script needs to see that 1-382 is taken, but 383 is not longer alive (like no ping) and therefore it takes 383 and assignes it that host number. So far I have two ideas, but no idea behind the coding of either.

First idea, can the script ping each number, running ping host0001 ect, each time skipping the number because the system replied back, until it hits one that doesn't reply back.

Second idea, run a database of some sort that simply has the host names with an Active and Non-Active designation. A webGUI could be used to mark a system number as non-active when it's going to be repaired/replaced. The script could then maybe take the next non-active number *and* mark that number in the database as active.

Any ideas folks? The hosts should be Windows 7 Enterprise being joined to a Windows Server 2008 R2 server.
0
Comment
Question by:Casey Weaver
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 42

Accepted Solution

by:
Adam Brown earned 1800 total points
ID: 33622236
One of the big limitations you're going to run into is that a computer still exists in active directory even if you can't ping it. The computer has to be removed from Active Directory or you will have errors when you attempt to take that name again. I can tell you, also, that Windows Deployment Server (which is a part of Windows 2008) can do almost all of what you need. It will automatically add any computers that are set up with an image through WDS to the Domain unless told not to. Naming setup is done fairly easily through the GUI for WDS. You can configure that to use a naming convention like HOST#### and it will check the active directory database for existing names and use an acceptable name with that convention automatically. For information and instructions for setting up WDS, go here: http://technet.microsoft.com/en-us/library/cc766320%28WS.10%29.aspx
0
 
LVL 8

Assisted Solution

by:spinzr0
spinzr0 earned 200 total points
ID: 33623939
You can do the ping and if it doesn't respond delete it from AD before adding the new PC.  The issue is what if a PC is off?  It will be removed from the domain.  Plus, if you have 1000+ machines it will take a while to do all those pings.
0
 
LVL 7

Author Closing Comment

by:Casey Weaver
ID: 33736996
I ended up with WDS, and used MDT to make the images. I'm still working with setting up MDT to use a SQL database stored on the server using SQL 2008 Express, and if it works I'll leave a comment here. But for now I'll close the question this way. Because it points me in the direction, I will say the WDS answer is good because I never thought of that before the suggestion.

Here's a link to what I'm following:
http://www.windowsnetworking.com/articles_tutorials/Deploying-Windows-7-Part15.html 
0

Featured Post

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Question has a verified solution.

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

How to deal with a specific error when using the Enable-RemoteMailbox cmdlet to create a mailbox in the cloud-based service, for an existing user in an on-premises Active Directory.
A bad practice commonly found during an account life cycle is to set its password to an initial, insecure password. The Password Reset Tool was developed to make the password reset process easier and more secure.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Suggested Courses

721 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