Jump to content

ComputerName from a textfile


Recommended Posts

I am not sure if it is possible but can I somehow get the unattend file to grab a computername from a file or place other then in the file itself? I am tring to make a script that will ask a few questions then do a total unattended install. At the moment the install stops to ask for the computername but if it could look in a set directory for a file that I have set before initiatiing the install that would be great. I am using a winPE disk and doing the install from a network share. Any help would be great....thanks

Link to comment
Share on other sites


Hi,

I'm currently busy with a small program which will add a few features to the unattended installs, i call it 'useradd' at the moment, and it's first meaning was

to easy create users and groups with an unattended install. I will checkout if it's possible to add the computer's name (and workgroup) with it, maybe even hanging the computer in a domain?

It's not 100% finished yet (the productkey option doesnot work).

It's very easy you just make an ini file and put it on floppy, the inifile looks like this:

[WINDOWS]

PRODUCTKEY=type here the wanted product key ! XP Volume licensing only !!

ADMINPASSWORD=type here the wanted administrator password

[GROUPS]

;GroupName=Group Description

MyFirstGroup=This is my first group

MySecondGroup=This is my second group

[uSERS]

;username=password[,fullname,description]

MyFirstUser=MyPassWord,My First User, This Is My First User

MySecondUser=MyPassWord,My Second User, This Is My Second User

[GROUPUSERS]

;groupname=user1,user2,user3,...

MyFirstGroup=MyFirstUser,MySecondUser

MySecondGroup=MySecondUser

You then put the useradd.exe in the $oem folder, and refer to it from the cmdlines.txt file, like this:

[COMMANDS]

"useradd.exe"

The program will check all available drives for a x:\users.ini and process the options found on it. Users and Groups allready work, even the Administrator Passworrd. I will check this weekend for the computername etc.

Link to comment
Share on other sites

This topic has been done before here

Basically, if you know the MAC address of each computer's primary network card, you can use the following batch file:

ECHO.
ECHO Setting Computer Name
ECHO Please wait...
for /f "tokens=1" %%i IN ('compname /d ?m') do set MAC=%%i
IF %MAC% == 123456789012 compname /c SCRAPHEAP
IF %MAC% == ABCDEFGHIJKL compname /c SANDBOX
IF %MAC% == 11AA22BB33CC compname /c STELLAR

I hope this helps

If you only want to set the computer name for just the one computer (meaning the disk will always set the computer name you want) just add the setting into your winnt.sif! and if you want it to set up user accounts, it can be done very easily with a short batch file run from cmdlines.txt

addusers.cmd

net user "Username 1" a_password /add
net localgroup Administrators "Username 1" /add
net user "Username 2" another_password /add
net localgroup Administrators "Username 2" /add

or if you want you can have it ask you what user name to add

set /p username=Enter a username:  
set /p password=Enter a password:  
net user "%username%" %password% /add
net localgroup Administrators "%username%" /add

Setting computer name via batch file:

set /p comp=Enter the Computer Name you want:  
compname /c %comp%

Link to comment
Share on other sites

Ok, but now you have al kinds of things on your unattended cd. I plan to use my little tool so i need only 1 unattended CD, and put all kinds of simple configuration options on a file on floppy disk. So if i have to install a computer, just have to edit the 'users.ini', and boot the CD. I will take a look to automate computernaming (random or bases on MAC). Maybe i'll put in a naming service, so you can have a db on the backend, the installation connects with the db and give's the computer the name as specified in the db. So the sysadmin can set this things from his chair. Identification would be done bases on MAC then.

Link to comment
Share on other sites

The T12 time is after a computer is added to a domain so some funky computer name will be added and then changed when the util is ran. That would mess up my AD big time....I will give it a shot though...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...