Author Topic: [SOLVED]Mapping file shares  (Read 5823 times)

ask2me007

  • Zen Apprentice
  • *
  • Posts: 32
  • Karma: +1/-0
    • View Profile
[SOLVED]Mapping file shares
« on: February 22, 2012, 03:47:15 pm »
I am newbie to zentyal. I installed it and started file sharing. Its very easy to configure this. After starting the PDC I connected to te file share and the default home folder has been mapped automatically. If all other folders were mapped automatically according to groupwise, it will be very helpful for us. Is there any way to do this?
Thanks in advance .
« Last Edit: March 07, 2012, 03:29:42 pm by robb »

ichat

  • Zen Hero
  • *****
  • Posts: 795
  • Karma: +28/-16
  • RTFM!
    • View Profile
Re: Mapping file shares
« Reply #1 on: February 22, 2012, 05:40:06 pm »
to mount folders on a windows client  you need to use:  the    net use    command,  to check  for  a groupmembership you can also use ifmember.exe  from the  w2003 resourcekit...  with both tools you can create your own set of mount-points...

google on:   logon script examples    will probably help you get started...
All tips hints and advices are based on my personal experience.
As I try my best to be as accurate as possible, following my advice is always at your own risk,
I claim absolutely NO responsibility in any way!

ask2me007

  • Zen Apprentice
  • *
  • Posts: 32
  • Karma: +1/-0
    • View Profile
Re: Mapping file shares
« Reply #2 on: February 23, 2012, 04:47:29 pm »
I copied the logon script by going throug the following link.
http://forum.ebox-platform.com/index.php?topic=2019.0
I copied this to my local machine and ran the .bat file.
But Iam getting error in the line higligted in red.


sub IsMember
xxxx
set grp = GetObject(strGroupADSPath)

I think that the path I have given is wrong. Iam using zentyal 2.2 version.
What is the default path I have to provide in the following line

strGroupADSPath = "WinNT://yourdomain/" & strGrp & ",group"

Pls help me to solve this problem.





ask2me007

  • Zen Apprentice
  • *
  • Posts: 32
  • Karma: +1/-0
    • View Profile
Re: Mapping file shares
« Reply #3 on: February 26, 2012, 04:51:41 am »
Anybody pls help me

Luke

  • Zen Monk
  • **
  • Posts: 78
  • Karma: +3/-0
    • View Profile
Re: Mapping file shares
« Reply #4 on: February 27, 2012, 08:48:43 pm »
Hi!

As ichat said. Ifmember is a really good tool for mapping drivers based on groupmembership

Code: [Select]
# SBS_LOGIN_SCRIPT
# DOMAIN: TEST
# SERVER: EBOX-PDC

:First we remove all networkdrives
net use * /d /y

:Now we check if the user is a member of the group "lan members"
\\ebox-pdc\netlogon\ifmember "TEST\lan members"
if not errorlevel 1 goto userend
net use p: "\\ebox-pdc\catalogus bib"  /y
net use s: "\\ebox-pdc\FILES_TEST"  /y
net use t: "\\ebox-pdc\GLOBAL_TEST"  /y
net use y: "\\ebox-pdc\COMPANY_TEST" /y

:user2
\\ebox-pdc\netlogon\ifmember "TEST\lan gantt"
if not errorlevel 1 goto user3
net use u: "\\server2\GANTT_TEST" /y

:user3
\\ebox-pdc\netlogon\ifmember "TEST\lan money"
if not errorlevel 1 goto userend
net use n: "\\server3\MONEY_TEST" /y

:userend

borrowed the code from this thread http://forum.zentyal.org/index.php?topic=295.0

We use it in our zentyal server and it works really good.

robb

  • Guest
Re: Mapping file shares
« Reply #5 on: February 27, 2012, 09:59:21 pm »
If you use Windows clients, you could also consider using kixtart. This is a very powerfull scripting environment for logon/logoff scripts. on the kixtart forums there are LOADS of sample scripts that you can use (for the scriptvault you need to register on the forums and login.)

I used to script my logon scripts with kix back in my windows time. And even I (as an absolute none-programmer) was able to create decent scripts with kixtart.

DogManCat

  • Guest
Re: Mapping file shares
« Reply #6 on: February 28, 2012, 01:51:55 pm »
Doesn't it all depend on the client ?

UAC just gets worse with Win7 and basically unless your running as an administrator any logon script is going to hit problems due to permissions ?

ask2me007

  • Zen Apprentice
  • *
  • Posts: 32
  • Karma: +1/-0
    • View Profile
Re: Mapping file shares
« Reply #7 on: February 29, 2012, 09:28:31 am »
Thanks to all of you. Finally I run the script in the local computer  and all the shares were mapped succesfully.
Then I copied the script and paste into the zentyal netlogon directory as logon.bat.(/homes/samba/netlogon).
Then I login again but it mapped only my home partition. All other partitions were not mapped at all.
But when I run the script again from my pc, every thing mapped.
I couldnt understand what is the issue??

