Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - tbg58

Pages: [1]
1
I'm sure there are many folks on the forum who are vastly more sophisticated than this, but for the sake of my fellow neophyte users of the eBox platform, here's a very simple logon script which can be used by Windows clients for mapping private, public, and group shares on the eBox platform.  The logon script is a VBScript file, launched by a batch file that processes the script using the CScript processor built into the Windows client.
The files are as follows:
logon.bat
logon.vbs
Both are to be placed in the /home/samba/netlogon directory on the eBox PDC running the Office service.

Here's the launcher batch file, logon.bat
Code: [Select]
cscript \\yourservername\netlogon\logon.vbs

This launches the script itself - I've tried to include enough comments to show how it works and I think it should be simple enough for just about anyone to implement.
Code: [Select]

'First make sure all variables are dimensioned.
'This isn't necessary for functionality; it's for coding discipline only.
Option Explicit
'dimension all our variables
dim objNetwork
dim strDriveLetter, strRemotePath, strUser, strGrp
dim strGroupADSPath, strUserADSPath, grp

'This script will use the MapNetworkDrive method
'for each network drive mapped.

'We'll be using the Wscript.Network Object to enumerate the user as well as to map drives.
'We only need to instantiate it once at the beginning.
Set objNetwork = Wscript.CreateObject("Wscript.Network")

'First let's get the user name since we'll use it for mapping the home directory
'as well as checking group memberships. 
strUser = objNetwork.UserName

'In just about every network at least two drives are mapped:
'One for the user's home directory, and one for an organizational public share.
'We'll map those first since they don't depend on group memberships.

'User Drive to U:
strDriveLetter = "U:"
strRemotePath = "\\yourservername"
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath & "\" & strUser

'PublicShare Drive to P:
strDriveLetter = "P:"
strRemotePath = "\\yourservername\public"
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath


'next we'll enumerate groups and map drives for specific departmental memberships
'The code to check for memberships and map the drives is in a subroutine called IsMember.
'All we have to do is copy the same block over again for each group membership we want to check.
'The block only needs to set the string values for the group name, the desired drive letter, and the share path.
'Then it calls the IsMember subroutine down below.

'Q: for members of groupq
strGrp="groupq"
strDriveLetter = "q:"
strRemotePath = "\\yourservername\groupqpvt"
IsMember

'R: for members of groupr
strGrp="groupr"
strDriveLetter = "R:"
strRemotePath = "\\yourservername\grouprpvt"
IsMember

'Repeat for as many private groups and their respective enumerated shares as you wish.

'We're done with the login script.
'Let's tidy up variables first to make sure we're not leaving anything behind.
objNetwork = ""
strDriveLetter = ""
strRemotePath = ""
strUser = ""
strGrp = ""
strGroupADSPath = ""
strUserADSPath = ""
grp = ""
'That's all.  Close the script processor.
wscript.quit


sub IsMember
'set the directory service path to enumerate the group
strGroupADSPath = "WinNT://yourdomain/" & strGrp & ",group"
'poll the PDC for the group
set grp = GetObject(strGroupADSPath)
'set the user directory service path to enumerate the user
strUserADSPath = "WinNT://yourdomain/" & strUser
'Check membership in the group. 
If (grp.IsMember(strUserADSPath)) Then
'map the drive
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath
End If
'clean up variables for next group check.
strGrp = ""
strDriveLetter = ""
strRemotePath = ""
'Rinse, lather and repeat this code as many times as needed.
End sub


As much as I hate to use weasel words, this code is released freely into the public domain, with no implicit or explicit warranty.  Use it at your own risk.  If you have problems or corrections - post them here.  That's what the community is for.
Note that the logon script only works with Windows clients - it has been tested only on Windows XP using eBox 1.2, where it seems to work well.

I hope this is helpful for my fellow new users of eBox - I put it up here in the hope that doing so will save others the time it took me to cobble together a logon script. It's been several years since I scripted for the WinNT provider; my work has been mostly in AD, but I am certainly very impressed by the work done by the eBox team and the community.  Please be encouraged that your work is bearing fruit.  This little message is my very small and humble attempt to help.
Kind regards,
Rob in Memphis

Pages: [1]