How to add shared folder to domain users using logon.bat

NethServer 7.8.2003

Hello @support_team,

I’ve installed a new Nethserver and set it up as my office domain. I’ve created Shared Folders and now I’d like to have these Shared Folders to added to select domain users. I’ve used a logon.bat file in the past on Nethserver for various “net use” commands.

Question #1:
Is the logon.bat file in my:


folder the prefferred method to adding a shared drive by letter to a domain user? or does Nethserver have another way to add a drive letter to all/specific domain users for accessing a shared folder?

Question #2:
If the use of logon.bat is the preferred method…what command do I use to add that shared folder to a domain user? I was reading through the following post:

And I see that @mrmarkuz suggested this:

smbclient ///characterization -U username -W

Perhaps I’ve misunderstood the meaning of this line but I would like to assign a specific shared folder (ie: SharedDocs) to be drive letter S: for specific domain users. In the past I would have used something like the following command in my logon.bat:

if /I %USERNAME%== net use S: \<shared-server\SharedDocs /User:Workgroup\Administrator /persistent:yes

But what is the command I would use in my logon.bat for attaching a specific domain user to my share and assigning a drive letter to it? Like I said the shared folder is on my nethserver already, and I’ve already provided the domain user the rights to access the shared folder from the Nethserver GUI. I just want to get this understood so I know how to add my file shares to each domain user.

Thank you.

Just curious and not suggesting one way or another but is there a reason why you arn’t mapping these drives through Group Policy/RSAT?


Hello @royceb,

Very much appreciate your help! I hadn’t thought of using GP/RSAT! But now that you mention it that makes total sense. :slight_smile:

New question for the forum then. I’m following the link provided and I’m setting the 4. Configure Drive Mapping Properties. What do I put in the Location? Do I put in the full path to my share:

And because I’m curious…what would be the net use command to map a Nethserver File Share? Again do I use the /var/lib/nethserver/ibay/<sharedFolder>?

Thank you.

No I don’t think so and it wouldn’t make sense for the joined windows machine. Are you using NS also as a the SAMBA file share provider? Normally this would follow a SMB share naming scheme, for example \\\nsfileshare\share1 or \\neth.example.lan\nsfileshare\share1. See here for more info.

NOTE this is the ip address of your NS install and not of the AD container IP. The SAMBA SMB/CIFS are separate. Also note that your users above need to be created or moved to the newly created OU as Nethserver places them under Users.


Thank you @royceb for your screenshots and comments.

With your direction I have been successful in setting up through my Nethserver AD (GPO through RSAT) my Nethserver shared drives for my users to use.

But I do have one shared folder from a server that is not on Nethserver and my hope was to use Mapped Drives with “Connect as (optional)”, but sadly this is greyed out now and was removed my Microsoft - ‘Group Policy Preferences Password Behaviour Change – MS14-025’. So for this shared drive I will need to resort to my logon.bat script instead for my Domain Users who need access to the files on this server. Until such time I can move these files into our Nethserver Fileshare.

Thanks very much for your help with my post!