Friday, July 5, 2019

command line - Change Powershell Execution Policy silently from Batch script

I would like some help on setting a registry value for powershell. The path is



[hkey_local_machine\system32\windows\microsoft\powershell\1\shellids\microsoft.powershell]
"Path"="c:\windows\system32\windowspowershell\v1.0\powershell.exe"
"ExecutionPolicy"="unrestricted"



Since I have imported this from a known good machine,when I run the .reg file it works fine. But I would like this in a batch file.


When I manually call the command prompt, drop in the path e.g c:\powershell.reg, this imports the values and overwrites the the registry settings as required.
However if l call do the same thing in a batch file, the values are not changed in the registry
Using the reg add command in a batch file the values does not work.

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...