Files

23 lines
857 B
C#
Raw Permalink Normal View History

using System.Diagnostics;
using System.Text;
namespace UCVL.VPNPlus;
// Fixed executable and working directory: never inherit NSIS's temporary payload.
internal static class SystemPowerShell
{
internal static ProcessStartInfo CreateStartInfo(string script) => new()
{
FileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System),
"WindowsPowerShell", "v1.0", "powershell.exe"),
WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.System),
Arguments = "-NoProfile -NonInteractive -EncodedCommand "
+ Convert.ToBase64String(Encoding.Unicode.GetBytes(script)),
UseShellExecute = false,
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden,
RedirectStandardOutput = true,
RedirectStandardError = true,
};
}