OpenAdapt
OpenAdapt copied to clipboard
[Bug]: The 'Set-ExecutionPolicy' command was found in the module 'Microsoft.PowerShell.Security', but the module could not be loaded.
Describe the bug
from @limaconnect on Discord:
Set-ExecutionPolicy : The 'Set-ExecutionPolicy' command was found in the module 'Microsoft.PowerShell.Security', but
the module could not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Security'.
At line:341 char:1
+ Set-ExecutionPolicy RemoteSigned -Scope Process -Force
+ ~~~
+ CategoryInfo : ObjectNotFound: (Set-ExecutionPolicy:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Note:
Please run
Import-Module Microsoft.PowerShell.Security
Possibly related:
- https://github.com/OpenAdaptAI/OpenAdapt/issues/581
- https://github.com/OpenAdaptAI/OpenAdapt/issues/626
To Reproduce
On Windows 11 Pro:
- Download and install OpenAdapt from website
- Try running OpenAdapt via Installed Apps
- Observe Security Warning:
- ...?
User subsequently attempted to install via install command on website:
Start-Process powershell -Verb RunAs -ArgumentList '-NoExit', '-ExecutionPolicy', 'Bypass', '-Command', "iwr -UseBasicParsing -Uri 'https://raw.githubusercontent.com/OpenAdaptAI/OpenAdapt/main/install/install_openadapt.ps1' | Invoke-Expression"
Via ChatGPT (https://chatgpt.com/share/671a7949-2db8-8002-8d60-9bdf7ad52bbc):
The error indicates that PowerShell is unable to find or load the Microsoft.PowerShell.Security module, which contains the Set-ExecutionPolicy command. This might occur if the module is missing, corrupted, or not properly installed.
To address this, try the following steps:
-
Ensure the module is available: Run the following command to check if
Microsoft.PowerShell.Securityis installed:Get-Module -ListAvailable Microsoft.PowerShell.Security -
Manually import the module: If the module is listed, manually import it:
Import-Module Microsoft.PowerShell.Security -
Reinstall or repair PowerShell modules: If the module is missing or fails to import, reinstall or repair the PowerShell installation:
- Open a PowerShell session as Administrator.
- Reinstall the module:
Install-Module -Name PowerShellGet -Force -AllowClobber Update-Module -Name Microsoft.PowerShell.Security - If issues persist, consider repairing PowerShell from Windows Features.
-
Use an alternative to
Set-ExecutionPolicy: If changing the execution policy is essential and the above steps fail, try setting it manually via the registry:- Open
regeditand navigate to:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell - Adjust
ExecutionPolicytoRemoteSigned.
- Open
-
Administrator Permissions: Ensure that PowerShell is run as an Administrator, as changes to the execution policy might require elevated privileges.
If the problem persists, further investigation of the system's PowerShell environment might be needed.
@0dm:
this could be because onedrive is being accessed instead of local documents