All Products
Search
Document Center

ENS:Mount an NFS file system on Windows

Last Updated:Jun 21, 2026

To share data across different operating systems, you can mount a NAS NFS file system on a Windows system to upload and download files.

Prerequisites

  • You have a Windows-based ENS instance in the same node as the NAS file system.

  • You have created a NAS NFS file system, obtained its mount target address, and ensured that the file system and the ENS instance are in the same VPC.

Procedure

  1. Connect to the ENS instance.

  2. Install the NFS client.

    1. Open Server Manager.

    2. Select Manage > Add Roles and Features.

    3. In the Add Roles and Features wizard, click Next until you reach the Features page.

    4. On the Features page, select Client for NFS.

    5. Click Next, and then click Install to complete the installation.

    6. Restart the ENS instance.

    7. Open Command Prompt and run the mount command. The following output confirms the NFS client is installed.

      C:\Users\Administrator>mount
      Local    Remote                                Properties
      -------------------------------------------------------------------------------
      --
  3. Modify the registry to add a default UID and GID for anonymous users. This prevents potential file access permission issues after mounting the NAS file system.

    1. Go to the path HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Users\Default\Mount. Create the following registry entries: AnonymousGID (REG_DWORD, with a value of 0), AnonymousUID (REG_DWORD, with a value of 0), and Locking (REG_DWORD, with a value of 1).

    2. Go to the path HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default. Create the GID and UID entries and set the value of both AnonymousGID and AnonymousUID to 0.

  4. Restart the system.

    You must restart the system. Otherwise, you will have only read permissions for the mounted directory.

  5. Add a route.

    To access the NAS mount target, add a route on the Windows instance by running the following command:

  6. Mount the NFS file system.

    Run the command mount <mount_target_address> <drive_letter>: to mount the NFS file system.

    Note

    The Windows client supports only the NFSv3 protocol.

    Obtain the NFSv3 mount target address from the file system's details page. If the NFSv3 mount target address is 100.64.XXX.XXX:/source_path, the mount target address for the Windows client is \\100.64.XXX.XXX\source_path.

  7. Verify the mount.

    After a successful mount, double-click the This PC icon to view the new file system.

    The shared file system appears as a mapped network drive in the Network locations section.

Mount using a script

Script features

  • NFS client installation

  • Registry modification

  • Mount an NFS file system with read/write access

  • Automatic mount on startup

Note

On a new machine, after the script installs the NFS client and modifies the registry, you must restart the system manually. Failure to restart results in read-only permissions for the mounted directory.

Usage

  • Save the script to a specific directory, for example, C:\, and name it nfs_mount.ps1.

  • Run the command in PowerShell.

    • Method 1:

      powershell -file C:\nfs_mount.ps1
    • Method 2:

      powershell -file C:\nfs_mount.ps1 -url  -drive z
      # Note: This method overrides the default `url` (mount target) and `drive` (drive letter) variables in the script.

NFS read/write mount

