Discussion Locked

Windows NT Batch File

0 helpful
26 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am trying to create a batch file for windows NT that will set the following parameters for me after i install windows NT.

Set the time zone to : central time zone
Set the display properties to : 1280 X 1024
Set the color to : 65536 colors
create 2 shortcuts on desktop to a program in: D:\winnt
Create a user account: user
Password : user
Set : password never expires
Set : user cannot change password
clear: user must change password at logon
Add user to power users group and make group log on as a service
Add environment variable to the Path variable: %home%\scripts;%home%\bin;%dir%\scripts;%dir%\bin
Add new variables: home=d:\dir\home
New variable : dir = d:\dir\cust

Could you let me know if this can be all done by usinga batch file ?

26 replies

by mtnsqs

I am not sure if all this can be done from a batch file, but it obvious that you are commonly building machines with the same setup. If hardware is similar across them all, then why not look at getting GHOST from Nortons - it will let you take an image of one machine after your get the set up right, save it on your network or a CD and with an appropriate boot floppy you can then rebuild any system using the GHOST. I have used it extensively and found it saved so much time in the long run. Ihad to have about 3 or 4 basic images as we had a few different hardware setups.

by emcs

Look at Reg. It is a Freeware Command Line / Batch Registry & Environment editor. Key word is free.

REG is a handy Registry and Environment Variable batch and command line tool that supports operations on the following Registry Hives:

HKEY_LOCAL_MACHINE
HKEY_USERS
HKEY_CURRENT_USER

REG will:
? Add and Delete a Registry Key.
? Add, Delete and Change a Registry Value. It supports Value Types of:

REG_SZ
REG_DWORD
REG_MULTI_SZ
REG_EXPAND_SZ

? Add and Delete a directory in either the SYSTEM or USER PATH.
? Setting an Environment Variable in either the SYSTEM or USER environment.
? Setting Environment and PATH variables from a file.
? Setting multiple options from a file.
? Setting a RegistryValue from the keyboard.

You can download Reg from: http://www.mindspring.com/~dgthomas/index.htm.

If I understand what you want to do, between running Reg, and using some common batch file parameters, you should be able to do everthing you want.

Good luck.

dennie

by ds9

Hi,

Why not just set up a USER profile with those parameters, and copy it as needed.

George

by shanghai sam

The first two answers would help in your situation. You could aslo use WINBATCH from Wilson Windowware (www.winbatch.com). It costs USD 100.
As for specific answers to your question
I do not believe the time zone and display properties can be set through a batch file.
For the shortcuts you can create them in a floppy/CD/network share and then copy them (in a batch file) to C:\winnt\profiles\AllUsers\Desktop or to a specificuser\Desktop.
Creating a user account (Next 3 lines are 1)
net user username password /add /expires:NEVER /passwordchg:no
Another option for user creation is to use the ADDUSERS Resource Kit utility
Add user to power users group use the command
net group "Power Users" username /add.
If this is a local user on a member server or a standalone server you should use
net localgroup "Power Users" username /add.
To make group log on as a service you will need to use WinBATCH or some other process.
Haven't exactly figured out a way of automating permanent changes to environment variables. Again Winbatch will definitely help with this.

by cdcents

The first two answers would help in your situation. You could aslo use WINBATCH from Wilson Windowware (www.winbatch.com). It costs USD 100.
As for specific answers to your question
I do not believe the time zone and display properties can be set through a batch file.
For the shortcuts you can create them in a floppy/CD/network share and then copy them (in a batch file) to C:\winnt\profiles\AllUsers\Desktop or to a specificuser\Desktop.
Creating a user account (Next 3 lines are 1)
net user username password /add /expires:NEVER /passwordchg:no
Another option for user creation is to use the ADDUSERS Resource Kit utility
Add user to power users group use the command
net group "Power Users" username /add.
If this is a local user on a member server or a standalone server you should use
net localgroup "Power Users" username /add.
To make group log on as a service you will need to use WinBATCH or some other process.
Haven't exactly figured out a way of automating permanent changes to environment variables. Again Winbatch will definitely help with this.

by cdcents

Do not rate answer 4 as my session timed out while I came up with the answer.

by ratnayake_j

I know the way to add shortcuts to the desktop, and to add the users, but the other stuff I am not sure of. If you want to know mail me.

by spn

Why does it have to be a batch file?The best i can think of is to create a manditory policy that is copied from a shared dir on the server that will take care of most of the settings , then the short cuts are simpal enouph.

(Is this a work group or a domain?, are you runing a full NT enviorment? , the details are very important for complete and accurate answers)

by pbgerrard

It would take a lot of work to create any sort of file to do what you want to do. If we are talking about one machine I would create those settings manually.

If you are trying to create those settings on a lot of machines it is a different story. Windows NT is funny about BAT files, so you may not want to use a BAT file to do it. I would think it is possible to do, but it would take a lot of work and time. It may be faster to manually adjust the settings even if you have to adjust a whole network.

If you are willing to spend some money, you may consider purchasing Ghost or some other Symantec software. I think they make a few. That would make it exteremly easy to set up a whole network with the parameters you gave.
That is probably the best way. Ghost does not cost too much, especially considering how much work has to be put into doing it manually.

Also you may be able to setup one computer like that and copy the settings to the others without Ghost, but Ghost is the best tool to use.

by zlatin zlatev

Well not all, and not only with a batch file but it can be done
____
Legend:
*reg* - with additional REG file
*wsh* - from the Windows Scripting Host (VBScript/JScript)
*bat* - can be done in the bat file
____
*reg* Set the time zone to : central time zone
Configure one of the machines to that time zone and export the following key from registry:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]

*reg* Set the display properties to : 1280 X 1024
*reg* Set the color to : 65536 colors
the same export key:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\i81xnt4\Device0]

This key is for i810 graphic controler "i81xnt4" If your grafic controlleris different
this key will differ too

(continues)

by zlatin zlatev

*wsh* create 2 shortcuts on desktop to a program in: D:\winnt
There are wsh sample scripts (.VBS and .JS) that came with Windows'98 and are appliable
to Windows NT
see Shortcut.vbs

*bat*
Create a user account: username
...
Add user to power users group

use coomands like the following:

NET USER username userpass /ADD /expires:never /passwordchg:no
NET LOCALGROUP "Power Users" username /add /domain

According to MS this should do what you need. HOWEVER it does not set the password expiration properly.
For more info see Windows NT Help - Net (command options)

*???* and make group log on as a service
I'm not sure I have understand this

*wsh* Add environment variable to the Path variable: %home%\scripts;%home%\bin;%dir%\scripts;%dir%\bin

see Registry.vbs
You will need api calls for reading the initial PATHstring and then append to it

If you are sure that the path will be the same for all machines you can use a reg file exported from key
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]

*reg* Add new variables: home=d:\dir\home
*reg* New variable : dir = d:\dir\cust
Use RegFile like the following (text between asterics "***")
***
REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]
"home"="d:\dir\home"
"dir = d:\dir\cust"
***

Hope this helps,
Zlatin Zlatev, MCP

by zlatin zlatev

due to some "features" of TechRepublic, there are some bugs (whitespaces and line-breaks) in my answer. If you wish notify me by email to send you the solution.
Best Regards,
Zlatin Zlatev,
Programmer Mentor & Software Engineer,
JEI-Bulgaria

by wcraigmiles

Kix32 will let you set registry keys and can run during a login. Kix32 is a batch file and scripting program. Very nice.

Also, look at the sysprep and sysdif utilities. You should be able to set different setting in a text file for the individual users.

This discussion is closed to new replies.