What specific powershell cmdlet shows information about nfs shares on a server?

This article details how to setup a Windows device to support Network File System (NFS) shares and connect to them.

Requirements

  •  Windows computer running server or desktop OS that is in support.

Mounting the NFS Share

  1.  Make sure that the NFS Client is installed.
    1. Open a Powershell command prompt.
    2. Run the appropriate command for your situation:
      • Server OS: Install-WindowsFeature NFS-Client
      • Desktop OS: Enable-WindowsOptionalFeature -FeatureName ServicesForNFS-ClientOnly, ClientForNFS-Infrastructure -Online -NoRestart
  2. Mount the share using the following command, after making the required modifications:
    • mount -o anon nfs.share.server.name:/share-name X:
      • Replace nfs.share.server.name with the name of the server the NFS share is on (eg. files.umn.edu)
      • Replace share-name with the name of the NFS share (eg. OIT-Test)
      • Replace X: with the desired drive letter.

Escalation Path

Problems with mounting NFS share on Windows computers should be escalated go through the Desktop Support queues and then to Computer Management if the problem cannot be resolved.

Powershell is not able too use SMB protocol in order to list the shares on a remote computer. There's only one way of enumerating shares remotely from the command line that I know of, and thats with net view:

C:\Users\mark.henderson>net view \\enetsqnap01
Shared resources at \\enetsqnap01



Share name             Type  Used as  Comment

-------------------------------------------------------------------------------
Backups                Disk
CallRecordings         Disk
Download               Disk           System default share
home                   Disk           Home
homes                  Disk           System default share
Installs               Disk
Justin                 Disk           Copy of files from Justin laptop
michael                Disk
Multimedia             Disk           System default share
Network Recycle Bin 1  Disk           [RAID5 Disk Volume: Drive 1 2 3 4]
Public                 Disk           System default share
Qsync                  Disk           Qsync
Recordings             Disk           System default share
Sales                  Disk           Sales Documents
SalesMechanix          Disk
Server2012             Disk           Windows Server 2012 Install Media
Usb                    Disk           System default share
VMWareTemplates        Disk
Web                    Disk           System default share
The command completed successfully.

This is not particularly parsable on its own, but, you can throw it into an array to process the data line by line:

$sharedFolders = (NET.EXE VIEW \\enetsqnap01) 

You now have an array, and starting at $sharedFolders[7] you have your shares. You could then split on something like a double space - unlikely to appear in a share name itself, and should work unless your share name is very long, only leaving a single space between the share name and the type field:

$sharedFolders[7].split('  ')[0]
Backups

You could process these by using a ForEach and some conditional logic. It wouldn't be perfect, but it should work for most use cases.

For brevity, to just output the filenames to the console:

(net view \\enetsqnap01) | % { if($_.IndexOf(' Disk ') -gt 0){ $_.Split('  ')[0] } }

The HCL Docs Conversion server needs access to the File Viewer and HCL Docs shared storage to be able to store the document data after converting from the native file types. Since Conversion is only supported on Windows, the shared data folders will need to be mounted as Windows shares and provide the proper access for reading and writing from these shares.

