Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scripting help. 2

Status
Not open for further replies.
Joined
Jan 10, 2001
Messages
2,873
Location
US
I am being forced to create login scripts for users now. My problem is I do not know how to do it. Can anyone help me out a bit on this? They will be logon scripts. Actually scripting in genereal is not what I am used to doing. James Collins
Systems Support Engineer
A+, MCP

email: butchrecon@skyenet.net

Please let us (Tek-tips members) know if the solutions we provide are helpful to you. Not only do they help you but they may help others.
 
OPEN NOTEPAD AND TYPE THE FOLLOWING: (Save as a .bat file and select save as all files instead of .txt file)

@ECHO OFF

NET USE P: /HOME
NET USE M: \\SERVERNAME\SHARENAME /Y
NET USE N: \\SERVERNAME\SHARENAME /Y

NET TIME \\SERVERNAME /SET /Y

above the p drive is mapped to everyones home directory off of the server (if you want to use home directories, not mandatory though) ....the m and n drives are mapped to shared directories off of the server, and the net time will map the time from the server to all stations.....

put this under all users profile login script name in user manager for domains.....the name you saved it as such as users.bat....

also under profile you will see a home directory.....check connect P: (or whatever drive you decide) To \\servername\username$ (name of the user)

also copy store the .bat file (script) under C:\winnt\system32\repl\import\scripts

hope this helps


drew

under home directory


 
It depends on what you want them to do. I didn't write our scripts here, but I've had to make some changes to them, so I've gotten a bit of experience. Ours are pretty simple. All we do are:

use them to match the time on the individual workstation to the time on the server:
net time \\%SERVERNAME% /set /yes

use them to map network drives:
net use p: \\%SERVERNAME%\public

copy the hosts file and the lmhosts file:
copy \\%SERVERNAME%\hf\hosts c:\windows
copy \\%SERVERNAME%\hf\lmhosts c:\windows

one of the old ones that we don't use anymore mapped network printers:
net use lpt2: \\ppt#5\\epsonstylus2
net use lpt3: \\ppt#6\\hp6p

we also have a portion of the script that updates the antivirus software on the workstations that's a bit long and complicated.

I don't know if this helps you or not.

 
Thanks for the help guys. I am familiar with the net use command. What about updating corp virus program? just stick a script with the update path in the same folder? I know alot about NT, just have not had to mess with scripts before.

Any more advice? James Collins
Systems Support Engineer
A+, MCP

email: butchrecon@skyenet.net

Please let us (Tek-tips members) know if the solutions we provide are helpful to you. Not only do they help you but they may help others.
 
You'll want the update path to be in the same file, along with the netuse commands. That's how ours works. First the script checks to see if the operating system is NT or 95/98 (the update for 95/98 would not be good for our NT boxes), if it's NT, it skips to the end.
If "%OS%" == "Windows_NT" goto skip

If not, it goes to the path of the executable for the antivirus update.
\\%SERVERNAME%\cheyupd$\avupdate.exe

maybe it's not as complicated as I thought.

Something else you'll want to think about, in case you haven't planned for it: If you are using multiple domain controlers and replicating your login information, you'll have to put the file with the scripts in both the import and export files of every server you're replicating with. Otherwise, they'll get overwritten when the replication occurs. Found that out the hard way once, when a script I'd edited suddenly didn't exist anymore.

Hope this helps
 
It really depends on what virus protection you are running. Most major packages offer ways to automate updates at the desktop. If this isn't an option, you can use something like:
start \\servername\virusupdateshare\update.exe
The start command fires off the executable and continues processing the script. If you leave it out the script will wait until the update finishes to continue with the script.

Caveats:
Do you really want this to run everytime someone logs in. A way around that is to copy a file to the server after the update is complete with a name that is unique and include a statement that checks for its existence before running the command. You could also do this with the environment. ex
if exist filename goto skipupdate or
if %envvariable%==updateversion goto skip update

Another issue is do you want it to run if the user is travelling and dialing in. There is a utility in the Back Office Resource Kit called checkras.exe that will check for the type of connection.

If you have multiple OSs and need to run different updates depending which OS a user is loggin onto, you can also check for this.

If you lay out your requirements a little more fully. We can probably help you come up with a pretty good script. Good luck.
 
Attn MIScoord

I have a silly question.It appears I have the same antivirus program based upon your login script. Do you have a script to update Windows 2000 Professional machines?

(First the script checks to see if the operating system is NT or 95/98 (the update for 95/98 would not be good for our NT boxes), if it's NT, it skips to the end.
If "%OS%" == "Windows_NT" goto skip

If not, it goes to the path of the executable for the antivirus update.
\\%SERVERNAME%\cheyupd$\avupdate.exe).

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top