Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import failure - requires privileged session error #27

Open
wsmelton opened this issue Jun 8, 2022 · 0 comments
Open

Import failure - requires privileged session error #27

wsmelton opened this issue Jun 8, 2022 · 0 comments
Labels

Comments

@wsmelton
Copy link

wsmelton commented Jun 8, 2022

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

#Requires -Version 6.0 -RunAsAdministrator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant