Skip to content
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 @@ -17,21 +17,22 @@ Encrypts content by using the Cryptographic Message Syntax format.
### ByContent (Default)

```
Protect-CmsMessage [-To] <CmsMessageRecipient[]> [-Content] <PSObject> [[-OutFile] <String>]
[<CommonParameters>]
Protect-CmsMessage [-To] <CmsMessageRecipient[]> [-Content] <PSObject>
[[-OutFile] <String>] [<CommonParameters>]
```

### ByPath

```
Protect-CmsMessage [-To] <CmsMessageRecipient[]> [-Path] <String> [[-OutFile] <String>] [<CommonParameters>]
Protect-CmsMessage [-To] <CmsMessageRecipient[]> [-Path] <String> [[-OutFile] <String>]
[<CommonParameters>]
```

### ByLiteralPath

```
Protect-CmsMessage [-To] <CmsMessageRecipient[]> [-LiteralPath] <String> [[-OutFile] <String>]
[<CommonParameters>]
Protect-CmsMessage [-To] <CmsMessageRecipient[]> [-LiteralPath] <String>
[[-OutFile] <String>] [<CommonParameters>]
```

## DESCRIPTION
Expand Down
61 changes: 33 additions & 28 deletions reference/5.1/Microsoft.PowerShell.Security/Set-Acl.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,25 @@ Changes the security descriptor of a specified item, such as a file or a registr
### ByPath (Default)

```
Set-Acl [-Path] <String[]> [-AclObject] <Object> [[-CentralAccessPolicy] <String>] [-ClearCentralAccessPolicy]
[-PassThru] [-Filter <String>] [-Include <String[]>] [-Exclude <String[]>] [-WhatIf] [-Confirm]
[-UseTransaction] [<CommonParameters>]
Set-Acl [-Path] <String[]> [-AclObject] <Object> [[-CentralAccessPolicy] <String>]
[-ClearCentralAccessPolicy] [-PassThru] [-Filter <String>] [-Include <String[]>]
[-Exclude <String[]>] [-WhatIf] [-Confirm] [-UseTransaction] [<CommonParameters>]
```

### ByInputObject

```
Set-Acl [-InputObject] <PSObject> [-AclObject] <Object> [-PassThru] [-Filter <String>] [-Include <String[]>]
[-Exclude <String[]>] [-WhatIf] [-Confirm] [-UseTransaction] [<CommonParameters>]
Set-Acl [-InputObject] <PSObject> [-AclObject] <Object> [-PassThru] [-Filter <String>]
[-Include <String[]>] [-Exclude <String[]>] [-WhatIf] [-Confirm] [-UseTransaction]
[<CommonParameters>]
```

### ByLiteralPath

```
Set-Acl -LiteralPath <String[]> [-AclObject] <Object> [[-CentralAccessPolicy] <String>]
[-ClearCentralAccessPolicy] [-PassThru] [-Filter <String>] [-Include <String[]>] [-Exclude <String[]>]
[-WhatIf] [-Confirm] [-UseTransaction] [<CommonParameters>]
[-ClearCentralAccessPolicy] [-PassThru] [-Filter <String>] [-Include <String[]>]
[-Exclude <String[]>] [-WhatIf] [-Confirm] [-UseTransaction] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -129,20 +130,20 @@ Set-Acl -Path "C:\Pets\Dog.txt" -AclObject $NewAcl
These commands disable access inheritance from parent folders, while still preserving the existing
inherited access rules.

The first command uses the `Get-Acl` cmdlet to get the security descriptor of the Dog.txt file.
The first command uses the `Get-Acl` cmdlet to get the security descriptor of the `Dog.txt` file.

Next, variables are created to convert the inherited access rules to explicit access rules. To
protect the access rules associated with this from inheritance, set the `$isProtected` variable to
`$true`. To allow inheritance, set `$isProtected` to `$false`. For more information, see
[set access rule protection](/dotnet/api/system.security.accesscontrol.objectsecurity.setaccessruleprotection).
[set access rule protection](xref:System.Security.AccessControl.ObjectSecurity.SetAccessRuleProtection%2A).

Set the `$preserveInheritance` variable to `$true` to preserve inherited access rules or `$false` to
remove inherited access rules. Then the access rule protection is updated using the
**SetAccessRuleProtection()** method.

The last command uses `Set-Acl` to apply the security descriptor of to Dog.txt. When the command
completes, the ACLs of the Dog.txt that were inherited from the Pets folder will be applied directly
to Dog.txt, and new access policies added to Pets will not change the access to Dog.txt.
The last command uses `Set-Acl` to apply the security descriptor to `Dog.txt`. When the command
completes, the ACLs of the `Dog.txt` that were inherited from the Pets folder will be applied directly
to `Dog.txt`, and new access policies added to Pets will not change the access to `Dog.txt`.

### Example 5: Grant Administrators Full Control of the file

Expand All @@ -154,29 +155,33 @@ $fileSystemRights = "FullControl"
$type = "Allow"
# Create new rule
$fileSystemAccessRuleArgumentList = $identity, $fileSystemRights, $type
$fileSystemAccessRule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $fileSystemAccessRuleArgumentList
$newParams = @{
TypeName = 'System.Security.AccessControl.FileSystemAccessRule'
ArgumentList = $fileSystemAccessRuleArgumentList
}
$fileSystemAccessRule = New-Object @newParams
# Apply new rule
$NewAcl.SetAccessRule($fileSystemAccessRule)
Set-Acl -Path "C:\Pets\Dog.txt" -AclObject $NewAcl
```

