I’m new to scripting in general and have a question. I need to call a function in an in-house module that only needs to run elevated the first time. It creates an EventLogSource. Where do I need to put my elevation script block? In the script calling the function or the module itself? Here’s an example of what needs to run elevated. The function that is called runs this snippet is in a module that was built in-house.
try {
if (-not (Test-Path -Path $logSourcePath)) {
if not already registered as an event log source
New-EventLog -LogName Application -Source $LogSourceName