lipkau / PsIni

Work with INI files in PowerShell using hashtables
http://lipkau.github.io/PsIni
MIT License
151 stars 50 forks source link

Importing the module #74

Closed ajtruckle closed 1 year ago

ajtruckle commented 1 year ago

I am getting error:

Import-Module : File C:\Program Files\WindowsPowerShell\Modules\PsIni\3.1.3\PsIni.psm1 cannot be loaded because running scripts is disabled on
this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ Import-Module PsIni
+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [Import-Module], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ImportModuleCommand
No

How do I set an execution policy for the session to allow for psini?

CanMonster commented 1 year ago

Hello ajtruckle, as per the error go to 'https:/go.microsoft.com/fwlink/?LinkID=135170' and review that document which tells you what to do. In short, assuming your machine is not under a corporate lock down policy set, you need to:

  1. Open a PowerShell console
  2. Type "set-executionpolicy -executionpolicy remotesigned" or "set-executionpolicy -executionpolicy unrestricted"
  3. Try the import again.

This is not an issue with the module but rather your machine.