[WebMethod(Description = "Set server Event Log sources.")] public string SetEventLogSources(string Username, string Password, string Domain) { //This will keep track of the impersonation token const int LOGON_TYPE_INTERACTIVE = 2; const int LOGON_TYPE_PROVIDER_DEFAULT = 0; string logName = "Application"; IntPtr userToken = IntPtr.Zero; if (LogonUser(Username, Domain, Password, LOGON_TYPE_INTERACTIVE, LOGON_TYPE_PROVIDER_DEFAULT, ref userToken)) { //Initialize user token WindowsIdentity oIdentity = new WindowsIdentity(userToken); WindowsImpersonationContext oContext = oIdentity.Impersonate(); foreach (string source in Enum.GetNames(typeof(Events.EventSources))) { if (EventLog.SourceExists(source) == false) EventLog.CreateEventSource(source, logName); } //Undo impersonation oContext.Undo(); return "Event source registration successful!"; } else { return "Unable to process user credentials for event source registration."; } }~~Bonnie