external help file | Module Name | online version | schema |
---|---|---|---|
PSScriptTools-help.xml |
PSScriptTools |
2.0.0 |
Create a new PSDrive at the current location.
New-PSDriveHere [[-Path] <String>] [-First] [-SetLocation] [-PassThru]
[-WhatIf] [-Confirm] [<CommonParameters>]
New-PSDriveHere [[-Path] <String>] [[-Name] <String>] [-SetLocation]
[-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]
This function will create a new PSDrive at the specified location. The default is the current location, but you can specify any PSPath. The function will take the last word of the path and use it as the name of the new PSDrive. If you prefer to use the first word of the location, use -First. If you prefer to specify a completely different name, then use the -Name parameter.
This command will not write anything to the pipeline unless you use -PassThru.
PS C:\users\jeff\documents\Enterprise Mgmt Webinar\> New-PSDriveHere
This will create a new PSDrive called Webinar rooted to the current location.
PS C:\users\jeff\documents\Enterprise Mgmt Webinar\> New-PSDriveHere -first
This will create a new PSDrive called Enterprise rooted to the current location.
PS C:\> New-PSDriveHere HKLM:\software\microsoft -PassThru |
Select-Object -Expandproperty Name
microsoft
PS C:\> New-PSDriveHere -Path "\\NAS\files\powershell" -Name PSFiles
Create a new PSDrive called PSFiles rooted to the specified path.
PS C:\Users\Jeff\Documents\DeepDive\> New-PSDriveHere . DeepDive -setlocation
PS DeepDive:\>
Create a new PSDrive and change location to it.
The path for the new PSDrive. The default is the current location.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: .
Accept pipeline input: False
Accept wildcard characters: False
The name for the new PSDrive. The default is the last word in the specified location, unless you use -First.
Type: String
Parameter Sets: Name
Aliases:
Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Use the first word of the current location for the new PSDrive.
Type: SwitchParameter
Parameter Sets: Folder
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Set location to this new drive. This parameter has an alias of CD.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cd
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Pass the new PSDrive object to the pipeline.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Originally published at http://jdhitsolutions.com/blog/2010/08/New-PSDriveHere/
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/