private void btnSummaryListAsText_Click(object sender, EventArgs e) { ShowTextDocument oForm = new ShowTextDocument(); oForm.txtEntry.Text = GetTimezoneList(); oForm.Text = "Timezone list as text"; oForm.Show(); }
private void serverTimeZoneToolStripMenuItem_Click(object sender, EventArgs e) { DateTime oDateTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Unspecified); StringBuilder oSB = new StringBuilder(); oSB.AppendLine("Server TimeZoneInfo:"); oSB.AppendLine(TimeHelper.GetValuesFromTimeZoneInfo(CurrentService.TimeZone)); oSB.AppendLine(""); ShowTextDocument oForm = new ShowTextDocument(); oForm.txtEntry.WordWrap = false; oForm.Text = "Server TimeZone"; oForm.txtEntry.Text = oSB.ToString(); oForm.Show(); }
private void DisplayFolderInfo() { if (lvItems.SelectedItems.Count > 0) { StringBuilder oSB = new StringBuilder(); oSB.AppendFormat("DisplayName: {0}\r\n", lvItems.SelectedItems[0].SubItems[1].Text); oSB.AppendFormat("FolderClass: {0}\r\n", lvItems.SelectedItems[0].SubItems[2].Text); oSB.AppendFormat("Folder Path: {0}\r\n", lvItems.SelectedItems[0].SubItems[6].Text); oSB.AppendFormat("UniqueId: {0}\r\n", lvItems.SelectedItems[0].SubItems[7].Text); ShowTextDocument oForm = new ShowTextDocument(); oForm.txtEntry.WordWrap = false; oForm.Text = "Folder"; oForm.txtEntry.Text = oSB.ToString(); oForm.Show(); } }
private void mnuWindowsUserInformation_Click(object sender, EventArgs e) { string sInfo = string.Empty; StringBuilder oSB = new StringBuilder(); oSB.AppendFormat("From UserPrincipal: \r\n"); oSB.AppendFormat(" DisplayName: {0}\r\n", UserPrincipal.Current.DisplayName); oSB.AppendFormat(" GivenName: {0}\r\n", UserPrincipal.Current.GivenName); oSB.AppendFormat(" DistinguishedName: {0}\r\n", UserPrincipal.Current.DistinguishedName); oSB.AppendFormat(" Name: {0}\r\n", UserPrincipal.Current.Name); if (UserPrincipal.Current.MiddleName != null) { oSB.AppendFormat(" MiddleName: {0}\r\n", UserPrincipal.Current.MiddleName); } oSB.AppendFormat("\r\n"); if (UserPrincipal.Current.EmailAddress != null) { oSB.AppendFormat(" EmailAddress: {0}\r\n", UserPrincipal.Current.EmailAddress); } if (UserPrincipal.Current.SamAccountName != null) { oSB.AppendFormat(" SamAccountName: {0}\r\n", UserPrincipal.Current.SamAccountName); } if (UserPrincipal.Current.Sid != null) { oSB.AppendFormat(" Sid: {0}\r\n", UserPrincipal.Current.Sid.Value); } if (UserPrincipal.Current.UserPrincipalName != null) { oSB.AppendFormat(" UserPrincipalName: {0}\r\n", UserPrincipal.Current.UserPrincipalName); } if (UserPrincipal.Current.Surname != null) { oSB.AppendFormat(" Surname: {0}\r\n", UserPrincipal.Current.Surname); } if (UserPrincipal.Current.VoiceTelephoneNumber != null) { oSB.AppendFormat(" VoiceTelephoneNumber: {0}\r\n", UserPrincipal.Current.VoiceTelephoneNumber); } if (UserPrincipal.Current.HomeDirectory != null) { oSB.AppendFormat(" HomeDirectory: {0}\r\n", UserPrincipal.Current.HomeDirectory); } if (UserPrincipal.Current.Guid != null) { oSB.AppendFormat(" Guid: {0}\r\n", UserPrincipal.Current.Guid.ToString()); } if (UserPrincipal.Current.Description != null) { oSB.AppendFormat(" Description: {0}\r\n", UserPrincipal.Current.Description.ToString()); } oSB.AppendFormat("\r\n"); oSB.AppendFormat(" PasswordNeverExpires: {0}\r\n", UserPrincipal.Current.PasswordNeverExpires.ToString()); oSB.AppendFormat(" PasswordNotRequired: {0}\r\n", UserPrincipal.Current.PasswordNotRequired.ToString()); oSB.AppendFormat(" UserCannotChangePassword: {0}\r\n", UserPrincipal.Current.UserCannotChangePassword.ToString()); oSB.AppendFormat(" SmartcardLogonRequired: {0}\r\n", UserPrincipal.Current.SmartcardLogonRequired.ToString()); oSB.AppendFormat("\r\n"); if (UserPrincipal.Current.AccountExpirationDate.HasValue) { oSB.AppendFormat(" AccountExpirationDate: {0}\r\n", UserPrincipal.Current.AccountExpirationDate.ToString()); } if (UserPrincipal.Current.AccountLockoutTime.HasValue) { oSB.AppendFormat(" AccountLockoutTime: {0}\r\n", UserPrincipal.Current.AccountLockoutTime.ToString()); } //string sUserName = UserPrincipal.Current.SamAccountName; //DirectorySearcher oDirectorySearcher = new DirectorySearcher(); //oDirectorySearcher.Filter = String.Format("(SAMAccountName={0})", sUserName); //oDirectorySearcher.PropertiesToLoad.Add("cn"); //oDirectorySearcher.PropertiesToLoad.Add("samaccountname"); //oDirectorySearcher.PropertiesToLoad.Add("givenname"); //oDirectorySearcher.PropertiesToLoad.Add("displayname"); //oDirectorySearcher.PropertiesToLoad.Add("mail"); //oDirectorySearcher.PropertiesToLoad.Add("userPrincipalName"); //oDirectorySearcher.PropertiesToLoad.Add("distinguishedName"); //SearchResult oSearchResult = oDirectorySearcher.FindOne(); //oSB.AppendFormat("From AD Search on SAMAccountName: \r\n"); //if (oSearchResult!= null) //{ // oSearchResult.Properties["displayname"][0].ToString(); //} //else //{ // oSB.AppendFormat("AD Search on SAMAccountName failed to return results. \r\n"); //} // Machine Information: try { oSB.AppendFormat("\r\n"); string sHostMachineName = Dns.GetHostName(); IPHostEntry hostInfo = Dns.GetHostEntry(sHostMachineName); IPAddress[] address = hostInfo.AddressList; String[] alias = hostInfo.Aliases; oSB.AppendFormat("Machine Name: {0}\r\n", sHostMachineName); oSB.AppendFormat("Aliases :\r\n"); for (int index = 0; index < alias.Length; index++) { oSB.AppendFormat(" {0}\r\n", alias[index]); } oSB.AppendFormat("IP address list : \r\n"); for (int index = 0; index < address.Length; index++) { oSB.AppendFormat(" {0}\r\n", address[index]); } } catch (Exception ex) { oSB.AppendFormat("\r\n"); oSB.AppendFormat("Error trying to retrieve Host information for this machine:\r\n"); oSB.AppendFormat("{0}\r\n", ex.Source); oSB.AppendFormat("{0}\r\n", ex.Message); } oSB.AppendLine(""); oSB.AppendLine(MachineInfo()); oSB.AppendLine(""); oSB.AppendLine(ProcessInfo()); oSB.AppendLine(""); oSB.AppendLine(GetDotNetInfo()); //oSB.AppendLine(""); //oSB.AppendLine(GetComputerTimeValues()); string sContent = oSB.ToString(); ShowTextDocument oForm = new ShowTextDocument(); oForm.txtEntry.WordWrap = false; oForm.Text = "Run-time Information"; oForm.txtEntry.Text = sContent; oForm.Show(); }