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[]>]
   [-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 do not 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 "G:" drive letter. Any users, applications, or containers can now access data on the G: 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

-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

-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

-RemotePath

Specifies the remote path that is 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

-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

-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 is not run.

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

Inputs

None

Outputs

CimInstance