private static string GetExistingGPOPath(Guid gpoGuid, bool computer) { Domain domain = Domain.GetCurrentDomain(); using (GroupPolicyObject existGPO = new GroupPolicyObject()) { try { existGPO.OpenDSGpo(domain, gpoGuid, false, false); } catch (ActiveDirectoryObjectNotFoundException ex) { //Tracer.WriteInformation(ex.ToString()); return(String.Empty); } if (computer) { return(existGPO.GetFileSystemPath(GpoSection.Computer)); } else { return(existGPO.GetFileSystemPath(GpoSection.User)); } } }
private static string GetExistingGPOPath(Guid gpoGuid, bool computer) { Domain domain = Domain.GetCurrentDomain(); using (GroupPolicyObject existGPO = new GroupPolicyObject()) { try { existGPO.OpenDSGpo(domain, gpoGuid, false, false); } catch (ActiveDirectoryObjectNotFoundException ex) { //Tracer.WriteInformation(ex.ToString()); return String.Empty; } if (computer) { return existGPO.GetFileSystemPath(GpoSection.Computer); } else { return existGPO.GetFileSystemPath(GpoSection.User); } } }