rubrikinc / polaris-o365-powershell

PowerShell commands for managing Polaris M365 protection
MIT License
7 stars 13 forks source link

Import failure - requires privileged session error #27

Open wsmelton opened 2 years ago

wsmelton commented 2 years ago

Expected Behavior Import and use the module under a non-privileged PowerShell session

Current Behavior Requires elevated session because one command has #requires statement

Failure Information

Write-Error: Failed to import private function C:\Modules\RubrikPolaris\M365\New-EnterpriseApplication.ps1: The script 'New-EnterpriseApplication.ps1' cannot be run because it contains a "#requires" statement for running as Administrator. The current PowerShell session is not running as Administrator. Start PowerShell by using the Run as Administrator option, and then try running the script again.

Steps to Reproduce

Open PowerShell 7 session, run import command:

 > ipmo C:\Modules\RubrikPolaris\
Write-Error: Failed to import private function C:\Modules\RubrikPolaris\M365\New-EnterpriseApplication.ps1: The script 'New-EnterpriseApplication.ps1' cannot be run because it contains a "#requires" statement for running as Administrator. The current PowerShell session is not running as Administrator. Start PowerShell by using the Run as Administrator option, and then try running the script again.

Context

https://github.com/rubrikinc/polaris-o365-powershell/blob/762189bb2e65eebc706500948a3710686bc67e90/RubrikPolaris/M365/New-EnterpriseApplication.ps1#L1