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

Logon script help required 1

Status
Not open for further replies.

alanterrill

IS-IT--Management
Sep 10, 2003
27
GB
I have a basic logon script setup by my installer which
gives everyone a P and S drive letter. How can I modify
this to give different letters to different groups?
What I want to do is:
If user is a member of Admin group, then assign letter h:
to \\server1\admin,
If user is a member of Finance, then asign T: to server2
\accounts
Sounds simple enough, but where do I find documentation
of the language required? Nothing in Windows 200o help or
in the huge windows 2000 server book I have.
.

 

If Group "Admin" Then
net use h: \\servername\sharename

If Group "Finance" Then
net use t: \\servername\sharename

just check for the correct syntax.

 
Thankyou both. The second reply was what I would have guessed, but I couldn't find any way of confirming it. The built in help is strangely silent on the detail of what goes in scripts - it's as though there's an assumption that we were all brought up writing dos batch files from childhood.
 
That is if you WANT to use batch files, I think the prefered method is using WSH/VBS scripts, I'll post mine if you want it. This way you can control it using the Global policies, a small examples is:



' *********************************** Map drive function *****

Function MapDrive(Drive, FileServer, Share, Tree)

If oFSO.DriveExists(FileServer & Share) = True Then

oNet.MapNetworkDrive Drive, FileServer & Share & Tree

Else
Wscript.Echo("Cannot Map " & Drive & " to " & FileServer & Share)
End If

End Function

*********
If IsMember("anothergroup") Then
Mapdrive "g:", "\\myserver", "\subdir", "\anothergroup"
 
It's me back again! I've been trying without success to give individual groups their own drive mappings following the advice some of you gave me earlier in the year. I have a group called IT of which only I am a member. I want to give the IT group a drive L, but not anyone else.
I've tried:

If Group "IT" then
net use l: \\server2\l /p:n

which doesn't give me or anyone else a drive l:
and

ifmember IT
net use l: \\server2\l /p:n

whereby everyone in the domain get an l mapping.
What am I doing wrong? Do I need an extra end statement somewhere?
The complete script reads:
net time \\server1 /set /yes
net use P: \\server1\public$ /p:n
net use x: \\server1\clipart /p:n

ifmember IT
net use l: \\server2\l /p:n
:End
 
You can do the following, give permissions to the folder for group or users you want to be able to connect to it and in the logon script enter all network drives you want to map for everybody and it will only be able to map for everyone whatever they have permissions to connect too.

For instance “accounting” group should only have permissions access to \\server2\accounting and not have permissions to \\server2\Admin now in the script there should be both of them:

Net use h: \\server2\admin
Net use k: \\server2\accounting
The h:\ drive will not be created because they don’t have permissions…


I hope it make sense…


Have a nice day.

JoelB
 
Thanks Joel, but it doesn't work... I just tried mapping a drive M to a program that only medical users have access to. Everybody got drive M showing, but those not in the medical group got "Access is denied" when clicking on it. So it sort of works, but that way everyone is going to get about ten drives they don't have access to - there must be a more elegant way.
(PS for those who were about to say "maybe the script isn't seeing the ifmemeber.exe", I just thought of that and put it in the same folder as the logon.bat. It made no difference)
 
I don't think basic batch scripts support group checking do they?

We use either Kixstart scripts or Windows Scripting Host (WSH) scripts which are like mini-runtime evnironments and the logon scripts are programmed in the appropriate scripting manguage.

WSH is the preferred choice these days and is usually VBscript or JScript - plenty of examples are out on the web so you shouldn't need to learn much of the script language itself to get up and running.

Kixstart was one of the preferred optinos back in WinNT days before WSH became available, it's a bit easier to understand for a novice programmer than WSH but I'd stick with WSH for a new environment.

This page has some links on WSH:
 
I had a look at some of those links, but its way over my head - it seemed to take about three pages of obscure script to achieve something simple. Is there some definitive list somewhere of what commands are available for batch scripts which windows understands?.
 
what permissions did you setup the restrictions, at the share level or at the security tab, i cannot currently check myself this issue but i think i am right and make sure the follwoing, restirct the user permissions at the Share permissions level and not on the Secuirty tab [which is NTFS security].

JoelB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top