< Back

Resolve-DbaPath

Mon Jan 13, 2020 1:32 pm

NAME Resolve-DbaPath



SYNOPSIS

Resolves a path.





SYNTAX

Resolve-DbaPath [-Path] <System.String[]> [[-Provider] <String>] [-SingleItem <Switch>] [-NewChild <Switch>]

[<CommonParameters>]





DESCRIPTION

Resolves a path.



Will try to resolve to paths including some basic path validation and resolution.



Will fail if the path cannot be resolved (so an existing path must be reached at).





PARAMETERS

-NewChild [<Switch>]

Assumes one wishes to create a new child item.

The parent path will be resolved and must validate true.

The final leaf will be treated as a leaf item that does not exist yet.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Path [<System.String[]>]

The path to validate.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Provider [<String>]

Ensure the path is of the expected provider.

Allows ensuring one does not operate in the wrong provider.

Common providers include the filesystem, the registry or the active directory.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-SingleItem [<Switch>]

Ensure the path should resolve to a single path only.

This may - intentionally or not - trip up wildcard paths.



Required? false

Position? named

Default value

Accept pipeline input? False

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



OUTPUTS



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



PS C:\\>Resolve-DbaPath -Path report.log -Provider FileSystem -NewChild -SingleItem



Ensures the resolved path is a FileSystem path.

This will resolve to the current folder and the file report.log.

Will not ensure the file exists or doesn't exist.

If the current path is in a different provider, it will throw an exception.

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



PS C:\\>Resolve-DbaPath -Path ..\\*



This will resolve all items in the parent folder, whatever the current path or drive might be.



RELATED LINKS