This topic describes how to mount a Server Message Block (SMB) file system of Apsara
File Storage NAS on a Windows Elastic Compute Service (ECS) instance. After you configure
a Windows ECS instance, you can manually or automatically mount an SMB file system.
Prerequisites
The following operations are completed:
Configure a Windows ECS instance
Perform the following steps when you mount an SMB file system on a Windows ECS instance:
- Connect to the ECS instance. For more information, see Connect to ECS instances.
- For Windows 2016 or later, run the following command to allow anonymous access from
clients:
REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanWorkstation\Parameters
/f /v AllowInsecureGuestAuth /t REG_DWORD /d 1
- Start the Workstation service.
- Open the Windows Start menu. Choose or press
Win+R
, and enter services.msc
to open the Services window.
- Make sure that the Workstation service is in the Started state and the startup type is Automatic.
By default, the Workstation service is in the Started state.

- Start the TCP/IP NetBIOS Helper service.
- Open the Network and Sharing Center window, and click the active network connection.
- Select Properties. In the Connection Properties dialog box, double-click Internet Protocol Version 4 (TCP/IPv4). In the Internet Protocol Version 4 (TCP/IPv4) Properties dialog box, click Advanced.
- In the Advanced TCP/IP Settings dialog box, choose .

- Open the Windows Start menu, choose or press
Win+R
, and enter services.msc
to open the Services window.
- Make sure that the TCP/IP NetBIOS Helper service is in the Started state and the startup type is Automatic.
By default, the TCP/IP NetBIOS Helper service is in the Started state.

Manually mount an SMB file system
- Run the mount command to mount an SMB file system.
Open the command prompt and run the following command to mount an SMB file system:
net use Z: \\file-system-id.region.nas.aliyuncs.com\myshare
Command syntax: net use <Letter of the destination drive> \\<Domain name of the mount target>\myshare
.
- Letter of the destination drive: the letter of the drive on which you mount an SMB
file system. Replace this parameter with the letter of the actual destination drive.
Note The letter of the destination drive must be different from the existing drive letters.
- Domain name of the mount target: The domain name of the mount target is automatically
generated when the mount target is created. Replace this parameter with the actual
domain name of the mount target. To obtain the domain name of the mount target, perform
the following steps: Log on to the NAS console, find the file system, and then click Management. On the details page that appears, the domain name of the mount target is displayed.
- myshare: the name of an SMB share. You cannot change the name.
Note For Windows 2019 or later, we recommend that you use the Powershell command New-SmbGlobalMapping
to mount the SMB file system. Run the following command to mount the SMB file system:
New-SmbGlobalMapping -LocalPath z: -RemotePath \\file-system-id.region.nas.aliyuncs.com\myshare
-Persistent $true
If an AD domain controller is installed on the ECS instance, you must pass the identity
verification when you run the command. You can enter a valid identity in the AD domain.
- Confirm that the SMB file system is mounted.
Run the
net use
command to check the mount result.
The command output in the following figure indicates a successful mount.

After the SMB file system is mounted, you can read data from and write data to the
NAS file systems on the ECS instance.
Automatically mount an SMB file system
Before you configure automatic mounting, make sure that the preceding manual mounting
is successful.
- Open the command prompt and run the following command to configure the auto_mount.bat
script:
echo %HOMEPATH%\mount.bat > auto_mount.bat
- Run the following three commands to enable the auto_mount.bat script to automatically
run after user logon and grant the read and execute permissions to other users:
MOVE auto_mount.bat "c:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\auto_mount.bat"
icacls "c:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\auto_mount.bat"
/grant everyone:rx
REG ADD HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run /f /v MyMount
/t REG_SZ /d "c:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\auto_mount.bat"
- Run the following command to configure the mount.bat script:
echo net use z: \\file-system-id.region.nas.aliyuncs.com\myshare > "%HOMEPATH%\mount.bat"
Replace file-system-id.region.nas.aliyuncs.com
with the actual domain name of the mount target.
Note If the SMB file system supports ADs and ACLs, you can run the following command to
configure the script. Then, you can mount the SMB file system as a domain user rather
than a Windows logon user:
echo net use z: \\file-system-id.region.nas.aliyuncs.com\myshare /user:user@domain
password > "%HOMEPATH%\mount.bat"
Replace file-system-id.region.nas.aliyuncs.com
with the actual domain name of the mount target, replaceuser@domain
with the actual domain username, and replace password
with the actual domain user password.
- Restart the ECS instance.
Run the net use
command to check the mount result.