Login Scripting - Local PC

Ahh more stupid posts by me..

I have Kixtart, but I don't want to use it for what I'm doing, unless I absolutely have to.

I'm looking for a program, or maybe just the command lines, to create a script/batch file that someone can click on to do the following:

Map drives to a local server: xxx-2000 where xxx is the 3 character identifier of the server, -2000 signifies if it's NT, 2000, 2003. (Don't ask, I came in after this crap was done)
Not using a domain, so there goes the easy fix.
I want to be able to pull the first 3 characters of the local computer name to determine where to map the drives.
ex: mau123 = maumee location, which would map to the maumee server, which doesn't have a xxx-2000 type name.

I was thinking a Case If, Then, Else statement? But how would I pull the first 3 letters of the computer name without getting intricate on myself by truncating or whatever other options are out there. I'm not a huge fan of programming since I took it in college and all the stupid crap they gave us.

Any suggestions would be helpful, otherwise I write something up in Kixstart or maybe write a small VB app to do it..

I'm really looking for something simple that if my other network people need to check the file out, they'll be able to understand it. Neither of them really understand programming and their understanding of the capabilites of login scripts/batch files is basic.

Once I know how to do the code to pull the computer name's first 3 chars, I can get a little more creative.
I have a few registry keys that I can pull the local computer name from..

Or if someone has a program that does this kind of stuff, pass that info along..



I tapped a friend who got me started on writing a VBS file to do what I needed. Just a simple If, Then, Else statement. I wasn't aware of the variable that pulls the computer name. I was thinking I would do it via IP address, but if someone was in a different location, that'd be a problem.

Oh well.. problem solved. If anyone wants the code I used for this, let me know and I can post it.<P ID="edit"><FONT SIZE=-1><EM>Edited by riser on 04/20/05 04:49 PM.</EM></FONT></P>
2 answers Last reply
More about login scripting local
  1. W/O A DOMAIN!?!?!?
    I dont want your job right now, lol.

    You are going to have to write some kind of rigjob software/script to do that w/o a domain.

    <A HREF="http://www.folken.net/myrig.htm" target="_new">My precious...</A>
  2. Heh.. yeah. I know. No one wants to go to a domain, they like micromanaging each individual computer. The job I left to come here.. heh.. 8 locations, all on Win2k/2k3 domains, everything worked nice, only had the usual bigger issues that required work.
    I come here.. I spend more time mapping network drives, installing printers, setting up Lotus Notes, and figuring out why people can't connect to a server because they have a password for 1) Windows Logon, 2) Lotus Notes, 3) As400 Session, 4) Other AS400 Logons for other locations.
    I swear, every user has at least 4 passwords.. They're all 3 characters, 3 numbers.. I have an entire database of everyone's password. Why? Because my boss likes having that kind of control I guess.
    You know what's even better? Everytime someone wants to change seats or computers, I have to go in and set up a local account on the computer. If someone's computer dies, I have to set them up on another computer.
    I think everyone realizes how much BS this is and how dumb this place it setup except for my boss.

    Anyhow.. here's the basic script that I'll basically email to people and tell them to double click on to map their drives.. It'll eventually map all drives, select ones will be denied/allowed by security on the server though..

    On Error Resume Next
    strComputer = "."

    Set objShell = Wscript.CreateObject("Wscript.Shell")
    Set colSystemEnvVars = objShell.Environment("System")
    Set colUserEnvVars = objShell.Environment("User")
    Set objNetwork = Wscript.CreateObject("Wscript.Network")

    '----- Get user name, computer name, and left 3 characters of computer name -----
    samUser = objNetwork.UserName
    computerName = objNetwork.ComputerName
    computerName2 = Left(computerName,3)

    '----- Check for first three characters of computer name -----
    If computerName2 = "MAU" Then
    dim objNet, objNet1
    Set objNet = CreateObject("Wscript.Network")
    objNet.MapNetworkDrive "X:","\\it-2003\everyone"
    objNet.MapNetworkDrive "W:","\\it-2003\%username%"
    objNet.MapNetworkDrive "y:","\\it-2003\projects"
    StrMsg="Network Drives Mapped!"

Ask a new question

Read More