Windows 2019
Sponsored Link

File Server : Access to Share
2019/09/19
 
Access to Share folder from Client Computer. This example is on Windows 10.
[1]
Run PowerShell and configure.
If you'd like to access to Share folder even from Explorer on GUI after setting accesses to Share on CUI like follows, then, Run PowerShell without admin Privilege. Because Security Context added on PowerShell (or Command Prompt) with admin Privilege and added on Explorer on GUI with common user authority are different, so mounted Share folder with admin Privilege will be never shown on Explorer on GUI with common user authority.
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

# on all examples here, specifying authentication user and password is not needed on specific cases like follows

# * server/client are both in AD Domain and also logon user on Client is allowed to access to Share
# * even on workgroup environment, a user exists on Client that name is the same with the user that is allowed to access to Share on Server and also their password is the same

### with New-SmbMapping 
# -LocalPath [drive letter]
# -RemotePath [\\(Server name)\(Share name)]
# -UserName [authenticated username] -Password [password]
# -Persistent [$true|$false]
#   $true means enabled, $false means mapping is valid only on current session
PS C:\Users\serverworld> New-SmbMapping -LocalPath "Z:" `
-RemotePath "\\rx-7.srv.world\Share01" `
-UserName "Serverworld" -Password "P@ssw0rd01" `
-Persistent $true 

# confirm
PS C:\Users\serverworld> Get-SmbMapping 

Status Local Path Remote Path
------ ---------- -----------
OK     Z:         \\rx-7.srv.world\Share01

PS C:\Users\serverworld> ls Z:\ 

    Directory: Z:\

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       2019/09/18     19:46                new folder
-a----       2019/09/18     21:03              0 new text.txt
-a----       2019/09/18     20:02             16 testfile.txt

# to disconnect Share, run like follows
PS C:\Users\serverworld> Remove-SmbMapping -LocalPath "Z:" 

### with New-PSDrive 
# -Name [any drive name you like]
#   if you set drive persistently with [-Persist], it needs to specify drive letter like "Z:", "Y:" and so on)
# -PSProvider [FileSystem]
#   if filesystem, specify [FileSystem], but if registry, specify [Registry]
# -Root [\\(Server name)\(Share name)]
# -Credential (specify authenticated username/password)]
#   example below uses a user (Serverworld/P@ssw0rd01)
# -Persist (if with this option, mapping keeps persistently, if not specify, mapping is valid only on current session)
PS C:\Users\serverworld> New-PSDrive -Name "Share01" `
-PSProvider FileSystem `
-Root "\\rx-7.srv.world\Share01" `
-Credential (New-Object PSCredential("Serverworld", (ConvertTo-SecureString -AsPlainText "P@ssw0rd01" -Force))) 

# confirm
PS C:\Users\serverworld> Get-PSDrive -Name "Share01" | Format-Table -AutoSize 

Name    Used (GB) Free (GB) Provider   Root                     CurrentLocation
----    --------- --------- --------   ----                     ---------------
Share01                     FileSystem \\rx-7.srv.world\Share01

PS C:\Users\serverworld> ls Share01:\ 

    Directory: \\rx-7.srv.world\Share01

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       2019/09/18     10:46                new folder
-a----       2019/09/18     13:03              0 new text.txt
-a----       2019/09/18     11:02             16 testfile.txt

# to disconnect Share, run like follows
PS C:\Users\serverworld> Remove-PSDrive "Share01" 

### with net use
# net use [drive letter (optional)] [\\(Server name)\(Share name)] [/user:(username)] [password (if not specified, need to input intaractively)] [/persistent:(yes|no) (default is [Yes])]
PS C:\Users\serverworld> net use "\\rx-7.srv.world\Share01" /user:Serverworld P@ssw0rd01 /persistent:no 
The command completed successfully.

PS C:\Users\serverworld> ls "\\rx-7.srv.world\Share01" 

    Directory: \\rx-7.srv.world\Share01

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       2019/09/18     10:46                new folder
-a----       2019/09/18     13:03              0 new text.txt
-a----       2019/09/18     11:02             16 testfile.txt

# to disconnect Share, run like follows
PS C:\Users\serverworld> net use "\\rx-7.srv.world\Share01" /delete 
File Server : Access to Share (GUI)
 
On GUI accessing, set like follows.
[2] This is for the case of Assigning drive letter and access to Share Folder.
Open Explorer and right-click [Network] on the left pane, then select [Map network drive].
[3] Select drive letter on [Drive] field, and Input Share folder Path like [\\(Server name)\(Share Name)], then Click [Finish] button.
[4]
User authentication form is shown and you need to authenticate with a user that is set to allow to access to Share on Server. But on specific cases like follows, User authentication form is not shown because authentication is passed on background.
The specific cases without user authentication form is like follows.
* File Server and Client Host are in the same Active Directory Domain and also a user logon on Clist Host is allowed to access to Share Folder on Server setting.
* Even on WorkGroup environment, a user exists on Client Host that name is the same with the user that is allowed to access to Share Folder on Server settings and also their password is the same.
[5] Just accessed to Share folder. Try to read or write files or folders to verify settings.
[6] This is for the case of accessing to Share Folder without assigning drive ltter.
Run [Start] - [Run] and then, input Share path like [\\(Server name)\(Share name)].
[7] Authenticate with a user that is allowed to access to Share folder.
(but on specific cases as writing in [4], this form is not shown)
[8] Just accessed to Share folder.
Matched Content