I have to run this command remotely:
set-ItemProperty-Path 'hklm: \ \ SOFTWARE \ Microsoft \ PowerShell \ 1 \ ShellIds \ Microsoft.PowerShell \'-Name "ExecutionPolicy"-Value "RemoteSigned"
It only works if I manually start Powershell in "Run as Administrator"
you can run it automatically?
I used this command:
$args = @'
powershell.exe -Command {
set-ItemProperty -Path 'hklm:\\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell\' -Name "ExecutionPolicy" -Value "RemoteSigned"
}
'@
Start-Process -ArgumentList $args -Verb RunAs PowerShell
I get the following error: "The execution of scripts is disabled on your system"
I would just bypass this restriction ….