This command will grant the **BUILTIN\Administrators** group Full control of the Dog.txt file.
This command will grant the **BUILTIN\Administrators** group Full control of the `Dog.txt` file.

The first command uses the `Get-Acl` cmdlet to get the security descriptor of the Dog.txt file.
The first command uses the `Get-Acl` cmdlet to get the security descriptor of the `Dog.txt` file.

Next variables are created to grant the **BUILTIN\Administrators** group full control of the Dog.txt
file. The `$identity` variable set to the name of a
[user account](/dotnet/api/system.security.accesscontrol.filesystemaccessrule.-ctor). The
Next variables are created to grant the **BUILTIN\Administrators** group full control of the
`Dog.txt` file. The `$identity` variable set to the name of a
[user account](xref:System.Security.AccessControl.FileSystemAccessRule.%23ctor%2A). The
`$fileSystemRights` variable set to FullControl, and can be any one of the
[FileSystemRights](/dotnet/api/system.security.accesscontrol.filesystemrights) values that specifies
the type of operation associated with the access rule. The `$type` variable set to "Allow" to
specifies whether to allow or deny the operation. The `$fileSystemAccessRuleArgumentList` variable
is an argument list is to be passed when making the new **FileSystemAccessRule** object. Then a new
[FileSystemRights](xref:System.Security.AccessControl.FileSystemRights) values that specifies the
type of operation associated with the access rule. The `$type` variable set to "Allow" to specifies
whether to allow or deny the operation. The `$fileSystemAccessRuleArgumentList` variable is an
argument list is to be passed when making the new **FileSystemAccessRule** object. Then a new
**FileSystemAccessRule** object is created, and the **FileSystemAccessRule** object is passed to the
**SetAccessRule()** method, adds the new access rule.

The last command uses `Set-Acl` to apply the security descriptor of to Dog.txt. When the command
completes, the **BUILTIN\Administrators** group will have full control of the Dog.txt.
The last command uses `Set-Acl` to apply the security descriptor of to `Dog.txt`. When the command
completes, the **BUILTIN\Administrators** group will have full control of the `Dog.txt`.

## PARAMETERS

Expand Down Expand Up @@ -364,7 +369,7 @@ Changes the security descriptor of the specified item. Enter the path to an item
a file or registry key. Wildcards are permitted.

If you pass a security object to `Set-Acl` (either by using the **AclObject** or
**SecurityDescriptor** parameters or by passing a security object from Get-Acl to `Set-Acl`), and
**SecurityDescriptor** parameters or by passing a security object from `Get-Acl` to `Set-Acl`), and
you omit the **Path** parameter (name and value), `Set-Acl` uses the path that is included in the
security object.

Expand Down Expand Up @@ -467,8 +472,8 @@ can use it to change the security descriptors of files, directories, and registr

[Get-Acl](Get-Acl.md)

[FileSystemAccessRule](/dotnet/api/system.security.accesscontrol.filesystemaccessrule.-ctor)
[FileSystemAccessRule](xref:System.Security.AccessControl.FileSystemAccessRule.%23ctor%2A)

