Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ValidateDrive and ValidateUserDrive attributes information. #2114

Merged
merged 1 commit into from
Feb 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,43 @@ Param
)
```

## ValidateDrive Validation Attribute

The ValidateDrive attribute specifies that the parameter value must represent
the path, that is referring to allowed drives only. PowerShell generates
an error if the parameter value refers to drives other than the allowed.
Existence of the path, except for the drive itself, is not verified.

If you use relative path, the current drive must be in the allowed drive list.

```powershell
Param
(
[ValidateDrive("C","D","Variable","Function")]
[string]$Path
)
```

## ValidateUserDrive Validation Attribute

The ValidateUserDrive attribute specifies that the parameter value
must represent the path, that is referring to `User` drive.
PowerShell generates an error if the path refers to other drives.
Existence of the path, except for the drive itself, is not verified.

If you use relative path, the current drive must be `User`.

You can define `User` drive in Just Enough Administration (JEA)
session configurations.


```powershell
Param
(
[ValidateUserDrive()]
[string]$Path
)
```

## Dynamic Parameters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,43 @@ Param
)
```

## ValidateDrive Validation Attribute

The ValidateDrive attribute specifies that the parameter value must represent
the path, that is referring to allowed drives only. PowerShell generates
an error if the parameter value refers to drives other than the allowed.
Existence of the path, except for the drive itself, is not verified.

If you use relative path, the current drive must be in the allowed drive list.

```powershell
Param
(
[ValidateDrive("C","D","Variable","Function")]
[string]$Path
)
```

## ValidateUserDrive Validation Attribute

The ValidateUserDrive attribute specifies that the parameter value
must represent the path, that is referring to `User` drive.
PowerShell generates an error if the path refers to other drives.
Existence of the path, except for the drive itself, is not verified.

If you use relative path, the current drive must be `User`.

You can define `User` drive in Just Enough Administration (JEA)
session configurations.


```powershell
Param
(
[ValidateUserDrive()]
[string]$Path
)
```

## Dynamic Parameters

Expand Down