-
Notifications
You must be signed in to change notification settings - Fork 82
PowerShellExecutionPolicy
dscbot edited this page Dec 11, 2022
·
7 revisions
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
ExecutionPolicyScope | Key | String | Defines the scope for the preference of the Windows PowerShell execution policy. |
CurrentUser , LocalMachine , MachinePolicy , Process , UserPolicy
|
ExecutionPolicy | Required | String | Changes the preference for the Windows PowerShell execution policy. |
Bypass , Restricted , AllSigned , RemoteSigned , Unrestricted
|
This resource allows configuration of the PowerShell execution policy for different execution scopes.
This example shows how to configure powershell's execution policy for the specified execution policy scope.
Configuration PowerShellExecutionPolicy_SetPolicy_Config
{
Import-DscResource -ModuleName ComputerManagementDsc
Node localhost
{
PowerShellExecutionPolicy ExecutionPolicy
{
ExecutionPolicyScope = 'CurrentUser'
ExecutionPolicy = 'RemoteSigned'
} # End of PowershellExecutionPolicy Resource
} # End of Node
} # End of Configuration
This example shows how to configure multiple powershell's execution policy for a specified execution policy scope.
Configuration PowerShellExecutionPolicy_SetPolicyForMultipleScopes_Config
{
Import-DscResource -ModuleName ComputerManagementDsc
Node localhost
{
PowerShellExecutionPolicy ExecutionPolicyCurrentUser
{
ExecutionPolicyScope = 'CurrentUser'
ExecutionPolicy = 'RemoteSigned'
} # End of ExecutionPolicyCurrentUser Resource
PowerShellExecutionPolicy ExecutionPolicyLocalMachine
{
ExecutionPolicyScope = 'LocalMachine'
ExecutionPolicy = 'RemoteSigned'
} # End of ExecutionPolicyLocalMachine Resource
} # End of Node
} # End of Configuration
- Computer
- IEEnhancedSecurityConfiguration
- OfflineDomainJoin
- PendingReboot
- PowerPlan
- PowerShellExecutionPolicy
- PSResourceRepository
- RemoteDesktopAdmin
- ScheduledTask
- SmbServerConfiguration
- SmbShare
- SystemLocale
- SystemProtection
- SystemRestorePoint
- TimeZone
- UserAccountControl
- VirtualMemory
- WindowsCapability
- WindowsEventLog