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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Login Script question

Status
Not open for further replies.

SpandexBobcat

Technical User
Jul 31, 2003
332
0
0
GB
Hi folks,

I am currently using a .bat login script and I want to know how to call a script from within another.

Basically at the moment all users have a seperate login script that contains all our mapped drives. To speed up the login process it was suggested I create a default script with the normal drives and a seperate one for each user that just maps their personal drive...

Can I have some help here? Our present script is basic but I just need a little guidance.

Thanks in advance,

Simon

"A picture is not worth a 1000 words on the Internet. The information is in the text."
 
also to map a personal drive you can do this through the active directory if it's a DC.
 
Tell me more NetworkAdmin123.......

"A picture is not worth a 1000 words on the Internet. The information is in the text."
 
You can use one line in your default script if you are mapping home areas to all users. eg if all users have drive Z as their home area use the following:
net use z: \\servername\UserAreas\%username%
 
Hi FredNoB,

I tried your excellent suggestion but it just doesn't seem to work..... any ideas as to why?

Simon

"A picture is not worth a 1000 words on the Internet. The information is in the text."
 
The users area are actually shared folders in //Servername/users/username.

A strange thing is happening, in the past the script had
Code:
net use f:\\servername\username
and in my computer the drive showed as:

username on 'servername'(F:)

which is what I want. However now it won't map like that unless you are administrator. The only way I can get it to map for a user is to have
Code:
net use f:\\servername\users\%username%
which, when looking in my computer shows as:

username on 'servername/users'(F:)

Now I know it might not seem like much but it isn't the way it was before and I am puzzled as to why it won't work without the \users\ in the script as it has done in the past...

If anyone has a suggestion they are welcome to give it!

Simon




"A picture is not worth a 1000 words on the Internet. The information is in the text."
 
ok

Open your active directory and find your users. Right click on a user and select properties. Then go to the profile tab. You'll see an area called Home Folder. Hit the connect radio button and choose the drive letter you want. The paste \\severname\usersfolder\Username you would use your //Servername/users/username. If the path does not exist it will create one which is nice..

Hope this helps.
 
just a quick question about this line:
net use f:\\servername\users\%username%

does that mean i have to share every single folder for each user so the mapping works ?
What is "users" is that a main folder that contains all the users's folder inside, ?
the reason i 'm asking is because i tried the above, and i get an error saying network path can't be find, but if i user this instead : net use f:\\servername\%username% it works .. and i had to share all folders

what am i doing wrong >?

thanks
 
I would recommend switching to vbscript. If you have a share called Users you could map a drive to \\servername\users\username

Here is a sample login script I use all the time. I've edited it for you to show how you could accomplish the above. See the mapping for U drive below.

Code:
'==========================================================================
'
' NAME: LogonScript.vbs
'
' AUTHOR:  Mark D. MacLachlan, The Spider's Parlor
' URL   : [URL unfurl="true"]http://www.thespidersparlor.com[/URL]
' DATE  : 4/10/2003
'
' COMMENT: Enumerates current users' group memberships in given domain.
'
'==========================================================================


ON ERROR RESUME NEXT

Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")

'Edit the next line with your domain name
DomainString = "DomainName"
UserString = WSHNetwork.UserName
'Bind to the user object to get user name and check for group memberships later
Set UserObj = GetObject("WinNT://" & DomainString & "/" & UserString)

'Synchronizes the time with Server our NTP Server
WSHShell.Run "NET TIME \\Server /set /y"

'Disconnect any drive mappings as needed.
WSHNetwork.RemoveNetworkDrive "F:"

'Give the PC time to do the disconnect, wait 300 milliseconds
wscript.sleep 300

'Map drives needed by all
WSHNetwork.MapNetworkDrive "U:", "\\server\users\" & UserString,True
WSHNetwork.MapNetworkDrive "X:", "\\server\executables",True

'Now check for group memberships and map appropriate drives
For Each GroupObj In UserObj.Groups
	Select Case GroupObj.Name
	'Check for group memberships and take needed action
	'In this example below, ADMIN and WORKERB are groups.
		Case "Admin"
			WSHNetwork.MapNetworkDrive "w:", "\\Server\Admin Stuff",True
		Case "WorkerB"
			WSHNetwork.MapNetworkDrive "w:", "\\Server\Shared Documents",True
	End Select
Next


'Install Printers

WSHNetwork.AddWindowsPrinterConnection "\\Server\HP5si"

'Clean Up Memory We Used
set UserObj = Nothing
set GroupObj = Nothing
set WSHNetwork = Nothing
set DomainString = Nothing
set WSHSHell = Nothing

'Quit the Script
wscript.quit

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top