# Windows

**Installation on Windows (Powershell)**

{% hint style="info" %}
Tested on Windows 10/11 (64-bit) with PowerShell 7.x or higher. Requires Administrator rights for system-wide installs and changes to execution policy.
{% endhint %}

#### 1. Prerequisites

* **Windows 10/11, 64-bit** (Requires Administrator rights for system-wide installs and changes to execution policy)
* **PowerShell 7+** (install/update via [GitHub releases](https://github.com/PowerShell/PowerShell/releases))

***

#### 2. Install Node.js (v22+) & npm

To install using the official installer:

1. Download the **Windows x64 MSI** for **Node.js v22.x.x (LTS)**\
   <https://nodejs.org/en/download/>
2. Right-click → **Run as Administrator**.
3. **Accept defaults** on each screen (ensures `node` & `npm` are added to your PATH).

After installing, you can verify the version by running the following command in your powershell:

```powershell
node --version   # should be v22.x.x or higher
npm --version
```

***

#### 3. (Optional) nvm-for-Windows

If you need multiple Node versions side by side:

1. Download **nvm-setup.zip** from\
   <https://github.com/coreybutler/nvm-windows/releases>
2. Unzip & run `nvm-setup.exe` as Administrator.
3. Open a **new** PowerShell session, then:

   ```powershell
   nvm install 22.24.0
   nvm use 22.24.0
   node --version   # now v22.24.0
   ```

***

#### 4. Handling PowerShell Execution Policy & Blocked Remote Files

> **Issue**: scripts cannot be loaded because running scripts is disabled on this system

* **Allow local & signed scripts only:**

  ```powershell
  Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
  ```

> **Issue**: Powershell flagging `.ps1` or `.msi` as “blocked",

* **Unblock remote files:**

  ```powershell
  Get-ChildItem .\path\to\downloads\* -Recurse |
    Unblock-File
  ```

***

#### 5. Install the P0 CLI

```powershell
npm install -g @p0security/cli
```

If you see permissions errors, run powershell as an administrator and run the command again.

Alternatively, to use a per-user install, run the following command:

```powershell
npm install --location=global @p0security/cli
```

You can verify P0 installation in your system by running the following command:

```powershell
p0 --version
p0 help
```

***

#### 6. AWS CLI & Session Manager Plugin (for `p0 aws` & `p0 ssh`)

**AWS CLI v2**

To install AWS CLI v2:

* Download the MSI: <https://awscli.amazonaws.com/AWSCLIV2.msi>
* Run installer as administrator.

You can verify the installation by running the following command:

````
 ```powershell
 aws --version    # e.g. aws-cli/2.x.x Python/3.x Windows/10 exe/AMD64
 ```
````

**Session Manager Plugin**

* Download from: <https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html#install-plugin-windows>
* Run the MSI.

You can verify the installation by running the following command:

````
 ```powershell
 session-manager-plugin --version
 ```
````

***

#### 7. Handling Proxy & Corporate Firewall Issues

> **Issue**: `npm install` times out, or `p0 login` can’t reach your org.

* **Set npm proxy:**

  ```powershell
  npm config set proxy http://proxy.company.com:8080
  npm config set https-proxy http://proxy.company.com:8080
  ```
* **Set Environment vars**:

  ```powershell
  [Environment]::SetEnvironmentVariable('HTTP_PROXY','http://proxy.company.com:8080','User')
  [Environment]::SetEnvironmentVariable('HTTPS_PROXY','http://proxy.company.com:8080','User')
  ```

***

#### 8. Troubleshooting & Tips

| Symptom                                             | Cause / Fix                                                                                 |
| --------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| `p0: command not found`                             | - Restart PowerShell (to pick up new PATH).- Check `%USERPROFILE%\AppData\Roaming\npm`.     |
| `Error: EACCES permissions denied`                  | - Run PowerShell as Administrator.- Try `--location=global` for npm.                        |
| `Set-ExecutionPolicy` still blocked on corporate PC | - Check with IT: some shops lock policy via Group Policy (GPO).                             |
| `session-manager-plugin` not recognized             | - Ensure AWS CLI folder is on PATH.- Reopen PowerShell.                                     |
| `p0 login` never opens browser                      | - Set `$env:AZURE_AUTH_METHOD = 'browser'` for certain orgs that disable embedded webviews. |

***

**You’re all set!** Next up: [Configuration](https://chatgpt.com/c/686e84db-e008-8011-962e-8cab37b9f8a6#configuration) → `p0 login <YOUR_ORG_ID>` and start requesting access.
