Run scripts as admin if directed via script contents

net8.0
Pat Hartl 2023-11-17 21:39:01 -06:00
parent f19ef09ff8
commit a47b77cc5c
1 changed files with 3 additions and 0 deletions

View File

@ -123,6 +123,9 @@ namespace LANCommander.SDK.PowerShell
var wow64Value = IntPtr.Zero;
if (Contents.StartsWith("# Requires Admin"))
RunAsAdmin();
foreach (var module in Modules)
{
scriptBuilder.AppendLine($"Import-Module \"{module}\"");