Windows 7 64-bit environment.
I have the Microsoft.PowerShell_profile.ps1 file ready for Import-Module.
Set-ExecutionPolicy RemoteSigned
When you run with administrator privileges and start PowerShell from the Start menu, the module is loaded.
Then create a setting.ps1 file using this module.
CreateObject("WScript.Shell").Run "powershell.exe~\setting.ps1", 1
Create a VBS file to kick the ps1 file
Verified that it works properly when running from Explorer.
Another app has the ability to run external files, so I called this VBS.
Unable to load file ~\My Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 because script execution is disabled on the system.For more information, enter get-help about_signing for help.
Location line: 1 character: 2
+ .<<<'~\My Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'
+ CategoryInfo: NotSpecified: ( : ) [ ], PSSsecurityException
+ Fully QualifiedErrorId: RuntimeException
The error will appear.
Attempted to boot to PowerShell alone and checked Get-ExecutionPolicy.
Restricted.
Is the execution policy managed by each user?
However, another application above started with the same user.
How do I ensure that a common policy is applied when I start PowerShell on the entire machine or on the affected user?
powershell
I was told on Twitter.
32-bit and 64-bit settings are different.
Get-ExecutionPolicy-List
You can see the list of policies in
PowerShell and PowerShell (x86) launched from the start menu,
The x86 did not reflect the configuration.
Even on the x86 side
Set-ExecutionPolicy RemoteSigned
Resolved by running
It seems that this is what happened because the 32-bit version of another app was asked.
© 2024 OneMinuteCode. All rights reserved.