This post covers the Server for NFS PowerShell cmdlets in Windows Server 2012 with brief description about each of them.

You can get Server for NFS PowerShell cmdlets by installing “Server for NFS” role service from the File and Storage Services or by installing “Services for Network File System Management Tools” from Remote Server Administration Tools. 

You can list the entire Server for NFS PowerShell cmdlets by running the following command 

Get-Command –Module NFS

The following table lists Server for NFS cmdlets grouped by functionality.

 

Group

Cmdlets

Description

Share

Get-NfsShare

Lists all the shares on the server along with their properties.

New-NfsShare

Creates a new share on the server.

The share can be a standard share or a clustered share.

Set-NfsShare

Modifies the share configuration of standard as well as clustered shares.

Remove-NfsShare

Deletes NFS shares from the server. The share can be a standard or clustered share.

Share Permission

Get-NfsSharePermission

Retrieves the permissions on a share.

Grant-NfsSharePermission

Adds or modifies share permissions.

 

Permissions can be granted to individual hosts, global (all machines) or to groups such as clientgroup or netgroups.

 

Allows granting read only, read write or no access to clients.

Revoke-NfsSharePermission

Removes permissions for a given client on a share.

Server Configuration

Get-NfsServerConfiguration

Retrieves the Server for NFS configuration.

Set-NfsServerConfiguration

Modifies Server for NFS configuration.

Client Configuration

Get-NfsClientConfiguration

Retrieves Client for NFS configuration.

Set-NfsClientConfiguration

Modifies Client for NFS configuration. Multiple client configuration properties can be modified at the same time.

Netgroup Store

Set-NfsNetgroupStore

Modifies the netgroup source configuration on the server. The netgroup source can be Active Directory, RFC2307 compliant LDAP server or NIS server.

Get-NfsNetgroupStore

Retrieves the netgroup source configuration on the server. The server can be configured to use Active Directory, RFC2307 compliant LDAP or NIS server netgroup stores as its netgroup source.

Identity Mapping Store

Get-NfsMappingStore

Retrieves the identity mapping source on the server or client. The identity mapping source can be configured to use local files such as passwd and group files, Active Directory, RFC2307 compliant LDAP server or a User Name Mapping server as its identity mapping source.

Set-NfsMappingStore

Modifies the mapping store on NFS server or client.

Install-NfsMappingStore

Installs and configures an Active Directory Lightweight Directory Service server as mapping store.

 

The cmdlet installs the AD LDS role, creates an instance for the mapping store and also adds the schema required for the UID and GID attributes for user/group objects.

 

Test-NfsMappingStore

Verifies if the mapping store on the server has been configured correctly. It verifies that the mapping store is reachable and also checks if necessary schema is installed on the server and if the domain functional level is Windows Server 2003 R2 and above in case of domain based mapping store.

Identity Mapping

Get-NfsMappedIdentity

Lists all the mapping between a user's UNIX and Windows accounts from the identity mapping source.

The cmdlet can retrieve mapping from various mapping sources. The mapping source can be Active Directory, RFC2307 compliant LDAP server or mapping files (passwd/group files). If the mapping source is not specified, the cmdlet uses server’s mapping source configuration to retrieve the information.

New-NfsMappedIdentity

Creates a new mapping between windows user (or group) account to corresponding UNIX identifier.

 

The mapping store can be Active Directory or RFC2307 compliant LDAP server.

 

User or group account is created if they don’t exist.

Set-NfsMappedIdentity

Modifies or sets a mapping between a Windows user/group account to UNIX identifiers.

The mapping store can be Active Directory or RFC2307 compliant LDAP server.

Remove-NfsMappedIdentity

Removes a mapping from a user or group windows account.

Resolve-NfsMappedIdentity

Checks that the server can resolve a mapping for given user or group account name to UNIX identifier and vice versa.

The server uses its identity mapping source configuration to retrieve the mapping. 

Test-NfsMappedIdentity

Verifies existing mapped identities and checks if they are configured correctly.

The cmdlet will check for duplicate UID\GID and also validates the group membership for user accounts as per GID assignment.

Client

Get-NfsMountedClient

Enumerates the clients connected to Server for NFS using NFS v4.1.

Revoke-NfsMountedClient

Revoke a client V4.1 connection to Server for NFS.

Clientgroup

Get-NfsClientgroup

Lists all the clientgroups on the Server for NFS.

New-NfsClientgroup

Creates a new clientgroup on the server. Members can also be added to the new clientgroup at the time of creation.

Set-NfsClientgroup

Adds or removes members from a clientgroup. Multiple members can be added or removed in a single command.

Rename-NfsClientgroup

Renames a clientgroup.

Remove-NfsClientgroup

Deletes a clientgroup from the server.

Netgroup

Get-NfsNetgroup

Enumerates netgroups configured in Active Directory, RFC2307 compliant LDAP server or NIS server.

Remove-NfsNetgroup

Deletes a netgroup from Active Directory or LDAP server.

New-NfsNetgroup

Creates a new netgroup in Active Directory or LDAP server. Members can also be added to netgroup at the time of creation.

Set-NfsNetgroup

Adds or removes members from a netrgroup. The netgroup store can be Active Directory or RFC2307 compliant LDAP server.

Lock

Get-NfsClientLock

List the locks opened by a client on the server. The cmdlet lists both the NLM and NFS v4.1 byte range locks.

Revoke-NfsClientLock

Revokes locks on a given set of files or locks held by a given client computer.

Open File

Revoke-NfsOpenFile

Revokes open state and handles for files opened by clients using NFS V4.1 to Server for NFS.

Get-NfsOpenFile

Enumerates file opened using NFS V4.1 on Server for NFS.

Session

Disconnect-NfsSession

Disconnect an NFS V4.1 session on Server for NFS.

Get-NfsSession

List the currently open V4.1 sessions on Server for NFS.

Statistics

Reset-NfsStatistics

Resets the statistics on Server for NFS.

Get-NfsStatistics

Enumerates NFS and MOUNT statistics on the server

 

Feedback

Please send feedback you might have to nfsfeed@microsoft.com