[ObjectSecurity.SetAccessRuleProtection](/dotnet/api/system.security.accesscontrol.objectsecurity.setaccessruleprotection)
[ObjectSecurity.SetAccessRuleProtection](xref:System.Security.AccessControl.ObjectSecurity.SetAccessRuleProtection%2A)

[FileSystemRights](/dotnet/api/system.security.accesscontrol.filesystemrights)
[FileSystemRights](xref:System.Security.AccessControl.FileSystemRights)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ Sets the PowerShell execution policies for Windows computers.
### All

```
Set-ExecutionPolicy [-ExecutionPolicy] <ExecutionPolicy> [[-Scope] <ExecutionPolicyScope>] [-Force]
[-WhatIf] [-Confirm] [<CommonParameters>]
Set-ExecutionPolicy [-ExecutionPolicy] <ExecutionPolicy> [[-Scope] <ExecutionPolicyScope>]
[-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION

The `Set-ExecutionPolicy` cmdlet changes PowerShell execution policies for Windows computers. For
more information, see [about_Execution_Policies](../Microsoft.PowerShell.Core/about/about_Execution_Policies.md).
more information, see
[about_Execution_Policies](../Microsoft.PowerShell.Core/about/about_Execution_Policies.md).

An execution policy is part of the PowerShell security strategy. Execution policies determine
whether you can load configuration files, such as your PowerShell profile, or run scripts. And,
Expand Down
37 changes: 26 additions & 11 deletions reference/5.1/Microsoft.PowerShell.Security/Test-FileCatalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ This cmdlet is only supported on Windows.
## SYNTAX

```
Test-FileCatalog [-Detailed] [-FilesToSkip <String[]>] [-CatalogFilePath] <String> [[-Path] <String[]>]
[-WhatIf] [-Confirm] [<CommonParameters>]
Test-FileCatalog [-Detailed] [-FilesToSkip <String[]>] [-CatalogFilePath] <String>
[[-Path] <String[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION

`Test-FileCatalog` validates the authenticity of files by comparing the file hashes of a catalog
file (.cat) with the hashes of actual files on disk. If it detects any mismatches, it returns the
status as ValidationFailed. Users can retrieve all this information by using the -Detailed
parameter. It also displays signing status of catalog in Signature property which is equivalent to
parameter. It also displays signing status of catalog in Signature property, which is equivalent to
calling `Get-AuthenticodeSignature` cmdlet on the catalog file. Users can also skip any file during
validation by using the -FilesToSkip parameter.

Expand All @@ -39,9 +39,18 @@ This cmdlet is only supported on Windows.
### Example 1: Create and validate a file catalog

```powershell
New-FileCatalog -Path $PSHOME\Modules\Microsoft.PowerShell.Utility -CatalogFilePath \temp\Microsoft.PowerShell.Utility.cat -CatalogVersion 2.0

Test-FileCatalog -CatalogFilePath \temp\Microsoft.PowerShell.Utility.cat -Path "$PSHOME\Modules\Microsoft.PowerShell.Utility\"
$NewFileCatalogParams = @{
Path = "$PSHOME\Modules\Microsoft.PowerShell.Utility"
CatalogFilePath = "\temp\Microsoft.PowerShell.Utility.cat"
CatalogVersion = 2.0
}
New-FileCatalog @NewFileCatalogParams

$TestFileCatalogParams = @{
CatalogFilePath = "\temp\Microsoft.PowerShell.Utility.cat"
Path = "$PSHOME\Modules\Microsoft.PowerShell.Utility\"
}
Test-FileCatalog @TestFileCatalogParams
```

```Output
Expand All @@ -51,7 +60,12 @@ Valid
### Example 2: Validate a file catalog with detailed output

```powershell
Test-FileCatalog -Detailed -CatalogFilePath \temp\Microsoft.PowerShell.Utility.cat -Path "$PSHOME\Modules\Microsoft.PowerShell.Utility\"
$TestFileCatalogParams = @{
Detailed = $true
CatalogFilePath = "\temp\Microsoft.PowerShell.Utility.cat"
Path = "$PSHOME\Modules\Microsoft.PowerShell.Utility\"
}
Test-FileCatalog @TestFileCatalogParams
```

```Output
Expand All @@ -70,7 +84,7 @@ Signature : System.Management.Automation.Signature

### -CatalogFilePath

A path to a catalog file (.cat) that contains the hashes to be used for validation.
A path to a catalog file (`.cat`) that contains the hashes to be used for validation.

```yaml
Type: System.String
Expand Down Expand Up @@ -167,9 +181,10 @@ Accept wildcard characters: False

### CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction,
-InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and
-WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
-WarningAction, and -WarningVariable. For more information, see
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ Unprotect-CmsMessage [-Path] <string> [[-To] <CmsMessageRecipient[]>] [-IncludeC
### ByLiteralPath

```
Unprotect-CmsMessage [-LiteralPath] <string> [[-To] <CmsMessageRecipient[]>] [-IncludeContext]
[<CommonParameters>]
Unprotect-CmsMessage [-LiteralPath] <string> [[-To] <CmsMessageRecipient[]>]
[-IncludeContext] [<CommonParameters>]
```

## DESCRIPTION
Expand Down
2 changes: 1 addition & 1 deletion reference/5.1/Microsoft.PowerShell.Utility/Add-Type.md
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ Otherwise, the command fails.
The **CodeDomProvider** class for some languages, such as IronPython and J#, doesn't generate
output. As a result, types written in these languages can't be used with `Add-Type`.

This cmdlet is based on the Microsoft .NET Framework [CodeDomProvider Class](/dotnet/api/system.codedom.compiler.codedomprovider).
This cmdlet is based on the Microsoft .NET Framework [CodeDomProvider Class](xref:System.CodeDom.Compiler.CodeDomProvider).

## RELATED LINKS

Expand Down
12 changes: 7 additions & 5 deletions reference/5.1/Microsoft.PowerShell.Utility/Clear-Variable.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Deletes the value of a variable.
## SYNTAX

```
Clear-Variable [-Name] <String[]> [-Include <String[]>] [-Exclude <String[]>] [-Force] [-PassThru]
[-Scope <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
Clear-Variable [-Name] <String[]> [-Include <String[]>] [-Exclude <String[]>] [-Force]
[-PassThru] [-Scope <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -165,7 +165,8 @@ The acceptable values for this parameter are:
- `Script`

You can also use a number relative to the current scope (0 through the number of scopes, where 0 is
the current scope and 1 is its parent). Local is the default. For more information, see [about_Scopes](../Microsoft.PowerShell.Core/About/about_Scopes.md).
the current scope and 1 is its parent). Local is the default. For more information, see
[about_Scopes](../Microsoft.PowerShell.Core/About/about_Scopes.md).

```yaml
Type: System.String
Expand Down Expand Up @@ -215,7 +216,8 @@ 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](https://go.microsoft.com/fwlink/?LinkID=113216).
-WarningAction, and -WarningVariable. For more information, see
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

Expand All @@ -236,7 +238,7 @@ the cleared variable.

## NOTES

Windows PowerShell includes the following aliases for `Clear-Variable`:
PowerShell includes the following aliases for `Clear-Variable`:

- `clv`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ ConvertFrom-Csv [-InputObject] <psobject[]> [[-Delimiter] <char>] [-Header <stri
### UseCulture

```
ConvertFrom-Csv [-InputObject] <psobject[]> -UseCulture [-Header <string[]>] [<CommonParameters>]
ConvertFrom-Csv [-InputObject] <psobject[]> -UseCulture [-Header <string[]>]
[<CommonParameters>]
```

## DESCRIPTION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ that can be managed in PowerShell.
```powershell
# Ensures that Invoke-WebRequest uses TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$j = Invoke-WebRequest 'https://api.github.com/repos/PowerShell/PowerShell/issues' | ConvertFrom-Json
$j = Invoke-WebRequest 'https://api.github.com/repos/PowerShell/PowerShell/issues' |
ConvertFrom-Json
```

You can also use the `Invoke-RestMethod` cmdlet, which automatically converts JSON content to
Expand Down Expand Up @@ -147,7 +148,7 @@ You can pipe a JSON string to `ConvertFrom-Json`.
## NOTES

The `ConvertFrom-Json` cmdlet is implemented using the
[JavaScriptSerializer class](/dotnet/api/system.web.script.serialization.javascriptserializer).
[JavaScriptSerializer class](xref:System.Web.Script.Serialization.JavaScriptSerializer).

The **PSObject** type maintains the order of the properties as presented in the JSON string. While
the key-value pairs are added to the **Hashtable** in the order presented in the JSON string,
Expand Down
Loading