# Solution Error UnauthorizedAccess Powershell

Menurutku ini karna policy nya belum tersetting

<figure><img src="https://3397141630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVUQUm1GVUT3pDnRHmDRU%2Fuploads%2Fz7HYSEuPiJTaPQOSR6r5%2Fimage.png?alt=media&#x26;token=767d7d66-576b-4725-910f-453e40afe04c" alt=""><figcaption></figcaption></figure>

1. **Open PowerShell as an Administrator**: Right-click the PowerShell icon and choose "Run as Administrator" to open an elevated PowerShell session.
2. **Check the Current Execution Policy**: You can check the current execution policy by running the following command:

   ```powershell
   Get-ExecutionPolicy
   ```
3. **Change Execution Policy**: To change the execution policy to a less restrictive setting, you can use the `Set-ExecutionPolicy` cmdlet. For example, to set the execution policy to "RemoteSigned," which allows running scripts that are locally created, but requires a digital signature for remote scripts, run:

   ```powershell
   Set-ExecutionPolicy RemoteSigned
   ```

   You may need to confirm the change by typing "Y" for Yes.
4. **Run Your Script**: After changing the execution policy, you should be able to run your PowerShell script without encountering the error.

Please be aware that changing the execution policy to a less restrictive setting can potentially expose your system to security risks, especially if you run scripts from untrusted sources. Make sure you understand the implications and only run scripts from trusted sources.

Once you've completed your script-related tasks, you can set the execution policy back to a more secure level using:

```powershell
Set-ExecutionPolicy Restricted
```

Or you can set it to the default value:

```powershell
Set-ExecutionPolicy Default
```

Remember to exercise caution and only change the execution policy when you trust the source of the scripts you're running.<br>