[CmdletBinding()] 
Param( 
# Mount target
[string]$url="100.125.255.100\nas_test",
# Windows drive letter
[string]$drive="z" 
)
# Get the current execution time.
$now = Get-Date 
# Specify the directory for the log file. The current execution directory is used.
$logPath="C:\"
# Set the log file name.
$logName = "executLog"
$logFileName= $logName + "_" + $now.ToString("yyyy-MM-dd")+".log"
$logInfo = $now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " " 
# Set the full path for the log file.
$logPathFile = Join-Path $logPath $logFileName
Write-Output ($logInfo+"Mount path:"+$url+" Drive letter:"+$drive)
Write-Output ($logInfo+"Mount path:"+$url+" Drive letter:"+$drive) | Out-File -FilePath $logPathFile -Encoding default -Append
$nfs=get-WindowsFeature -Name "NFS-Client"
if($nfs.installed){
$nas_start = (Get-Item HKCU:\Software\Microsoft\Windows\CurrentVersion\Run).GetValueNames().Contains("nas_run")
Write-Output ($logInfo+":Automatic mount on startup>>"+$nas_start)
Write-Output ($logInfo+":Automatic mount on startup>>"+$nas_start) | Out-File -FilePath $logPathFile -Encoding default -Append
if(!$nas_start){
Write-Output ($logInfo+":Configure automatic mount on startup")
Write-Output ($logInfo+":Configure automatic mount on startup") | Out-File -FilePath $logPathFile -Encoding default -Append
$nas_script_path = $myinvocation.mycommand.definition
$run_script = "powershell -file "+ $nas_script_path +" -url "+ $url +" -drive "+ $drive
$nas_run = "nas_run"
$nas_run_result = New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name $nas_run  -PropertyType String -Value $run_script -ErrorAction Continue -ErrorVariable run_err_msg
if($err_msg){
Write-Output ($logInfo +"Failed to configure automatic mount on startup. Result: " +$run_err_msg)
Write-Output ($logInfo +"Failed to configure automatic mount on startup. Result: " +$run_err_msg) | Out-File -FilePath $logPathFile -Encoding default -Append
}else{
Write-Output ($logInfo +"Successfully configured automatic mount on startup. Result: " +$nas_run_result)
Write-Output ($logInfo +"Successfully configured automatic mount on startup. Result: " +$nas_run_result) | Out-File -FilePath $logPathFile -Encoding default -Append
}
}
Write-Output ($logInfo+"NFS client exists. Mounting the NFS mount target.")
Write-Output ($logInfo+"NFS client exists. Mounting the NFS mount target.") | Out-File -FilePath $logPathFile -Encoding default -Append
$nfs_url = "mount -o  nolock -o  mtype=hard -o  timeout=60 \\$url ${drive}:"
Write-Output ($logInfo + ":Start mounting the NAS file system "+$nfs_url)
Write-Output ($logInfo + ":Start mounting the NAS file system "+$nfs_url) | Out-File -FilePath $logPathFile -Encoding default -Append
$reslut = cmd /c $nfs_url
Write-Output ($logInfo+$reslut)
Write-Output ($logInfo+$reslut) | Out-File -FilePath $logPathFile -Encoding default -Append
}else{
Write-Output ($logInfo +":NFS client is not installed. Installing client and configuring registry. Please restart the system after the script finishes.")
Write-Output ($logInfo +":NFS client is not installed. Installing client and configuring registry. Please restart the system after the script finishes.") | Out-File -FilePath $logPathFile -Encoding default -Append
Add-WindowsFeature -Name "NFS-Client"
$lock_path = Test-Path HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Users\Default\Mount
if($lock_path){
$lock = (Get-Item HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Users\Default\Mount).GetValueNames().Contains("Locking")
if(!$lock){
$lock_result = New-ItemProperty  -Path "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Users\Default\Mount" -Name "Locking" -PropertyType DWord -Value 1 -ErrorAction Continue -ErrorVariable err_msg
if($err_msg){
Write-Output ($logInfo +"Failed to configure registry. Result: " +$err_msg)
Write-Output ($logInfo +"Failed to configure registry. Result: " +$err_msg) | Out-File -FilePath $logPathFile -Encoding default -Append
}else{
Write-Output ($logInfo +"Successfully configured registry. Result: " +$lock_result)
Write-Output ($logInfo +"Successfully configured registry. Result: " +$lock_result) | Out-File -FilePath $logPathFile -Encoding default -Append
}
}
}else{
Write-Output "The registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Users\Default\Mount does not exist. Please create it manually."
Write-Output "The registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Users\Default\Mount does not exist. Please create it manually." | Out-File -FilePath $logPathFile -Encoding default -Append
}
$id_path = Test-Path HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default
if ($id_path){
$gid = (Get-Item HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default).GetValueNames().Contains("AnonymousGID")
$uid = (Get-Item HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default).GetValueNames().Contains("AnonymousUID")
if (!$gid){
$gid_result = New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default" -Name "AnonymousGID" -PropertyType DWord -Value 0   -ErrorAction Continue -ErrorVariable gid_err_msg
if($gid_err_msg){
Write-Output ($logInfo +"Failed to configure registry. Result: " +$gid_err_msg)
Write-Output ($logInfo +"Failed to configure registry. Result: " +$gid_err_msg) | Out-File -FilePath $logPathFile -Encoding default -Append
}else{
Write-Output ($logInfo +"Successfully configured registry. Result: " +$gid_result)
Write-Output ($logInfo +"Successfully configured registry. Result: " +$gid_result) | Out-File -FilePath $logPathFile -Encoding default -Append
}
}
if (!$uid){
$uid_result = New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default" -Name "AnonymousUID" -PropertyType DWord -Value 0  -ErrorAction Continue -ErrorVariable uid_err_msg
if($uid_err_msg){
Write-Output ($logInfo +"Failed to configure registry. Result: " +$uid_err_msg)
Write-Output ($logInfo +"Failed to configure registry. Result: " +$uid_err_msg) | Out-File -FilePath $logPathFile -Encoding default -Append
}else{
Write-Output ($logInfo +"Successfully configured registry. Result: " +$uid_result)
Write-Output ($logInfo +"Successfully configured registry. Result: " +$uid_result) | Out-File -FilePath $logPathFile -Encoding default -Append
}
}
}else{
Write-Output ($logInfo +"The registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default does not exist. Please create it manually.")
Write-Output ($logInfo +"The registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default does not exist. Please create it manually.") | Out-File -FilePath $logPathFile -Encoding default -Append
}
$nas_start = (Get-Item HKCU:\Software\Microsoft\Windows\CurrentVersion\Run).GetValueNames().Contains("nas_run")
Write-Output ($logInfo+":Automatic mount on startup>>"+$nas_start)
Write-Output ($logInfo+":Automatic mount on startup>>"+$nas_start) | Out-File -FilePath $logPathFile -Encoding default -Append
if(!$nas_start){
Write-Output ($logInfo+":Configure automatic mount on startup")
Write-Output ($logInfo+":Configure automatic mount on startup") | Out-File -FilePath $logPathFile -Encoding default -Append
$nas_script_path = $myinvocation.mycommand.definition
$run_script = "powershell -file "+ $nas_script_path +" -url "+ $url +" -drive "+ $drive
$nas_run = "nas_run"
$nas_run_result = New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name $nas_run  -PropertyType String -Value $run_script -ErrorAction Continue -ErrorVariable run_err_msg
if($err_msg){
Write-Output ($logInfo +"Failed to configure automatic mount on startup. Result: " +$run_err_msg)
Write-Output ($logInfo +"Failed to configure automatic mount on startup. Result: " +$run_err_msg) | Out-File -FilePath $logPathFile -Encoding default -Append
}else{
Write-Output ($logInfo +"Successfully configured automatic mount on startup. Result: " +$nas_run_result)
Write-Output ($logInfo +"Successfully configured automatic mount on startup. Result: " +$nas_run_result) | Out-File -FilePath $logPathFile -Encoding default -Append
}
}
$nfs_url = "mount -o  nolock -o  mtype=hard -o  timeout=60 \\$url ${drive}:"
Write-Output ($logInfo + ":Start mounting the NAS file system "+$nfs_url)
Write-Output ($logInfo + ":Start mounting the NAS file system "+$nfs_url) | Out-File -FilePath $logPathFile -Encoding default -Append
$result = cmd /c $nfs_url
Write-Output ($logInfo  +":Finished mounting the NAS file system"  +$result)
Write-Output ($logInfo  +":Finished mounting the NAS file system"  +$result) | Out-File -FilePath $logPathFile -Encoding default -Append
Write-Output ($logInfo  +":Configuration finished")
Write-Output ($logInfo  +":Configuration finished") | Out-File -FilePath $logPathFile -Encoding default -Append
}
              

