azure file share map to folder based on clients?

102 Views Asked by At

Hello Every azure file share map to folder based on clients ?

I have 300 clients and each have there own files to upload on ADFS. I want to map drive but folder which is only associated with that client not root folder.

so will this be possible with ADSF or any option ?

1

There are 1 best solutions below

1
On

Azure file share map to folder based on clients.

We can do this in two ways.

Approach 1

One way is to map a drive for each client with their own files on ADFS by creating a folder for each client and has to use the ADFS drive mapping feature to map the client's folder as the root directory for their drive.

And this can be done by using the net use command in Command Prompt by specifying the client's folder as the target directory.

net use [drive letter:] [\server name\share name] [password] /user:[username]

For example, To map the drive letter X to the folder "\adfs-server\client1files" for a user named "client1" with the password "client1password", you would use the following command:

net use X: \\adfs-server\client1files client1password /user:client1

enter image description here

Approach 2

Another way is to use a script to automate the process, in this way you do not need to manually map the drive for each client.

for this you need to create the script into a .bat file and have run based on requirement.

Script Example

net use P: "\\server\foldername\foldername"

@echo off
setlocal

rem Define variables for the server name, share name, and client information
set server=\\adfs-server
set share=clientfiles
set username=client
set password=clientpassword

rem Iterate through the clients and map their drive
for /l %%i in (1,1,300) do (
    set clientnum=%%i
    set driveletter=%%i

    rem Map the drive for the current client
    net use %driveletter%: %server%\%share%%clientnum% %password% /user:%username%%clientnum%

    rem Confirm the drive mapping
    echo Drive %driveletter%: has been mapped to %server%\%share%%clientnum% for %username%%clientnum%
)

References taken from

Net User

Net Use Command

Thanks @ Ruud for the lazyadmin blog.