ask2me007

  • Zen Apprentice
  • *
  • Posts: 32
  • Karma: +1/-0
    • View Profile
Re: Mapping file shares
« Reply #8 on: February 29, 2012, 05:59:25 pm »
I tested the script by providing a message box. But I think, the script is not executing while login.
Please help to solve this.

DogManCat

  • Guest
Re: Mapping file shares
« Reply #9 on: February 29, 2012, 06:16:42 pm »
Turn on echo

@ECHO ON

at the start of your batch script.

do a pause at the end to script

PAUSE

Then have a look whats happening

ichat

  • Zen Hero
  • *****
  • Posts: 795
  • Karma: +28/-16
  • RTFM!
    • View Profile
Re: Mapping file shares
« Reply #10 on: February 29, 2012, 07:40:50 pm »
did you take into account this document, \

some highlights:

1 the file must be called  logon.bat
2 it must live in the  netlogon folder
3 it must be created with a windows pc using either  edit  notepad  editpad  or simular  simple txt editor,
or it must be convirted using flip.

as said befor  use the @echo on flag to debug,   and use a pause ;   after each command if you like,  or at least at the end of the file...



 
All tips hints and advices are based on my personal experience.
As I try my best to be as accurate as possible, following my advice is always at your own risk,
I claim absolutely NO responsibility in any way!

expertgeeks

  • Forum Moderator
  • Zen Warrior
  • *****
  • Posts: 124
  • Karma: +11/-0
    • View Profile
Re: Mapping file shares
« Reply #11 on: March 02, 2012, 02:18:54 pm »
If you're still having problems, you could try calling the batch script from the zentyal-logon.bat..
i.e.
Code: [Select]
call \\<server-name>\netlogon\batch_script.batMine is called between 'set Win7.Minor=1' and 'set Version=' in zentyal-logon.bat

N.B. You'll also need to add the same call function at the same point into the logon.bat.mas file to stop it getting overwritten by zentyal when making changes.
Code: [Select]
sudo nano /etc/zentyal/stubs/samba/logon.bat.mas
FYI, Instead of using Ifmember, my login script attempts to map the drives but moves on if a drive fails to map (On Error Resume Next). That way each user gets an attempt to map all the drives, if they don't have permission, they don't get mapped. Here are my login scripts, hopefully some of the info will be of use..

batch_script.bat
Code: [Select]
echo off
echo Setting PC Clock to Network Time
net time \\<server-name> /set /y

echo Setting up network shares, please standby...

call \\<server-name>\netlogon\net_drives.vbs
call \\<server-name>\netlogon\printers.vbs

echo Setup now complete. Script exiting...

net_drives.vbs
Code: [Select]
' VBScript source code
Option Explicit
On Error Resume Next

Dim oNet

Set oNet = CreateObject("WScript.Network")

oNet.MapNetworkDrive "M:", "\\<server-name>\Share1", False
oNet.MapNetworkDrive "N:", "\\<server-name>\Share2", False
etc etc

printers.vbs
Code: [Select]
' VBScript source code
On Error Resume Next

Dim WshNetwork

Set WshNetwork = CreateObject("WScript.Network")

WshNetwork.AddWindowsPrinterConnection "\\<server-name>\<printer-1-name>"
WshNetwork.AddWindowsPrinterConnection "\\<server-name>\<printer-2-name>"

ask2me007

  • Zen Apprentice
  • *
  • Posts: 32
  • Karma: +1/-0
    • View Profile
Re: Mapping file shares
« Reply #12 on: March 02, 2012, 03:34:25 pm »
Once again thanks for the response I got for my query. I checked once again  that
1)the logon.bat exists in the netlogon folder.
2)logon.vbs also in that folder
3) Executed the script from my local PC without any problem
4)Then I copied the same file to the netlogon for not having issues in dos conversion .
5)I tried to run the logon.bat after changing the path in cscript to the Zentyal server location. But it return access is Denied error.
6)Tried echo and pause commands in the logon.bat
But it never gives any response.Also I tried to access the file through my local pc by giving the path \\servername\home\samba\netlogon\logon.bat( I dont know whether it is right or not)
So I think that the logon.bat never executing when I login to the domain.
And I login to the system as a administrator user and as a local user but the script doesnt work.

Anyway I will come back after making changes as said by Expertgeeks.

expertgeeks

  • Forum Moderator
  • Zen Warrior
  • *****
  • Posts: 124
  • Karma: +11/-0
    • View Profile
Re: Mapping file shares
« Reply #13 on: March 02, 2012, 05:07:40 pm »
the correct path should be;

\\servername\netlogon\logon.bat

ask2me007

  • Zen Apprentice
  • *
  • Posts: 32
  • Karma: +1/-0
    • View Profile
Re: Mapping file shares
« Reply #14 on: March 03, 2012, 07:51:11 am »
Thank you expertgeeks.

Now I can run the logon.bat from my local pc. I put echo on and pause in the logon.bat.
After I logoff the domain and login thereafter. But I couldnt view the pause while login.
Also the vbs script not worked at all. I put pause command  in the logon.bat file.