Read-only mount and startup mount

[CmdletBinding()] 
Param( 
# Mount target
[string]$url="100.125.255.100\nas_test",
# Windows drive letter
[string]$drive="z"
)
# Get the current execution time.
$now = Get-Date 
# Specify the directory for the log file. The current execution directory is used.
$logPath="C:\"
# Set the log file name.
$logName = "executLog"
$logFileName= $logName + "_" + $now.ToString("yyyy-MM-dd")+".log"
$logInfo = $now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " " 
# Set the full path for the log file.
$logPathFile = Join-Path $logPath $logFileName
Write-Output ($logInfo+"Mount path:"+$url+" Drive letter:"+$drive)
Write-Output ($logInfo+"Mount path:"+$url+" Drive letter:"+$drive) | Out-File -FilePath $logPathFile -Encoding default -Append
$nfs=get-WindowsFeature -Name "NFS-Client"
if($nfs.installed){
$nas_start = (Get-Item HKCU:\Software\Microsoft\Windows\CurrentVersion\Run).GetValueNames().Contains("nas_run")
Write-Output ($logInfo+":Automatic mount on startup>>"+$nas_start)
Write-Output ($logInfo+":Automatic mount on startup>>"+$nas_start) | Out-File -FilePath $logPathFile -Encoding default -Append
if(!$nas_start){
Write-Output ($logInfo+":Configure automatic mount on startup")
Write-Output ($logInfo+":Configure automatic mount on startup") | Out-File -FilePath $logPathFile -Encoding default -Append
$nas_script_path = $myinvocation.mycommand.definition
$run_script = "powershell -file "+ $nas_script_path +" -url "+ $url +" -drive "+ $drive
$nas_run = "nas_run"
$nas_run_result = New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name $nas_run  -PropertyType String -Value $run_script -ErrorAction Continue -ErrorVariable run_err_msg
if($err_msg){
Write-Output ($logInfo +"Failed to configure automatic mount on startup. Result: " +$run_err_msg)
Write-Output ($logInfo +"Failed to configure automatic mount on startup. Result: " +$run_err_msg) | Out-File -FilePath $logPathFile -Encoding default -Append
}else{
Write-Output ($logInfo +"Successfully configured automatic mount on startup. Result: " +$nas_run_result)
Write-Output ($logInfo +"Successfully configured automatic mount on startup. Result: " +$nas_run_result) | Out-File -FilePath $logPathFile -Encoding default -Append
}
}
Write-Output ($logInfo+"NFS client exists. Mounting the NFS mount target.")
Write-Output ($logInfo+"NFS client exists. Mounting the NFS mount target.") | Out-File -FilePath $logPathFile -Encoding default -Append
$nfs_url = "mount -o  nolock -o  mtype=hard -o  timeout=60 \\$url ${drive}:"
Write-Output ($logInfo + ":Start mounting the NAS file system "+$nfs_url)
Write-Output ($logInfo + ":Start mounting the NAS file system "+$nfs_url) | Out-File -FilePath $logPathFile -Encoding default -Append
$reslut = cmd /c $nfs_url
Write-Output ($logInfo+$reslut)
Write-Output ($logInfo+$reslut) | Out-File -FilePath $logPathFile -Encoding default -Append
}else{
Write-Output ($logInfo +":NFS client is not installed. Installing client and configuring registry. Please restart the system after the script finishes.")
Write-Output ($logInfo +":NFS client is not installed. Installing client and configuring registry. Please restart the system after the script finishes.") | Out-File -FilePath $logPathFile -Encoding default -Append
Add-WindowsFeature -Name "NFS-Client"
$lock_path = Test-Path HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Users\Default\Mount
if($lock_path){
$lock = (Get-Item HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Users\Default\Mount).GetValueNames().Contains("Locking")
if(!$lock){
$lock_result = New-ItemProperty  -Path "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Users\Default\Mount" -Name "Locking" -PropertyType DWord -Value 1 -ErrorAction Continue -ErrorVariable err_msg
if($err_msg){
Write-Output ($logInfo +"Failed to configure registry. Result: " +$err_msg)
Write-Output ($logInfo +"Failed to configure registry. Result: " +$err_msg) | Out-File -FilePath $logPathFile -Encoding default -Append
}else{
Write-Output ($logInfo +"Successfully configured registry. Result: " +$lock_result)
Write-Output ($logInfo +"Successfully configured registry. Result: " +$lock_result) | Out-File -FilePath $logPathFile -Encoding default -Append
}
}
}else{
Write-Output "The registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Users\Default\Mount does not exist. Please create it manually."
Write-Output "The registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Users\Default\Mount does not exist. Please create it manually." | Out-File -FilePath $logPathFile -Encoding default -Append
}
$nas_start = (Get-Item HKCU:\Software\Microsoft\Windows\CurrentVersion\Run).GetValueNames().Contains("nas_run")
Write-Output ($logInfo+":Automatic mount on startup>>"+$nas_start)
Write-Output ($logInfo+":Automatic mount on startup>>"+$nas_start) | Out-File -FilePath $logPathFile -Encoding default -Append
if(!$nas_start){
Write-Output ($logInfo+":Configure automatic mount on startup")
Write-Output ($logInfo+":Configure automatic mount on startup") | Out-File -FilePath $logPathFile -Encoding default -Append
$nas_script_path = $myinvocation.mycommand.definition
$run_script = "powershell -file "+ $nas_script_path +" -url "+ $url +" -drive "+ $drive
$nas_run = "nas_run"
$nas_run_result = New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name $nas_run  -PropertyType String -Value $run_script -ErrorAction Continue -ErrorVariable run_err_msg
if($err_msg){
Write-Output ($logInfo +"Failed to configure automatic mount on startup. Result: " +$run_err_msg)
Write-Output ($logInfo +"Failed to configure automatic mount on startup. Result: " +$run_err_msg) | Out-File -FilePath $logPathFile -Encoding default -Append
}else{
Write-Output ($logInfo +"Successfully configured automatic mount on startup. Result: " +$nas_run_result)
Write-Output ($logInfo +"Successfully configured automatic mount on startup. Result: " +$nas_run_result) | Out-File -FilePath $logPathFile -Encoding default -Append
}
}
$nfs_url = "mount -o  nolock -o  mtype=hard -o  timeout=60 \\$url ${drive}:"
Write-Output ($logInfo+":Start mounting the NAS file system "+$nfs_url)
Write-Output ($logInfo+":Start mounting the NAS file system "+$nfs_url) | Out-File -FilePath $logPathFile -Encoding default -Append
$result = cmd /c $nfs_url
Write-Output ($logInfo  +":Finished mounting the NAS file system"  +$result)
Write-Output ($logInfo  +":Finished mounting the NAS file system"  +$result) | Out-File -FilePath $logPathFile -Encoding default -Append
Write-Output ($logInfo  +":Configuration finished")
Write-Output ($logInfo  +":Configuration finished") | Out-File -FilePath $logPathFile -Encoding default -Append
}