New-SmbGlobalMapping

Creates an SMB global mapping.

Syntax

New-SmbGlobalMapping
   [[-LocalPath] <String>]
   [-RemotePath] <String>
   -Credential <PSCredential>
   [-Persistent <Boolean>]
   [-RequireIntegrity <Boolean>]
   [-RequirePrivacy <Boolean>]
   [-UseWriteThrough <Boolean>]
   [-FullAccess <String[]>]
   [-DenyAccess <String[]>]
   [-TransportType <TransportType>]
   [-SkipCertificateCheck]
   [-CompressNetworkTraffic <Boolean>]
   [-BlockNTLM <Boolean>]
   [-TcpPort <UInt16>]
   [-QuicPort <UInt16>]
   [-RdmaPort <UInt16>]
   [-CimSession <CimSession[]>]
   [-ThrottleLimit <Int32>]
   [-AsJob]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The New-SmbGlobalMapping cmdlet creates an SMB global mapping on the SMB client to an SMB share. Global mappings allow all users to use the same mapping. Its primary use is for Windows Containers. Global mappings support standalone and failover cluster SMB shares, they don't support DFS Namespace folder shares.

Examples

Example 1

$creds = Get-Credential
New-SmbGlobalMapping -RemotePath "\\fs1.contoso.com\public" -Credential $creds -LocalPath "G:"

Status Local Path Remote Path
------ ---------- -----------
OK     G:         \\fs1.contoso.com\public

This command will gather the credentials for the global mapping. It then maps the remote share path \\fs1.contoso.com\public to the indicated drive letter. Any users, applications, or containers can now access data on that drive.

Parameters

-AsJob

Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-BlockNTLM

Specifies whether to block NT LAN Manager (NTLM) authentication. If this parameter is set to $true, NTLM authentication will be blocked forcing the connection to use another negotiated authentication method, such as Kerberos. If set to $false (default), NTLM authentication will be allowed.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-CimSession

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

Type:CimSession[]
Aliases:Session
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-CompressNetworkTraffic

Specifies whether to compress network traffic. If this parameter is set to $true, network traffic will be compressed. If set to $false (default), network traffic won't be compressed.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Credential

Specifies a credential gathered with Get-Credential.

Type:PSCredential
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-DenyAccess

Specifies which accounts are denied access to the SMB mapping. Multiple accounts can be specified by supplying a comma-separated list. For example: -NoAccess "NT AUTHORITY\SYSTEM", "contoso\ned".

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-FullAccess

Specifies which accounts are granted full permission to access the SMB mapping. Use a comma-separated list to specify multiple accounts. For example: -FullAccess "NT AUTHORITY\SYSTEM", "contoso\ned".

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-LocalPath

Specifies the local driver letter to which the remote path is mapped.

Type:String
Position:1
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Persistent

Indicates that this connection is recreated after reboot.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-QuicPort

Specifies the port number to be used for QUIC protocol connections.

Type:UInt16
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RdmaPort

Specifies the port number to be used for Remote Direct Memory Access (RDMA) protocol connections.

Type:UInt16
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RemotePath

Specifies the remote path that's accessed from this computer.

Type:String
Position:2
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-RequireIntegrity

Indicates that SMB signing is required for the mapped drive.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RequirePrivacy

Indicates that SMB encryption is required for the mapped drive.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SkipCertificateCheck

Specifies whether to skip certificate validation when establishing a connection.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TcpPort

Specifies the port number to be used for Transmission Control Protocol (TCP) connections.

Type:UInt16
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ThrottleLimit

Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0 is entered, then Windows PowerShell calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TransportType

Specifies the transport protocol to be used for the connection. The accepted values for this parameter are:

  • None
  • TCP
  • QUIC
Type:TransportType
Accepted values:None, TCP, QUIC
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-UseWriteThrough

Indicates that forced unit access (write through) is required and bypasses all OS caches, forcing IO to disk.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet isn't run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

CimInstance