< Back

Mount-LongShare

Sun Jan 19, 2020 5:59 pm

NAME Mount-LongShare



SYNOPSIS

Maps network drive





SYNTAX

Mount-LongShare [-DriveLetter] <String> [-NetWorkShare] <String> [<CommonParameters>]



Mount-LongShare [-DriveLetter] <String> [-NetWorkShare] <String> [-Credential] <PSCredential> [<CommonParameters>]





DESCRIPTION

Map a network share to a local drive





PARAMETERS

-DriveLetter <String>

The name of a local device\\drive to be redirected, such as "F:".

Note: you may omit the ':' in the drive letter, e.g. F



Required? true

Position? 0

Default value

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-NetWorkShare <String>

The network resource to connect to. The string can be up to MAX_PATH characters in length.



Required? true

Position? 1

Default value

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Credential <PSCredential>

An instance of PSCredential which provides credentials for password-based authentication used to gain access

to network resources that are restricted.



Required? true

Position? 2

Default value

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

System.String,

System.Management.Automation.PSCredential







OUTPUTS

none







-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Mount-LongShare -DriveLetter Z: -NetWorkShare \\\\contoso\\share1 -Verbose



Maps the network share named share1 to the local drive Z:

-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Mount-LongShare -DriveLetter F: -NetWorkShare \\\\contoso\\share1 -Credential (Get-Credential)



the credential parameter is used to pass alternate credentials to access the network share "share1" and map it to

drive F:

-------------------------- EXAMPLE 3 --------------------------



PS C:\\>$cred = Get-Credential

Mount-LongShare -DriveLetter G: -NetWorkShare \\\\contoso\\share1 -Credential $cred



the get-credential cmdlet is used to store credentials in the variable 'cred'

the cred variable is then passed to the credential parameter in Mount-LongShare to map Share1 to Drive G:



RELATED LINKS