Details
Description
PowerShell DSC uses the machine execution policy when calling PowerShell scripts. If the default "Restricted" policy is set (use Get-ExecutionPolicy to determine), it means it will error. It completely ignores what you start up PowerShell with.
Consider the following manifest:
dsc_xgroup {'testgroup':
|
dsc_ensure => 'present',
|
dsc_groupname => 'TestUsers',
|
dsc_members => 'vagrant',
|
}
|
and Get-ExecutionPolicy returns "Restricted"
Running it in dsc, which calls PowerShell.exe with -ExecutionPolicy Bypass (I also tried setting it to Unrestricted, but no dice) produces the following:
Error: /Stage[main]/Main/Dsc_xgroup[testgroup]: Could not evaluate: Importing module MSFT_xGroupResource failed with
|
error - File C:\Program
|
Files\WindowsPowerShell\Modules\PuppetVendoredModules\xPSDesiredStateConfiguration\DscResources\MSFT_xGroupR
|
esource\MSFT_xGroupResource.psm1 cannot be loaded because running scripts is disabled on this system. For more
|
information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
|
Attachments
Issue Links
- links to