Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过Puppet 3.0设置Powershell执行策略_Powershell_Puppet - Fatal编程技术网

通过Puppet 3.0设置Powershell执行策略

通过Puppet 3.0设置Powershell执行策略,powershell,puppet,Powershell,Puppet,我正在尝试使用Puppet 3.0为powershell 2.0设置执行策略,方法如下 exec { 'rolesfeatures1': command => 'C:\Windows\System32\cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe Invoke-Command {Set-ExecutionPolicy RemoteSigned}', provider => windows, l

我正在尝试使用Puppet 3.0为powershell 2.0设置执行策略,方法如下

exec { 'rolesfeatures1':
command => 'C:\Windows\System32\cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe Invoke-Command {Set-ExecutionPolicy RemoteSigned}',
provider => windows,
logoutput => true,
}


我不熟悉木偶,但试试这个:

command => 'C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe -Command {Set-ExecutionPolicy RemoteSigned}'


我不熟悉木偶,但试试这个:

command => 'C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe -Command {Set-ExecutionPolicy RemoteSigned}'


感谢您的回复,我想用sysnative代替System32解决了这个问题

exec {'executionpolicy':
        path => 'C:\Windows\sysnative\WindowsPowerShell\v1.0', #Puppet redirects to SysWOW64 by default
        command => 'Powershell.exe -Command "& {Set-ExecutionPolicy Unrestricted}"',
        logoutput => true
        }

感谢您的回复,我想用sysnative代替System32解决了这个问题

exec {'executionpolicy':
        path => 'C:\Windows\sysnative\WindowsPowerShell\v1.0', #Puppet redirects to SysWOW64 by default
        command => 'Powershell.exe -Command "& {Set-ExecutionPolicy Unrestricted}"',
        logoutput => true
        }

我认为它实际上不适用于我exec{'rolesfeatures1':command=>C:\Windows\System32\windowswowershell\v1.0\Powershell.exe-command“&{Set ExecutionPolicy RemoteSigned-Force}”,provider=>Windows,logoutput=>true,}我认为它实际上不适用于我exec{'RoleFeatures1':command=>C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe-command“&{Set-ExecutionPolicy RemoteSigned-Force}”,provider=>Windows,logoutput=>true,}