|
| 1 | +--- |
| 2 | +title: "ExchangePS Error: The WinRM Shell Client Cannot Process the Request" |
| 3 | +sidebar_label: "ExchangePS Error: The WinRM Shell Client Cannot Process the Request" |
| 4 | +description: "Learn how to resolve the 'WinRM Shell client cannot process the request' error in ExchangePS data collector jobs by updating the PackageManagement and ExchangeOnlineManagement PowerShell modules." |
| 5 | +keywords: [ExchangePS, WinRM, New-ExoPSSession, PowerShell, ExchangeOnlineManagement, PackageManagement, StealthAUDIT, data collector, Office 365, remote session] |
| 6 | +products: [enterprise-auditor, access-analyzer] |
| 7 | +knowledge_article_id: ka0Qk000000GS0LIAW |
| 8 | +--- |
| 9 | + |
| 10 | +## Related Queries |
| 11 | + |
| 12 | +- "ExchangePS shell handle is not valid." |
| 13 | +- "New-ExoPSSession fails with WinRM Shell client error." |
| 14 | +- "ExchangeOnlineManagement 2.0.5 error with StealthAUDIT job." |
| 15 | +- "Stealthbits Exchange data collector fails to connect." |
| 16 | + |
| 17 | +## Symptom |
| 18 | + |
| 19 | +Jobs that use the ExchangePS data collector fail with the following error: |
| 20 | + |
| 21 | +```text |
| 22 | +PowerShell error: System.Exception: New-ExoPSSession : Processing data from remote server outlook.office365.com failed with the following error message: The WinRM Shell client cannot process the request. The shell handle passed to the WSMan Shell function is not valid. The shell handle is valid only when WSManCreateShell function completes successfully. |
| 23 | +``` |
| 24 | + |
| 25 | +## Cause |
| 26 | + |
| 27 | +This issue occurs when one or both of the following PowerShell modules are outdated or incompatible: |
| 28 | + |
| 29 | +- `PackageManagement` module version is earlier than `1.0.0.1` |
| 30 | +- `ExchangeOnlineManagement` module version is `2.0.5` or earlier |
| 31 | + |
| 32 | +These versions are known to cause instability with remote sessions using `New-ExoPSSession`. |
| 33 | + |
| 34 | +## Resolution |
| 35 | + |
| 36 | +### Step 1: Verify Installed Module Versions |
| 37 | + |
| 38 | +Open a PowerShell session and run: |
| 39 | + |
| 40 | +```powershell |
| 41 | +Get-Module -ListAvailable PackageManagement |
| 42 | +Get-Module -ListAvailable ExchangeOnlineManagement |
| 43 | +``` |
| 44 | + |
| 45 | +### Step 2: Update Modules Using PowerShell (Preferred Method) |
| 46 | + |
| 47 | +- Update `PackageManagement` module: |
| 48 | + ```powershell |
| 49 | + Install-Module PackageManagement -Force -Scope AllUsers |
| 50 | + ``` |
| 51 | + |
| 52 | +- Update `ExchangeOnlineManagement` module: |
| 53 | + ```powershell |
| 54 | + Install-Module ExchangeOnlineManagement -Force -Scope AllUsers |
| 55 | + ``` |
| 56 | + |
| 57 | +> **IMPORTANT:** |
| 58 | +> Close and reopen all PowerShell sessions after updating modules. |
| 59 | +
|
| 60 | +### Step 3: Manual Update (If Unable to Install via PowerShell) |
| 61 | + |
| 62 | +If the environment prevents direct downloads from PowerShell, update the modules manually. |
| 63 | + |
| 64 | +#### Download the `.nupkg` Files |
| 65 | + |
| 66 | +1. Visit the following URLs: |
| 67 | + - [PackageManagement 1.4.8.1](https://www.powershellgallery.com/packages/PackageManagement/1.4.8.1) |
| 68 | + - [ExchangeOnlineManagement 3.9.1-Preview1](https://www.powershellgallery.com/packages/ExchangeOnlineManagement/3.9.1-Preview1) |
| 69 | + |
| 70 | +2. Download the `.nupkg` file for each required version. |
| 71 | + |
| 72 | +#### Convert `.nupkg` to ZIP and Extract |
| 73 | + |
| 74 | +1. Rename the downloaded `.nupkg` file to `.zip` |
| 75 | + Example: `PackageManagement.1.4.8.1.zip` |
| 76 | +2. Unblock the ZIP file using one of the following methods: |
| 77 | + - In File Explorer, right-click **Properties** > **Unblock**. |
| 78 | + - Or run: |
| 79 | + ```powershell |
| 80 | + Unblock-File .\PackageManagement.1.4.8.1.zip |
| 81 | + ``` |
| 82 | +3. Extract the contents of each ZIP file. |
| 83 | +
|
| 84 | +#### Rename the Extracted Folder |
| 85 | +
|
| 86 | +- Rename `PackageManagement.1.4.8.1` to `1.4.8.1` |
| 87 | +- Rename `ExchangeOnlineManagement.3.4.0` to `3.4.0` (or the version you downloaded) |
| 88 | +
|
| 89 | +#### Move to PowerShell Modules Directory |
| 90 | +
|
| 91 | +Place the renamed folders in the correct directories: |
| 92 | +
|
| 93 | +- For PackageManagement: |
| 94 | + `C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.4.8.1` |
| 95 | +- For ExchangeOnlineManagement: |
| 96 | + `C:\Program Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\3.4.0` |
| 97 | +
|
| 98 | +### Step 4: Confirm Module Versions |
| 99 | +
|
| 100 | +Re-run the version checks: |
| 101 | +
|
| 102 | +```powershell |
| 103 | +Get-Module -ListAvailable PackageManagement |
| 104 | +Get-Module -ListAvailable ExchangeOnlineManagement |
| 105 | +``` |
| 106 | + |
| 107 | +Ensure that: |
| 108 | + |
| 109 | +- `PackageManagement` is version **1.4.8.1** or newer |
| 110 | +- `ExchangeOnlineManagement` is version **2.0.6** or newer |
| 111 | + |
| 112 | +> **IMPORTANT:** |
| 113 | +> Rerun jobs that use the ExchangePS data collector to confirm that the error message no longer appears. |
| 114 | +
|
| 115 | +--- |
0 commit comments