When importing a PowerShell module that
#Requires -RunAsAdministrator
from my PowerShell profile, it throws an ScriptRequiresElevation,Microsoft.PowerShell.Commands.ImportModuleCommand
error.
How can I either
- a) add a condition/parameter that the module is only imported when running an elevated shell or
- b) move the import to a profile that gets only loaded when running an elevated shell?