The following steps are for Windows 2008 Server. Instructions for Windows 2012 are presented in additional notes.

  1. Ensure that you are logged into the Windows server as an administrator.
  2. Start the command console as the administrator (Click or Command Prompt)
  3. Right-click the Windows Powershell or Command Prompt, and select .

    Note: Ensure to select Windows Powershell, not Windows Powershell(x86).

  4. Run the following command to install FS-NFS-Services:

    servermanagercmd.exe -install FS-NFS-Services

    Note: To Windows Server 2012 Datacenter/Standard/Essentials Edition, you can run the command through powerscript:

    Import-Module ServerManager
    Install-WindowsFeature -Name FS-NFS-Service
    Install-WindowsFeature NFS-Client

    You can also do the steps:

    1. Run servermanager.exe.
    2. From the Add Roles and Features Wizard, under Server Roles, select File and Storage Services if it has not been installed.
    3. Under File and iSCSI Services, select File Server and Server for NFS. Click Add Features to select Client for NFS.

  5. Open a command prompt with administrative rights. Run the following command:
    • For HCL Docs: umount –f W:
    • For File Viewer: umount –f Y:
    • For Document Format Conversion:
      umount –f W:
      umount –f Y:
  6. Run:

    nfsadmin client stop

  7. Open Regedit and navigate to the following branch:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default

  8. In the main window, right-click and select . Set the name as AnonymousGID.
  9. Right-click and select again. Set the name as AnonymousUID.
  10. Double-click on AnonymousGID and AnonymousUID, set the value as 0 and the base as Decimal respectively.
  11. Click OK.
  12. Close Regedit.
  13. In the command prompt, run:

    nfsadmin client start

  14. Close the Windows Powershell Console.
  15. Open a command prompt.
  16. Run the following command in a command prompt (not Powershell) to set the NFS configuration:

    nfsadmin client localhost config fileaccess=755 SecFlavors=+sys -krb5 -krb5i

  17. Run the following commands to mount the share:

    • For HCL Docs: mount -o mtype=soft acdirmin=0 retry=10 timeout=6 casesensitive=yes anon DocsLab01.renovations.com:/nfs/docs_data W:
    • For File Viewer: mount -o mtype=soft acdirmin=0 retry=10 timeout=6 casesensitive=yes anon DocsLab01.renovations.com:/nfs/viewer_data Y:
    • For Document Format Conversion:
      mount -o mtype=soft acdirmin=0 retry=10 timeout=6 casesensitive=yes anon DocsLab01.renovations.com:/nfs/docs_data W:
      mount -o mtype=soft acdirmin=0 retry=10 timeout=6 casesensitive=yes anon DocsLab01.renovations.com:/nfs/viewer_data Y:

    Note:

    • If you do not mount successfully, run umount –f W: or umount –f Y: and then repeat again.
    • Make sure you mount the viewer_data directory to the server where you deploy Connections.

  18. In order to mount the share automatically with windows restart:
    1. Create a batch file, for example, c:\IBMConversionNFS\nfsmount.bat, and type:
      mount -o mtype=soft acdirmin=0 retry=10 timeout=6 casesensitive=yes anon DocsLab01.renovations.com:/nfs/docs_data W:
      mount -o mtype=soft acdirmin=0 retry=10 timeout=6 casesensitive=yes anon DocsLab01.renovations.com:/nfs/viewer_data Y:
    2. Click .
    3. Click Create Task in Task Scheduler (Local).
    4. Click General, and type nfs_auto_mount for Name. In Security options, click , and select SYSTEM. Select Run whether user is logged on or not Select, along with Do not store password, and then select Run with highest privileges. Finally click OK.
    5. Click , select At startup for Begin the task. Click OK.
    6. Click , select c:\IBMConversionNFS\nfsmount.bat and click OK.
    7. Click OK.
    8. Restart the machine.
    9. The client mounted points will be displayed in Windows explorer as Disconnected Network drivers, and this is the expected normal status. This will ensure the scheduled task is working, as well as causing the drives to be mounted as SYSTEM, which is necessary for the install procedure.

    Note:

    • If the node and server are configured to start automatically along with the Windows Operating System, they will be system services running with a user name of SYSTEM. Looking at the services with the Task Manager, the user name for java.exe will show SYSTEM. In this case, the mount must also be done with a user of SYSTEM (as previously shown) or the NFS shares will not be able to be accessed from the node or server.
    • To verify the SYSTEM user has access to the mounted drive. Download the tool PSEXEC from following link: https://blogs.technet.microsoft.com/askds/2008/10/22/getting-a-cmd-prompt-as-system-in-windows-vista-and-windows-server-2008. This tool will start a command prompt as SYSTEM user, and you can change directory to the mounted drive in the command prompt to check the accessibility.
    • If the mount action is done using a user name of SYSTEM, the NFS shares will be able to be accessed regardless of what user name the node or server is running as.
    • Another NFS setup is specified in the technote http://www.ibm.com/support/docview.wss?uid=swg21674026. In this setup both mount command and Websphere are running by the same login Windows user other than SYSTEM.

Result

If W: or Y: cannot be found, open the Task Scheduler window, find the error code in "Last Run Result" of the auto mount task that is just created. Fix the error and then restart the machine.

What is the name for a NFS share on a Windows failover cluster?

What is the name for a NFS share on a Windows failover cluster? NFS Data store. What option in the New Share Wizard creates a share that is suitable for Hyper-V? SMB- Share- Applications.

What PowerShell cmdlet would enable data deduplication on volume G for general file server usage?

The Enable-DedupVolume cmdlet enables data deduplication on one or more volumes. You can use the Set-DedupVolume cmdlet to customize the data deduplication settings. Data deduplication is disabled by default.

What PowerShell cmdlet can be used by an administrator to install a specific server role?

To install roles and features by using the Install-WindowsFeature cmdlet. Do one of the following to open a Windows PowerShell session with elevated user rights. If you are installing roles and features on a remote server, you do not need to run Windows PowerShell with elevated user rights.

Which of the following is a file sharing protocol that allows users to access files and folders?

Feature description. The Server Message Block (SMB) protocol is a network file sharing protocol that allows applications on a computer to read and write to files and to request services from server programs in a computer network. The SMB protocol can be used on top of its TCP/IP protocol or other network protocols.