Computer naming convention

G

Guest

I am looking at improving the naming off computers by using a text file as a
base for the computer name.
My first thought was using a set variable but I can’t find a way to get
information for the set variable from a text file.
If anyone has any other suggestions please let me know.
Thanks
Hans
 
P

Pegasus \(MVP\)

hans jacobsen said:
I am looking at improving the naming off computers by using a text file as a
base for the computer name.
My first thought was using a set variable but I can't find a way to get
information for the set variable from a text file.
If anyone has any other suggestions please let me know.
Thanks
Hans

Writing an environmental variable into a text file is easy:

echo %ComputerName% >> c:\names.txt

However, this may not be the full story. I suggest you
give a detailed example so that we can see what exactly
you're trying to do.
 
G

Guest

I wan’t to use sysprep and unattended to automate the installation of
computers.
The biggest challenge is getting a computer name that we can track.
We have found a utility that will make it possible to rename the computer
after the installation. We need to be able to read the computer name from the
file and use that either with the utility or net name command. After the
command has been run it also needs to delete the entry in the text file so it
won’t be used again.
Hope this clarifies my question.
 
G

Guest

I wan’t to use sysprep and unattended to automate the installation of
computers.
The biggest challenge is getting a computer name that we can track.
We have found a utility that will make it possible to rename the computer
after the installation. We need to be able to read the computer name from the
file and use that either with the utility or net name command. After the
command has been run it also needs to delete the entry in the text file so it
won’t be used again.
Hope this clarifies my question.
 
S

Shenan Stanley

hans said:
I wan't to use sysprep and unattended to automate the installation of
computers.
The biggest challenge is getting a computer name that we can track.
We have found a utility that will make it possible to rename the
computer after the installation. We need to be able to read the
computer name from the file and use that either with the utility or
net name command. After the command has been run it also needs to
delete the entry in the text file so it won't be used again.
Hope this clarifies my question.

So something like a batch script using NewSID or some similar utility?
NETDOM to join the domain/correct OU?
 
G

Guest

Yes something like that.
But which commands can I use?
I also need to delete the entry from the text file when it has been used.

Thanks
Hans
 
P

Pegasus \(MVP\)

hans jacobsen said:
Yes something like that.
But which commands can I use?
I also need to delete the entry from the text file when it has been used.

Thanks
Hans

How about something like this:

[1] @echo off
[2] set name=
[3] for /F %%a in (c:\PCNames.txt) do set name=%%a
[4] type c:\PCNames.txt | find /i /v "%name%" > c:\PCNames.tmp
[5] copy c:\PCNames.tmp c:\PCNames.txt

The batch file will extract names from c:\PCNames.txt, one name
at a time, starting at the bottom.
 
G

Guest

But will it delete the entry since the next client does not know that the
entry has been used?
And the file needs to be located on a network share.

Hans Petter.

Pegasus (MVP) said:
hans jacobsen said:
Yes something like that.
But which commands can I use?
I also need to delete the entry from the text file when it has been used.

Thanks
Hans

How about something like this:

[1] @echo off
[2] set name=
[3] for /F %%a in (c:\PCNames.txt) do set name=%%a
[4] type c:\PCNames.txt | find /i /v "%name%" > c:\PCNames.tmp
[5] copy c:\PCNames.tmp c:\PCNames.txt

The batch file will extract names from c:\PCNames.txt, one name
at a time, starting at the bottom.
 
P

Pegasus \(MVP\)

When you try the batch file then you will see that it deletes
the extracted entry. The location of the text file does
not matter in the least - just specify it correctly!


hans jacobsen said:
But will it delete the entry since the next client does not know that the
entry has been used?
And the file needs to be located on a network share.

Hans Petter.

Pegasus (MVP) said:
Yes something like that.
But which commands can I use?
I also need to delete the entry from the text file when it has been used.

Thanks
Hans

:

hans jacobsen wrote:
I wan't to use sysprep and unattended to automate the installation of
computers.
The biggest challenge is getting a computer name that we can track.
We have found a utility that will make it possible to rename the
computer after the installation. We need to be able to read the
computer name from the file and use that either with the utility or
net name command. After the command has been run it also needs to
delete the entry in the text file so it won't be used again.
Hope this clarifies my question.

So something like a batch script using NewSID or some similar utility?
NETDOM to join the domain/correct OU?

--
<- Shenan ->
--
The information is provided "as is", it is suggested you research for
yourself before you take any advice - you are the one ultimately
responsible for your actions/problems/solutions. Know what you are
getting into before you jump in with both feet.

How about something like this:

[1] @echo off
[2] set name=
[3] for /F %%a in (c:\PCNames.txt) do set name=%%a
[4] type c:\PCNames.txt | find /i /v "%name%" > c:\PCNames.tmp
[5] copy c:\PCNames.tmp c:\PCNames.txt

The batch file will extract names from c:\PCNames.txt, one name
at a time, starting at the bottom.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top