Open Group Policy Management Console __top__ -

if (!System.IO.File.Exists(gpmcPath)) throw new Exception("GPMC not installed. Install RSAT.");

# Launch GPMC if ($DomainFQDN) Start-Process $gpmcPath -ArgumentList "/domain=$DomainFQDN" elseif ($GPOId) Start-Process $gpmcPath -ArgumentList "/gpo:$GPOId" else Start-Process $gpmcPath

if (!string.IsNullOrEmpty(domain)) psi.Arguments = $"/domain=domain"; open group policy management console

var psi = new ProcessStartInfo

Process.Start(psi);

try Process.Start("gpmc.msc"); catch (Exception ex) MessageBox.Show($"Failed to open GPMC: ex.Message\nEnsure RSAT is installed.");

FileName = gpmcPath, UseShellExecute = true, Verb = IsAdmin() ? "" : "runas" // Request admin if not elevated ; var psi = new ProcessStartInfo Process.Start(psi)

Open-GPMC -DomainFQDN "contoso.com" B. C# (for compiled tools) using System.Diagnostics; using System.Security.Principal; public static void OpenGroupPolicyManagementConsole(string domain = null)

Nach oben