├── .vs ├── ProjectSettings.json ├── slnx.sqlite └── WmiExplorer │ ├── v14 │ └── .suo │ └── v15 │ └── .suo ├── WmiExplorer ├── obj │ ├── Debug │ │ ├── TempPE │ │ │ └── Properties.Resources.Designer.cs.dll │ │ ├── CoreCompileInputs.cache │ │ ├── WMIExplorer.exe │ │ ├── WMIExplorer.pdb │ │ ├── WmiExplorer.Form_ShowMof.resources │ │ ├── WmiExplorer.WmiExplorer.resources │ │ ├── WmiExplorer.Forms.Form_About.resources │ │ ├── WmiExplorer.Forms.Form_Update.resources │ │ ├── DesignTimeResolveAssemblyReferences.cache │ │ ├── WmiExplorer.Forms.Form_Settings.resources │ │ ├── WmiExplorer.csproj.GenerateResource.Cache │ │ ├── WmiExplorer.Forms.Form_ConnectAs.resources │ │ ├── WmiExplorer.Forms.Form_DisplayText.resources │ │ ├── WmiExplorer.Forms.Form_ExecMethod.resources │ │ ├── WmiExplorer.Properties.Resources.resources │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ │ ├── WmiExplorer.csprojResolveAssemblyReference.cache │ │ └── WmiExplorer.csproj.FileListAbsolute.txt │ └── Release │ │ ├── CoreCompileInputs.cache │ │ ├── WmiExplorer.csproj.FileListAbsolute.txt │ │ └── DesignTimeResolveAssemblyReferencesInput.cache ├── Icons │ ├── Database CMYK .ico │ └── Icojam-Blue-Bits-Database-search.ico ├── bin │ ├── Debug │ │ ├── WMIExplorer.exe │ │ ├── WMIExplorer.pdb │ │ ├── WMIExplorer.vshost.exe │ │ ├── WMIExplorer.vshost.exe.manifest │ │ ├── ChangeLog.txt │ │ ├── WMIExplorer.exe.config │ │ └── WMIExplorer.vshost.exe.config │ └── Release │ │ ├── WMIExplorer.vshost.exe │ │ ├── WMIExplorer.vshost.exe.manifest │ │ ├── WMIExplorer.exe.config │ │ └── WMIExplorer.vshost.exe.config ├── WmiExplorer.csproj.vspscc ├── PublishChecklist.txt ├── Updater │ ├── Update.cs │ ├── UpdateEnums.cs │ ├── releases.azure.xml │ ├── releases.codeplex.xml │ └── UpdaterService.cs ├── Issues.txt ├── Classes │ ├── ManagementObjectW.cs │ ├── WmiMethod.cs │ ├── ToolStripItemCollectionSorter.cs │ ├── Enums.cs │ ├── NativeMethods.cs │ ├── MouseWheelMessageFilter.cs │ ├── WmiInstance.cs │ ├── Helpers.cs │ ├── WmiNode.cs │ ├── ManagementBaseObjectWConverter.cs │ ├── ListViewColumnSorter.cs │ ├── WindowPlacement.cs │ ├── ObserverHandler.cs │ ├── ListViewExtensions.cs │ ├── WmiClass.cs │ ├── WmiNamespace.cs │ ├── ManagementBaseObjectPropertyDescriptor.cs │ └── Utilities.cs ├── Forms │ ├── Form_ShowMof.cs │ ├── Form_DisplayText.cs │ ├── Form_Update.cs │ ├── Form_Settings.cs │ ├── Form_ConnectAs.cs │ ├── Form_About.cs │ ├── Form_ShowMof.Designer.cs │ ├── Form_Update.Designer.cs │ ├── Form_DisplayText.Designer.cs │ ├── Form_ConnectAs.resx │ ├── Form_Settings.resx │ ├── Form_ShowMof.resx │ ├── Form_Update.resx │ ├── Form_DisplayText.resx │ ├── Form_ExecMethod.resx │ ├── Form_ConnectAs.Designer.cs │ └── Form_About.Designer.cs ├── releases.xml ├── Program.cs ├── Sms │ ├── SmsClientAction.cs │ ├── SmsClient.cs │ └── SmsClientActions.cs ├── ChangeLog.txt ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Settings.settings │ └── Resources.resx └── app.config ├── README.md ├── WmiExplorer.vssscc ├── WmiExplorer.sln └── License.md /.vs/ProjectSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrentProjectSetting": null 3 | } -------------------------------------------------------------------------------- /WmiExplorer/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.vs/slnx.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/.vs/slnx.sqlite -------------------------------------------------------------------------------- /WmiExplorer/obj/Debug/CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 2212e7a569c34805cb1124df4dac1c8993ddabec 2 | -------------------------------------------------------------------------------- /WmiExplorer/obj/Release/CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 2212e7a569c34805cb1124df4dac1c8993ddabec 2 | -------------------------------------------------------------------------------- /.vs/WmiExplorer/v14/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/.vs/WmiExplorer/v14/.suo -------------------------------------------------------------------------------- /.vs/WmiExplorer/v15/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/.vs/WmiExplorer/v15/.suo -------------------------------------------------------------------------------- /WmiExplorer/Icons/Database CMYK .ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/Icons/Database CMYK .ico -------------------------------------------------------------------------------- /WmiExplorer/bin/Debug/WMIExplorer.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/bin/Debug/WMIExplorer.exe -------------------------------------------------------------------------------- /WmiExplorer/bin/Debug/WMIExplorer.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/bin/Debug/WMIExplorer.pdb -------------------------------------------------------------------------------- /WmiExplorer/obj/Debug/WMIExplorer.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/obj/Debug/WMIExplorer.exe -------------------------------------------------------------------------------- /WmiExplorer/obj/Debug/WMIExplorer.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/obj/Debug/WMIExplorer.pdb -------------------------------------------------------------------------------- /WmiExplorer/obj/Release/WmiExplorer.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\Dan\GIT\WmiExplorer\WmiExplorer\bin\Release\WMIExplorer.exe.config 2 | -------------------------------------------------------------------------------- /WmiExplorer/bin/Debug/WMIExplorer.vshost.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/bin/Debug/WMIExplorer.vshost.exe -------------------------------------------------------------------------------- /WmiExplorer/bin/Release/WMIExplorer.vshost.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/bin/Release/WMIExplorer.vshost.exe -------------------------------------------------------------------------------- /WmiExplorer/Icons/Icojam-Blue-Bits-Database-search.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/Icons/Icojam-Blue-Bits-Database-search.ico -------------------------------------------------------------------------------- /WmiExplorer/obj/Debug/WmiExplorer.Form_ShowMof.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/obj/Debug/WmiExplorer.Form_ShowMof.resources -------------------------------------------------------------------------------- /WmiExplorer/obj/Debug/WmiExplorer.WmiExplorer.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/obj/Debug/WmiExplorer.WmiExplorer.resources -------------------------------------------------------------------------------- /WmiExplorer/obj/Debug/WmiExplorer.Forms.Form_About.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/obj/Debug/WmiExplorer.Forms.Form_About.resources -------------------------------------------------------------------------------- /WmiExplorer/obj/Debug/WmiExplorer.Forms.Form_Update.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/obj/Debug/WmiExplorer.Forms.Form_Update.resources -------------------------------------------------------------------------------- /WmiExplorer/obj/Debug/DesignTimeResolveAssemblyReferences.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/obj/Debug/DesignTimeResolveAssemblyReferences.cache -------------------------------------------------------------------------------- /WmiExplorer/obj/Debug/WmiExplorer.Forms.Form_Settings.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/obj/Debug/WmiExplorer.Forms.Form_Settings.resources -------------------------------------------------------------------------------- /WmiExplorer/obj/Debug/WmiExplorer.csproj.GenerateResource.Cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/obj/Debug/WmiExplorer.csproj.GenerateResource.Cache -------------------------------------------------------------------------------- /WmiExplorer/obj/Debug/WmiExplorer.Forms.Form_ConnectAs.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/obj/Debug/WmiExplorer.Forms.Form_ConnectAs.resources -------------------------------------------------------------------------------- /WmiExplorer/obj/Debug/WmiExplorer.Forms.Form_DisplayText.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/obj/Debug/WmiExplorer.Forms.Form_DisplayText.resources -------------------------------------------------------------------------------- /WmiExplorer/obj/Debug/WmiExplorer.Forms.Form_ExecMethod.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/obj/Debug/WmiExplorer.Forms.Form_ExecMethod.resources -------------------------------------------------------------------------------- /WmiExplorer/obj/Debug/WmiExplorer.Properties.Resources.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/obj/Debug/WmiExplorer.Properties.Resources.resources -------------------------------------------------------------------------------- /WmiExplorer/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /WmiExplorer/obj/Debug/WmiExplorer.csprojResolveAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/obj/Debug/WmiExplorer.csprojResolveAssemblyReference.cache -------------------------------------------------------------------------------- /WmiExplorer/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leinad13/WmiExplorer/HEAD/WmiExplorer/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WmiExplorer 2 | Clone of WMI Explorer v2 from : https://wmie.codeplex.com. With Re-Launch As Admin option. 3 | All Credit to the original author - Vinay Pamnani 4 | 5 | Only addition I have made is to add a Re-Launch As Admin option, as I kept running it and forgetting to runas :) 6 | -------------------------------------------------------------------------------- /WmiExplorer.vssscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT" 10 | } 11 | -------------------------------------------------------------------------------- /WmiExplorer/WmiExplorer.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /WmiExplorer/PublishChecklist.txt: -------------------------------------------------------------------------------- 1 | - Create a new hidden release on Codeplex 2 | - Update ChangeLog.txt 3 | - Update Releases.xml (Codeplex and Azure) with new version, date and release URL. 4 | - Update assembly version. 5 | - Check in project on codeplex (including changelog.txt and releases.xml) 6 | - Upload releases.xml on Azure 7 | - Modify release on Codeplex and make it public. -------------------------------------------------------------------------------- /WmiExplorer/Updater/Update.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace WmiExplorer.Updater 4 | { 5 | internal class Update 6 | { 7 | public Uri ChangeLogUrl { get; set; } 8 | 9 | public DateTimeOffset LastUpdatedTime { get; set; } 10 | 11 | public ReleaseStatus ReleaseStatus { get; set; } 12 | 13 | public Uri Url { get; set; } 14 | 15 | public Version Version { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /WmiExplorer/Updater/UpdateEnums.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace WmiExplorer.Updater 4 | { 5 | [Flags] 6 | public enum ReleaseStatus 7 | { 8 | None = 0, 9 | Stable = 1, 10 | Beta = 2, 11 | Alpha = 4 12 | } 13 | 14 | public enum UpdateFilter 15 | { 16 | None = 0, 17 | Stable = ReleaseStatus.Stable, 18 | Beta = Stable | ReleaseStatus.Beta, 19 | Alpha = Beta | ReleaseStatus.Alpha 20 | } 21 | } -------------------------------------------------------------------------------- /WmiExplorer/Issues.txt: -------------------------------------------------------------------------------- 1 | Issues to address: 2 | - Query fails to populate data grid sometimes due to Enumerate Deep, causing list view not to resize. 3 | - Fixed this by setting DirectRead to true. 4 | 5 | Known Issues: 6 | - Query tab layout is messed up when .NET 4.5 is installed due to a bug with .NET 4.5 (this is fixed in .NET 4.5.1) 7 | https://connect.microsoft.com/VisualStudio/feedback/details/767282/system-windows-forms-tablelayoutpanel-behavior-change-net-4-5-framework 8 | - 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /WmiExplorer/Classes/ManagementObjectW.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Management; 3 | 4 | namespace WmiExplorer.Classes 5 | { 6 | /// 7 | /// Wrapper Class for ManagementObject 8 | /// 9 | [TypeConverter(typeof(ManagementBaseObjectWConverter))] 10 | internal class ManagementObjectW : ManagementBaseObjectW 11 | { 12 | public ManagementObjectW(ManagementBaseObject actualObject) 13 | : base(actualObject) 14 | { 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /WmiExplorer/bin/Debug/WMIExplorer.vshost.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /WmiExplorer/bin/Release/WMIExplorer.vshost.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /WmiExplorer/Forms/Form_ShowMof.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace WmiExplorer 11 | { 12 | 13 | public sealed partial class Form_ShowMof : Form 14 | { 15 | public Form_ShowMof(string mofText) 16 | { 17 | InitializeComponent(); 18 | textBoxShowMOF.Text = "\r\n" + mofText; 19 | } 20 | 21 | private void buttonCloseMOF_Click(object sender, EventArgs e) 22 | { 23 | this.Close(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /WmiExplorer/Updater/releases.azure.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WMI Explorer 4 | http://wmie.codeplex.com/releases 5 | 2014-10-27T00:00:00Z 6 | 7 | Vinay Pamnani 8 | 9 | 10 | https://wmie.codeplex.com/releases/view/135794 11 | 2.0.0.0 12 | 2014-10-27T00:00:00Z 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /WmiExplorer/releases.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WMI Explorer 4 | http://wmie.codeplex.com/releases 5 | 2014-10-27T00:00:00Z 6 | 7 | Vinay Pamnani 8 | 9 | 10 | https://wmie.codeplex.com/releases/view/135794 11 | 2.0.0.0 12 | 2014-10-27T00:00:00Z 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /WmiExplorer/Updater/releases.codeplex.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WMI Explorer 4 | http://wmie.codeplex.com/releases 5 | 2014-10-27T00:00:00Z 6 | 7 | Vinay Pamnani 8 | 9 | 10 | https://wmie.codeplex.com/releases/view/135794 11 | 2.0.0.0 12 | 2014-10-27T00:00:00Z 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /WmiExplorer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Windows.Forms; 5 | 6 | namespace WmiExplorer 7 | { 8 | static class Program 9 | { 10 | /// 11 | /// The main entry point for the application. 12 | /// 13 | [STAThread] 14 | static void Main() 15 | { 16 | if (Environment.OSVersion.Version.Major >= 6) SetProcessDPIAware(); 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new WmiExplorer()); 20 | } 21 | 22 | [System.Runtime.InteropServices.DllImport("user32.dll")] 23 | private static extern bool SetProcessDPIAware(); 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /WmiExplorer/Forms/Form_DisplayText.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace WmiExplorer.Forms 11 | { 12 | public partial class Form_DisplayText : Form 13 | { 14 | public Form_DisplayText(string windowTitle, string caption, string text) 15 | { 16 | InitializeComponent(); 17 | labelCaption.Font = new Font("Arial", 10, FontStyle.Bold); 18 | Text = windowTitle; 19 | labelCaption.Text = caption; 20 | richTextBox.Text = text; 21 | } 22 | 23 | private void buttonOk_Click(object sender, EventArgs e) 24 | { 25 | this.Close(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /WmiExplorer/Classes/WmiMethod.cs: -------------------------------------------------------------------------------- 1 | using System.Management; 2 | 3 | namespace WmiExplorer.Classes 4 | { 5 | internal class WmiMethod 6 | { 7 | private string _description; 8 | private bool _isStatic; 9 | private string _methodName; 10 | private string _path; 11 | private MethodData _wmiMethod; 12 | 13 | public WmiMethod(MethodData actualMethod) 14 | { 15 | _wmiMethod = actualMethod; 16 | } 17 | 18 | public string Description 19 | { 20 | get { return _description; } 21 | set { _description = value; } 22 | } 23 | 24 | public bool IsStatic 25 | { 26 | get { return _isStatic; } 27 | set { _isStatic = value; } 28 | } 29 | 30 | public string MethodName 31 | { 32 | get { return _methodName; } 33 | set { _methodName = value; } 34 | } 35 | 36 | public string Path 37 | { 38 | get { return _path; } 39 | set { _path = value; } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /WmiExplorer/Sms/SmsClientAction.cs: -------------------------------------------------------------------------------- 1 | namespace WmiExplorer.Sms 2 | { 3 | public static class ActionGroup 4 | { 5 | public static string ApplicationEvaluation = "Application Evaluation"; 6 | public static string Default = "Default"; 7 | public static string Endpoint = "Endpoint Protection"; 8 | public static string Inventory = "Inventory"; 9 | public static string LocationServices = "Location Services"; 10 | public static string Other = "Other"; 11 | public static string Policy = "Policy"; 12 | public static string SoftwareUpdates = "Software Updates"; 13 | public static string StateMessage = "State Messages"; 14 | } 15 | 16 | public class SmsClientAction 17 | { 18 | public SmsClientAction(string id, string displayName, string group = "Default") 19 | { 20 | Id = id; 21 | DisplayName = displayName; 22 | Group = group; 23 | } 24 | 25 | public string DisplayName { get; set; } 26 | 27 | public string Group { get; set; } 28 | 29 | public string Id { get; set; } 30 | } 31 | } -------------------------------------------------------------------------------- /WmiExplorer/Classes/ToolStripItemCollectionSorter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Windows.Forms; 4 | 5 | namespace WmiExplorer.Classes 6 | { 7 | public static class ToolStripItemExtensions 8 | { 9 | public static void SortToolStripItemCollection(this ToolStripItemCollection items) 10 | { 11 | ArrayList aList = new ArrayList(items); 12 | aList.Sort(new ToolStripItemCollectionSorter()); 13 | items.Clear(); 14 | 15 | foreach (ToolStripItem item in aList) 16 | { 17 | items.Add(item); 18 | } 19 | } 20 | } 21 | 22 | public class ToolStripItemCollectionSorter : IComparer 23 | { 24 | public int Compare(object x, object y) 25 | { 26 | // Cast the objects to be compared to ListViewItem objects 27 | ToolStripItem toolStripItemX = (ToolStripItem)x; 28 | ToolStripItem toolStripItemY = (ToolStripItem)y; 29 | 30 | return String.Compare(toolStripItemX.Text, toolStripItemY.Text, StringComparison.OrdinalIgnoreCase); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /WmiExplorer/ChangeLog.txt: -------------------------------------------------------------------------------- 1 | Version 2.0.0.0 [10-27-2014] 2 | 3 | * New: Asynchronous mode for enumeration of classes and instances in the background. 4 | * New: Method execution. 5 | * New: SMS (System Center Configuration Manager) Mode. 6 | * New: Property tab showing properties of selected class. 7 | * New: Input & Output parameter information in Methods tab with Help information. 8 | * New: List View output mode for Query Results. 9 | * New: Update Notifications when a new version of WMI Explorer is available. 10 | * New: Connect to multiple computers at the same time. 11 | * New: Quick Filter for Classes and Instances. 12 | * New: User Preferences. 13 | * New: View WMI Provider Process Information. 14 | * Improved: UI display on higher scaling levels and resolution. 15 | * Improved: Connect As option to provide alternate credentials. 16 | * Improved: Display of embedded object names in Property Grid. 17 | 18 | 19 | Version 1.0.0.8 [01-07-2014] 20 | 21 | * BugFix: Fixed a crash that occurs due to use of incorrectly displayed right-click context menu when no items are selected in Class/Instance list view. 22 | 23 | 24 | Version 1.0.0.7 [01-07-2014] 25 | 26 | * Initial Release. -------------------------------------------------------------------------------- /WmiExplorer/bin/Debug/ChangeLog.txt: -------------------------------------------------------------------------------- 1 | Version 2.0.0.0 [10-27-2014] 2 | 3 | * New: Asynchronous mode for enumeration of classes and instances in the background. 4 | * New: Method execution. 5 | * New: SMS (System Center Configuration Manager) Mode. 6 | * New: Property tab showing properties of selected class. 7 | * New: Input & Output parameter information in Methods tab with Help information. 8 | * New: List View output mode for Query Results. 9 | * New: Update Notifications when a new version of WMI Explorer is available. 10 | * New: Connect to multiple computers at the same time. 11 | * New: Quick Filter for Classes and Instances. 12 | * New: User Preferences. 13 | * New: View WMI Provider Process Information. 14 | * Improved: UI display on higher scaling levels and resolution. 15 | * Improved: Connect As option to provide alternate credentials. 16 | * Improved: Display of embedded object names in Property Grid. 17 | 18 | 19 | Version 1.0.0.8 [01-07-2014] 20 | 21 | * BugFix: Fixed a crash that occurs due to use of incorrectly displayed right-click context menu when no items are selected in Class/Instance list view. 22 | 23 | 24 | Version 1.0.0.7 [01-07-2014] 25 | 26 | * Initial Release. -------------------------------------------------------------------------------- /WmiExplorer/Classes/Enums.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | 4 | namespace WmiExplorer.Classes 5 | { 6 | public enum MessageCategory 7 | { 8 | Unknown, 9 | Info, 10 | Action, 11 | Warn, 12 | Error, 13 | Cache, 14 | Sms, 15 | None, 16 | } 17 | 18 | [Flags] 19 | public enum EnumOptions 20 | { 21 | None = 0, 22 | IncludeSystem = 1, 23 | IncludeCim = 2, 24 | IncludePerf = 4, 25 | IncludeMsft = 8, 26 | ShowNullInstanceValues = 16, 27 | ShowSystemProperties = 32, 28 | ExcludeSmsCollections = 64, 29 | ExcludeSmsInventory = 128 30 | } 31 | 32 | public static class ColorCategory 33 | { 34 | public static Color Unknown = Color.Gold; 35 | public static Color Info = Color.YellowGreen; 36 | public static Color Action = Color.Khaki; 37 | public static Color Warn = Color.Yellow; 38 | public static Color Error = Color.Red; 39 | public static Color Cache = Color.LightGreen; 40 | public static Color Sms = Color.LightSkyBlue; 41 | public static Color None = Color.Empty; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /WmiExplorer/Classes/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.CodeAnalysis; 3 | using System.Drawing; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace WmiExplorer.Classes 7 | { 8 | /// 9 | /// Wrapper for Native Methods 10 | /// 11 | internal class NativeMethods 12 | { 13 | // P/Invoke declarations 14 | 15 | [DllImport("user32.dll")] 16 | public static extern bool GetWindowPlacement(IntPtr hWnd, out WINDOWPLACEMENT lpwndpl); 17 | 18 | [DllImport("user32.dll")] 19 | public static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp); 20 | 21 | [DllImport("user32.dll", EntryPoint = "SendMessage")] 22 | public static extern IntPtr SendMessageLVCOLUMN(IntPtr hWnd, Int32 Msg, IntPtr wParam, ref ListViewExtensions.LVCOLUMN lPLVCOLUMN); 23 | 24 | [DllImport("user32.dll")] 25 | public static extern bool SetWindowPlacement(IntPtr hWnd, [In] ref WINDOWPLACEMENT lpwndpl); 26 | 27 | [SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", MessageId = "0"), DllImport("user32.dll")] 28 | public static extern IntPtr WindowFromPoint(Point pt); 29 | } 30 | } -------------------------------------------------------------------------------- /WmiExplorer/Classes/MouseWheelMessageFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Windows.Forms; 4 | 5 | namespace WmiExplorer.Classes 6 | { 7 | /// 8 | /// Used to allow scrolling for the controls, without having to select them or focus on them. 9 | /// http://www.brad-smith.info/blog/archives/635 10 | /// http://stackoverflow.com/questions/7852824/usercontrol-how-to-add-mousewheel-listener 11 | /// 12 | internal class MouseWheelMessageFilter : IMessageFilter 13 | { 14 | private const int WM_MOUSEWHEEL = 0x20a; 15 | 16 | public bool PreFilterMessage(ref Message m) 17 | { 18 | if (m.Msg == WM_MOUSEWHEEL) 19 | { 20 | // LParam contains the location of the mouse pointer 21 | Point pos = new Point(m.LParam.ToInt32() & 0xffff, m.LParam.ToInt32() >> 16); 22 | IntPtr hWnd = NativeMethods.WindowFromPoint(pos); 23 | if (hWnd != IntPtr.Zero && hWnd != m.HWnd && Control.FromHandle(hWnd) != null) 24 | { 25 | // redirect the message to the correct control 26 | NativeMethods.SendMessage(hWnd, m.Msg, m.WParam, m.LParam); 27 | return true; 28 | } 29 | } 30 | 31 | return false; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /WmiExplorer/Classes/WmiInstance.cs: -------------------------------------------------------------------------------- 1 | using System.Management; 2 | 3 | namespace WmiExplorer.Classes 4 | { 5 | internal class WmiInstance 6 | { 7 | private string _path; 8 | private string _relativePath; 9 | 10 | public WmiInstance(ManagementObject actualObject) 11 | { 12 | Instance = actualObject; 13 | } 14 | 15 | public ManagementObject Instance { get; set; } 16 | 17 | public string Path 18 | { 19 | get 20 | { 21 | if (_path == null) 22 | _path = Instance.Path.Path; 23 | 24 | return _path; 25 | } 26 | } 27 | 28 | public string RelativePath 29 | { 30 | get 31 | { 32 | if (_relativePath == null) 33 | _relativePath = Instance.Path.RelativePath; 34 | 35 | return _relativePath; 36 | } 37 | } 38 | 39 | public string GetInstanceMof(bool bAmended = false) 40 | { 41 | if (bAmended) 42 | Instance.Options.UseAmendedQualifiers = true; 43 | else 44 | Instance.Options.UseAmendedQualifiers = false; 45 | 46 | Instance.Get(); 47 | return Instance.GetText(TextFormat.Mof).Replace("\n", "\r\n"); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /WmiExplorer/obj/Debug/WmiExplorer.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\Dan\GIT\WmiExplorer\WmiExplorer\bin\Debug\ChangeLog.txt 2 | C:\Dan\GIT\WmiExplorer\WmiExplorer\bin\Debug\WMIExplorer.exe.config 3 | C:\Dan\GIT\WmiExplorer\WmiExplorer\bin\Debug\WMIExplorer.exe 4 | C:\Dan\GIT\WmiExplorer\WmiExplorer\bin\Debug\WMIExplorer.pdb 5 | C:\Dan\GIT\WmiExplorer\WmiExplorer\obj\Debug\WmiExplorer.csprojResolveAssemblyReference.cache 6 | C:\Dan\GIT\WmiExplorer\WmiExplorer\obj\Debug\WmiExplorer.Forms.Form_About.resources 7 | C:\Dan\GIT\WmiExplorer\WmiExplorer\obj\Debug\WmiExplorer.Forms.Form_ConnectAs.resources 8 | C:\Dan\GIT\WmiExplorer\WmiExplorer\obj\Debug\WmiExplorer.Forms.Form_DisplayText.resources 9 | C:\Dan\GIT\WmiExplorer\WmiExplorer\obj\Debug\WmiExplorer.Forms.Form_ExecMethod.resources 10 | C:\Dan\GIT\WmiExplorer\WmiExplorer\obj\Debug\WmiExplorer.Forms.Form_Settings.resources 11 | C:\Dan\GIT\WmiExplorer\WmiExplorer\obj\Debug\WmiExplorer.Form_ShowMof.resources 12 | C:\Dan\GIT\WmiExplorer\WmiExplorer\obj\Debug\WmiExplorer.Forms.Form_Update.resources 13 | C:\Dan\GIT\WmiExplorer\WmiExplorer\obj\Debug\WmiExplorer.Properties.Resources.resources 14 | C:\Dan\GIT\WmiExplorer\WmiExplorer\obj\Debug\WmiExplorer.WmiExplorer.resources 15 | C:\Dan\GIT\WmiExplorer\WmiExplorer\obj\Debug\WmiExplorer.csproj.GenerateResource.Cache 16 | C:\Dan\GIT\WmiExplorer\WmiExplorer\obj\Debug\WMIExplorer.exe 17 | C:\Dan\GIT\WmiExplorer\WmiExplorer\obj\Debug\WMIExplorer.pdb 18 | -------------------------------------------------------------------------------- /WmiExplorer/Forms/Form_Update.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Drawing; 4 | using System.Windows.Forms; 5 | using WmiExplorer.Properties; 6 | 7 | namespace WmiExplorer.Forms 8 | { 9 | public partial class Form_Update : Form 10 | { 11 | public Form_Update(bool bUpdateAvailable, string changelog) 12 | { 13 | InitializeComponent(); 14 | 15 | if (bUpdateAvailable) 16 | { 17 | Font font = new Font("Arial", 10, FontStyle.Bold); 18 | richTextBoxUpdate.SelectionFont = font; 19 | richTextBoxUpdate.AppendText("A new version of WMI Explorer is available!\n"); 20 | richTextBoxUpdate.AppendText(Settings.Default.UpdateUrl + "\n\n"); 21 | richTextBoxUpdate.AppendText(changelog); 22 | richTextBoxUpdate.SelectionStart = 0; 23 | richTextBoxUpdate.ScrollToCaret(); 24 | } 25 | else 26 | { 27 | Width = 400; 28 | Height = 200; 29 | richTextBoxUpdate.AppendText("You are running the latest version!"); 30 | } 31 | } 32 | 33 | private void button1_Click(object sender, EventArgs e) 34 | { 35 | Close(); 36 | } 37 | 38 | private void richTextBoxUpdate_LinkClicked(object sender, LinkClickedEventArgs e) 39 | { 40 | Process.Start(e.LinkText); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /WmiExplorer.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.30723.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WmiExplorer", "WmiExplorer\WmiExplorer.csproj", "{781647DE-1788-4B7C-9289-D0323FDF562A}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B9BD9632-8046-4414-B261-35222239F891}" 9 | EndProject 10 | Global 11 | GlobalSection(TeamFoundationVersionControl) = preSolution 12 | SccNumberOfProjects = 2 13 | SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} 14 | SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs36 15 | SccLocalPath0 = . 16 | SccProjectUniqueName1 = WmiExplorer\\WmiExplorer.csproj 17 | SccProjectName1 = WmiExplorer 18 | SccLocalPath1 = WmiExplorer 19 | EndGlobalSection 20 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 21 | Debug|Any CPU = Debug|Any CPU 22 | Release|Any CPU = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 25 | {781647DE-1788-4B7C-9289-D0323FDF562A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 26 | {781647DE-1788-4B7C-9289-D0323FDF562A}.Debug|Any CPU.Build.0 = Debug|Any CPU 27 | {781647DE-1788-4B7C-9289-D0323FDF562A}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {781647DE-1788-4B7C-9289-D0323FDF562A}.Release|Any CPU.Build.0 = Release|Any CPU 29 | EndGlobalSection 30 | GlobalSection(SolutionProperties) = preSolution 31 | HideSolutionNode = FALSE 32 | EndGlobalSection 33 | EndGlobal 34 | -------------------------------------------------------------------------------- /WmiExplorer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("WMI Explorer")] 9 | [assembly: AssemblyDescription("WMI Explorer is a utility intended to provide the ability to browse and view WMI objects in a single pane of view.")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("WMI Explorer")] 13 | [assembly: AssemblyCopyright("Copyright © 2014 by Vinay Pamnani")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("0186a05f-638a-4422-9992-412b499e60e4")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("2.0.0.0")] 36 | [assembly: AssemblyFileVersion("2.0.0.0")] 37 | -------------------------------------------------------------------------------- /WmiExplorer/Classes/Helpers.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | using System.Management; 3 | using System.Windows.Forms; 4 | using WmiExplorer.Sms; 5 | 6 | namespace WmiExplorer.Classes 7 | { 8 | public static class Helpers 9 | { 10 | public static Form CenterForm(this Form child, Form parent) 11 | { 12 | child.StartPosition = FormStartPosition.Manual; 13 | child.Location = new Point(parent.Location.X + (parent.Width - child.Width) / 2, parent.Location.Y + (parent.Height - child.Height) / 2); 14 | return child; 15 | } 16 | 17 | public static TreeNode GetRootNode(this TreeNode treeNode) 18 | { 19 | var rootNode = treeNode; 20 | 21 | while (rootNode.Parent != null) 22 | { 23 | rootNode = rootNode.Parent; 24 | } 25 | 26 | return rootNode; 27 | } 28 | 29 | public static ConnectionOptions GetRootNodeCredentials(TreeNode treeNode) 30 | { 31 | var rootNode = treeNode.GetRootNode(); 32 | return ((WmiNode)rootNode.Tag).Connection; 33 | } 34 | 35 | public static SmsClient GetSmsClient(TreeNode treeNode) 36 | { 37 | var rootNode = treeNode; 38 | 39 | while (rootNode.Parent != null) 40 | { 41 | rootNode = rootNode.Parent; 42 | } 43 | 44 | return ((WmiNode)rootNode.Tag).SmsClient; 45 | } 46 | 47 | public static bool IsNodeDisconnected(TreeNode treeNode) 48 | { 49 | WmiNode wmiNode = treeNode.Tag as WmiNode; 50 | if (wmiNode != null && wmiNode.IsRootNode && wmiNode.IsConnected == false) 51 | return true; 52 | 53 | return false; 54 | } 55 | 56 | 57 | } 58 | } -------------------------------------------------------------------------------- /WmiExplorer/Classes/WmiNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Management; 3 | using WmiExplorer.Sms; 4 | 5 | namespace WmiExplorer.Classes 6 | { 7 | internal class WmiNode 8 | { 9 | private ConnectionOptions _connection; 10 | 11 | private string _expansionStatus; 12 | 13 | private string _userSpecifiedPath; 14 | 15 | // Constructor to create Root Node 16 | public WmiNode() 17 | { 18 | } 19 | 20 | // Constructor to create Wmi Node for the specified namespace 21 | public WmiNode(ManagementObject wmiNamespace) 22 | { 23 | WmiNamespace = new WmiNamespace(wmiNamespace); 24 | //_connection = wmiNamespace.Scope.Options; 25 | } 26 | 27 | public ConnectionOptions Connection 28 | { 29 | get { return _connection; } 30 | } 31 | 32 | public string ExpansionStatus 33 | { 34 | get 35 | { 36 | if (String.IsNullOrEmpty(_expansionStatus)) 37 | _expansionStatus = "NoError"; 38 | 39 | return _expansionStatus; 40 | } 41 | set { _expansionStatus = value; } 42 | } 43 | 44 | public bool IsConnected { get; set; } 45 | 46 | public bool IsExpanded { get; set; } 47 | 48 | public bool IsRootNode { get; set; } 49 | 50 | public SmsClient SmsClient { get; set; } 51 | 52 | public string UserSpecifiedPath 53 | { 54 | get { return _userSpecifiedPath; } 55 | set 56 | { 57 | _userSpecifiedPath = IsRootNode ? value : "NotApplicable"; 58 | } 59 | } 60 | 61 | public WmiNamespace WmiNamespace { get; set; } 62 | 63 | public void SetConnection(ConnectionOptions value) 64 | { 65 | _connection = value; 66 | } 67 | } 68 | } -------------------------------------------------------------------------------- /WmiExplorer/Forms/Form_Settings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Globalization; 4 | using System.Windows.Forms; 5 | using WmiExplorer.Properties; 6 | 7 | namespace WmiExplorer.Forms 8 | { 9 | public partial class Form_Settings : Form 10 | { 11 | private readonly string _currentCacheAge; 12 | 13 | public Form_Settings() 14 | { 15 | InitializeComponent(); 16 | _currentCacheAge = textBoxSettings_CacheAge.Text; 17 | } 18 | 19 | private void buttonSettings_Save_Click(object sender, EventArgs e) 20 | { 21 | bool restartRequired = false; 22 | 23 | if (Settings.Default.CacheAgeInMinutes != _currentCacheAge) 24 | { 25 | if (MessageBox.Show( 26 | "New Cache Age will take effect after restarting WMI Explorer.\n\n" + 27 | "Would you like to restart WMI Explorer now ?", 28 | "WMI Explorer - Restart Required", 29 | MessageBoxButtons.YesNo, 30 | MessageBoxIcon.Question 31 | ) == DialogResult.Yes) 32 | { 33 | restartRequired = true; 34 | } 35 | } 36 | 37 | Settings.Default.Save(); 38 | 39 | if (restartRequired) 40 | { 41 | Process.Start(Application.ExecutablePath); 42 | Application.Exit(); 43 | } 44 | 45 | Close(); 46 | } 47 | 48 | private void buttonSettings_Cancel_Click(object sender, EventArgs e) 49 | { 50 | Close(); 51 | } 52 | 53 | private void Form_Settings_Load(object sender, EventArgs e) 54 | { 55 | labelUpdate_LastUpdateCheck.Text += Settings.Default.LastUpdateCheck.ToString(CultureInfo.InvariantCulture); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /WmiExplorer/Forms/Form_ConnectAs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Management; 3 | using System.Windows.Forms; 4 | using WmiExplorer.Classes; 5 | 6 | namespace WmiExplorer.Forms 7 | { 8 | public partial class Form_ConnectAs : Form 9 | { 10 | public ConnectionOptions Connection; 11 | public string Path; 12 | public bool Cancelled; 13 | 14 | public Form_ConnectAs(string path = "") 15 | { 16 | InitializeComponent(); 17 | 18 | if (!String.IsNullOrEmpty(path)) 19 | { 20 | textBoxPath.Text = path; 21 | textBoxPath.ReadOnly = true; 22 | textBoxUsername.Select(); 23 | } 24 | 25 | } 26 | 27 | private void buttonOk_Click(object sender, EventArgs e) 28 | { 29 | if (String.IsNullOrEmpty(textBoxPath.Text)) 30 | { 31 | MessageBox.Show("No path specified. Please specify a remote computer/path to connect to. ", 32 | "Invalid Path", MessageBoxButtons.OK, MessageBoxIcon.Error); 33 | return; 34 | } 35 | 36 | Path = textBoxPath.Text.ToUpperInvariant(); 37 | Connection = new ConnectionOptions 38 | { 39 | EnablePrivileges = true, 40 | Impersonation = ImpersonationLevel.Impersonate, 41 | Authentication = AuthenticationLevel.Default, 42 | Username = textBoxUsername.Text, 43 | SecurePassword = textBoxPassword.Text.StringToSecureString() 44 | }; 45 | 46 | if (String.IsNullOrEmpty(textBoxUsername.Text)) 47 | { 48 | MessageBox.Show("No username specified. Logged on user's credentials will be used. ", 49 | "Invalid Credentials", MessageBoxButtons.OK, MessageBoxIcon.Warning); 50 | Connection.Username = null; 51 | Connection.SecurePassword = null; 52 | } 53 | 54 | Close(); 55 | } 56 | 57 | private void buttonCancel_Click(object sender, EventArgs e) 58 | { 59 | Cancelled = true; 60 | Close(); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /WmiExplorer/Classes/ManagementBaseObjectWConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Globalization; 4 | using System.Management; 5 | 6 | namespace WmiExplorer.Classes 7 | { 8 | /// 9 | /// Used to display property values of Embedded WMI Objects. 10 | /// Reference tutorial: http://www.codeproject.com/Articles/4448/Customized-display-of-collection-data-in-a-Propert 11 | /// 12 | internal class ManagementBaseObjectWConverter : ExpandableObjectConverter 13 | { 14 | public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) 15 | { 16 | if (value is ManagementBaseObjectW) 17 | { 18 | ManagementBaseObjectW mObjectW = (ManagementBaseObjectW)value; 19 | 20 | // If PropertyName contains Name, return the value of the property 21 | foreach (PropertyData p in mObjectW.Properties) 22 | { 23 | if (p.Name.Contains("Name")) 24 | return p.Value.ToString(); 25 | } 26 | 27 | // No match on Name. If PropertyName contains ID, return the value of the property 28 | foreach (PropertyData p in mObjectW.Properties) 29 | { 30 | if (p.Name.Contains("ID")) 31 | return p.Value.ToString(); 32 | } 33 | 34 | // No match on Name or ID. If Property is key, return the value of the property 35 | foreach (PropertyData p in mObjectW.Properties) 36 | { 37 | foreach (QualifierData q in p.Qualifiers) 38 | if (q.Name.Equals("key", StringComparison.InvariantCultureIgnoreCase)) 39 | if (String.IsNullOrEmpty(p.Value.ToString())) 40 | return String.Empty; 41 | else 42 | return p.Value.ToString(); 43 | } 44 | 45 | // No matches. Return an empty string. 46 | return String.Empty; 47 | } 48 | 49 | return base.ConvertTo(context, culture, value, destinationType); 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /License.md: -------------------------------------------------------------------------------- 1 | Microsoft Public License (Ms-PL) 2 | Microsoft Public License (Ms-PL) 3 | 4 | This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. 5 | 6 | 1. Definitions 7 | 8 | The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. 9 | 10 | A "contribution" is the original software, or any additions or changes to the software. 11 | 12 | A "contributor" is any person that distributes its contribution under this license. 13 | 14 | "Licensed patents" are a contributor's patent claims that read directly on its contribution. 15 | 16 | 2. Grant of Rights 17 | 18 | (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. 19 | 20 | (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. 21 | 22 | 3. Conditions and Limitations 23 | 24 | (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. 25 | 26 | (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. 27 | 28 | (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. 29 | 30 | (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. 31 | 32 | (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. 33 | -------------------------------------------------------------------------------- /WmiExplorer/Sms/SmsClient.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Management; 3 | 4 | namespace WmiExplorer.Sms 5 | { 6 | public class SmsClient 7 | { 8 | public SmsClient(string clientNamespacePath, ConnectionOptions connection) 9 | { 10 | ClientNamespacePath = clientNamespacePath; 11 | SmsClientClassPath = clientNamespacePath + ":SMS_Client"; 12 | Connection = connection; 13 | IsClientInstalled = IsInstalled(); 14 | } 15 | 16 | public string ClientNamespacePath { get; set; } 17 | 18 | public ConnectionOptions Connection { get; set; } 19 | 20 | public bool IsClientInstalled { get; set; } 21 | 22 | public bool IsConnected { get; set; } 23 | 24 | public ManagementClass SmsClientClass { get; set; } 25 | 26 | public string SmsClientClassPath { get; set; } 27 | 28 | public bool IsInstalled() 29 | { 30 | const string queryString = "SELECT * FROM meta_class WHERE __Class = 'SMS_Client'"; 31 | 32 | ManagementScope scope = new ManagementScope(ClientNamespacePath, Connection); 33 | ObjectQuery query = new ObjectQuery(queryString); 34 | EnumerationOptions eOption = new EnumerationOptions(); 35 | ManagementObjectSearcher queryClientSearcher = new ManagementObjectSearcher(scope, query, eOption); 36 | 37 | ManagementObject ccmClient = (from ManagementClass mClass in queryClientSearcher.Get() 38 | orderby mClass.Path.ClassName 39 | select mClass).FirstOrDefault(); 40 | 41 | return ccmClient != null; 42 | } 43 | 44 | //public void InitiateClientAction(SmsClientAction smsClientAction) 45 | //{ 46 | // try 47 | // { 48 | // ManagementBaseObject inParams = SmsClientClass.GetMethodParameters("TriggerSchedule"); 49 | // inParams["sScheduleId"] = smsClientAction.Id; 50 | // ManagementBaseObject outParams = SmsClientClass.InvokeMethod("TriggerSchedule", inParams, null); 51 | 52 | // if (outParams != null) 53 | // { 54 | // MessageBox.Show("Successfully triggered " + smsClientAction.DisplayName + ".", 55 | // "Initiate Client Action", 56 | // MessageBoxButtons.OK, 57 | // MessageBoxIcon.Information); 58 | // } 59 | // } 60 | // catch (Exception ex) 61 | // { 62 | // MessageBox.Show("Failed to trigger " + smsClientAction.DisplayName + ". Error: " + ex.Message, 63 | // "Initiate Client Action", 64 | // MessageBoxButtons.OK, 65 | // MessageBoxIcon.Error); 66 | // } 67 | //} 68 | } 69 | } -------------------------------------------------------------------------------- /WmiExplorer/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34014 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WmiExplorer.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WmiExplorer.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /WmiExplorer/Updater/UpdaterService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Linq; 4 | using System.Net; 5 | using System.Reflection; 6 | using System.ServiceModel.Syndication; 7 | using System.Xml; 8 | 9 | namespace WmiExplorer.Updater 10 | { 11 | internal class UpdaterService 12 | { 13 | public static Update GetUpdateFromSyndicationItem(SyndicationItem item) 14 | { 15 | Debug.Assert(item != null); 16 | 17 | var update = new Update(); 18 | 19 | // Update Version 20 | Version version; 21 | if (Version.TryParse(item.Title.Text, out version)) 22 | { 23 | update.Version = version; 24 | } 25 | 26 | // Last Updated Time 27 | update.LastUpdatedTime = item.LastUpdatedTime; 28 | 29 | // Update Url 30 | var updateLink = item.Links.FirstOrDefault( 31 | l => String.IsNullOrWhiteSpace(l.RelationshipType) 32 | || l.RelationshipType.Equals("alternate", StringComparison.OrdinalIgnoreCase)); 33 | 34 | if (updateLink != null) 35 | { 36 | update.Url = updateLink.GetAbsoluteUri(); 37 | } 38 | 39 | // Change Log Url 40 | var changeLogLink = item.Links.FirstOrDefault( 41 | l => String.IsNullOrWhiteSpace(l.RelationshipType) 42 | || l.RelationshipType.Equals("related", StringComparison.OrdinalIgnoreCase)); 43 | 44 | if (changeLogLink != null) 45 | { 46 | update.ChangeLogUrl = changeLogLink.GetAbsoluteUri(); 47 | } 48 | 49 | // Update Release Status 50 | update.ReleaseStatus 51 | = item.Categories.Aggregate( 52 | ReleaseStatus.None, 53 | (rs, c) => 54 | { 55 | ReleaseStatus releaseStatus; 56 | 57 | if (Enum.TryParse(c.Name, true, out releaseStatus)) 58 | { 59 | rs |= releaseStatus; 60 | } 61 | 62 | return rs; 63 | }); 64 | 65 | return update; 66 | } 67 | 68 | public Update CheckForUpdatesAsync(string updateUrl, UpdateFilter updateFilter) 69 | { 70 | Debug.Assert(!String.IsNullOrWhiteSpace(updateUrl)); 71 | 72 | Update latestUpdate = null; 73 | 74 | var formatter = new Atom10FeedFormatter(); 75 | var reader = XmlReader.Create(updateUrl); 76 | formatter.ReadFrom(reader); 77 | 78 | latestUpdate = (from i in formatter.Feed.Items 79 | let u = GetUpdateFromSyndicationItem(i) 80 | where u.Version > Assembly.GetExecutingAssembly().GetName().Version 81 | && ((int)updateFilter & (int)u.ReleaseStatus) != 0 82 | orderby u.LastUpdatedTime descending 83 | select u).FirstOrDefault(); 84 | 85 | return latestUpdate; 86 | } 87 | 88 | public string GetChangeLog(Uri changeLogUrl) 89 | { 90 | return new WebClient().DownloadString(changeLogUrl); 91 | } 92 | } 93 | } -------------------------------------------------------------------------------- /WmiExplorer/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | False 7 | 8 | 9 | True 10 | 11 | 12 | True 13 | 14 | 15 | True 16 | 17 | 18 | False 19 | 20 | 21 | True 22 | 23 | 24 | 60 25 | 26 | 27 | None 28 | 29 | 30 | 1970-01-01 31 | 32 | 33 | 34 | 35 | 36 | 220 37 | 38 | 39 | 200 40 | 41 | 42 | 180 43 | 44 | 45 | 7 46 | 47 | 48 | https://wmie.svn.codeplex.com/svn/wmiexplorer/wmiexplorer/releases.xml 49 | 50 | 51 | http://wmie.azurewebsites.net/releases.xml 52 | 53 | 54 | https://wmie.codeplex.com 55 | 56 | 57 | 58 | 59 | 60 | True 61 | 62 | 63 | True 64 | 65 | 66 | -------------------------------------------------------------------------------- /WmiExplorer/Forms/Form_About.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Windows.Forms; 4 | 5 | namespace WmiExplorer.Forms 6 | { 7 | partial class Form_About : Form 8 | { 9 | public Form_About() 10 | { 11 | InitializeComponent(); 12 | this.Text = String.Format("About {0}", AssemblyTitle); 13 | this.labelProductName.Text = AssemblyProduct; 14 | this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion); 15 | this.labelCopyright.Text = AssemblyCopyright; 16 | //this.labelCompanyName.Text = AssemblyCompany; 17 | //this.textBoxDescription.Text = AssemblyDescription; 18 | } 19 | 20 | #region Assembly Attribute Accessors 21 | 22 | public string AssemblyTitle 23 | { 24 | get 25 | { 26 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); 27 | if (attributes.Length > 0) 28 | { 29 | AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; 30 | if (titleAttribute.Title != "") 31 | { 32 | return titleAttribute.Title; 33 | } 34 | } 35 | return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); 36 | } 37 | } 38 | 39 | public string AssemblyVersion 40 | { 41 | get 42 | { 43 | return Assembly.GetExecutingAssembly().GetName().Version.ToString(); 44 | } 45 | } 46 | 47 | public string AssemblyDescription 48 | { 49 | get 50 | { 51 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); 52 | if (attributes.Length == 0) 53 | { 54 | return ""; 55 | } 56 | return ((AssemblyDescriptionAttribute)attributes[0]).Description; 57 | } 58 | } 59 | 60 | public string AssemblyProduct 61 | { 62 | get 63 | { 64 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); 65 | if (attributes.Length == 0) 66 | { 67 | return ""; 68 | } 69 | return ((AssemblyProductAttribute)attributes[0]).Product; 70 | } 71 | } 72 | 73 | public string AssemblyCopyright 74 | { 75 | get 76 | { 77 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); 78 | if (attributes.Length == 0) 79 | { 80 | return ""; 81 | } 82 | return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; 83 | } 84 | } 85 | 86 | public string AssemblyCompany 87 | { 88 | get 89 | { 90 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); 91 | if (attributes.Length == 0) 92 | { 93 | return ""; 94 | } 95 | return ((AssemblyCompanyAttribute)attributes[0]).Company; 96 | } 97 | } 98 | #endregion 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /WmiExplorer/Classes/ListViewColumnSorter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Windows.Forms; 3 | 4 | namespace WmiExplorer.Classes 5 | { 6 | // How to sort a ListView control by a column in Visual C# 7 | // http://support.microsoft.com/kb/319401 8 | 9 | internal class ListViewColumnSorter : IComparer 10 | { 11 | /// 12 | /// Specifies the column to be sorted 13 | /// 14 | private int _columnToSort; 15 | 16 | /// 17 | /// Specifies the order in which to sort (i.e. 'Ascending'). 18 | /// 19 | private SortOrder _orderOfSort; 20 | 21 | /// 22 | /// Case insensitive comparer object 23 | /// 24 | private readonly CaseInsensitiveComparer _objectCompare; 25 | 26 | /// 27 | /// Class constructor. Initializes various elements 28 | /// 29 | public ListViewColumnSorter() 30 | { 31 | // Initialize the column to '0' 32 | _columnToSort = 0; 33 | 34 | // Initialize the sort order to 'none' 35 | _orderOfSort = SortOrder.None; 36 | 37 | // Initialize the CaseInsensitiveComparer object 38 | _objectCompare = new CaseInsensitiveComparer(); 39 | } 40 | 41 | /// 42 | /// This method is inherited from the IComparer interface. It compares the two objects passed using a case insensitive comparison. 43 | /// 44 | /// First object to be compared 45 | /// Second object to be compared 46 | /// The result of the comparison. "0" if equal, negative if 'x' is less than 'y' and positive if 'x' is greater than 'y' 47 | public int Compare(object x, object y) 48 | { 49 | // Cast the objects to be compared to ListViewItem objects 50 | ListViewItem listviewX = (ListViewItem)x; 51 | ListViewItem listviewY = (ListViewItem)y; 52 | 53 | // Compare the two items 54 | var compareResult = _objectCompare.Compare(listviewX.SubItems[_columnToSort].Text, listviewY.SubItems[_columnToSort].Text); 55 | 56 | // Calculate correct return value based on object comparison 57 | if (_orderOfSort == SortOrder.Ascending) 58 | { 59 | // Ascending sort is selected, return normal result of compare operation 60 | return compareResult; 61 | } 62 | 63 | if (_orderOfSort == SortOrder.Descending) 64 | { 65 | // Descending sort is selected, return negative result of compare operation 66 | return (-compareResult); 67 | } 68 | 69 | // Return '0' to indicate they are equal 70 | return 0; 71 | } 72 | 73 | /// 74 | /// Gets or sets the number of the column to which to apply the sorting operation (Defaults to '0'). 75 | /// 76 | public int SortColumn 77 | { 78 | set 79 | { 80 | _columnToSort = value; 81 | } 82 | get 83 | { 84 | return _columnToSort; 85 | } 86 | } 87 | 88 | /// 89 | /// Gets or sets the order of sorting to apply (for example, 'Ascending' or 'Descending'). 90 | /// 91 | public SortOrder Order 92 | { 93 | set 94 | { 95 | _orderOfSort = value; 96 | } 97 | get 98 | { 99 | return _orderOfSort; 100 | } 101 | } 102 | } 103 | } -------------------------------------------------------------------------------- /WmiExplorer/Classes/WindowPlacement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | using System.Xml; 6 | using System.Xml.Serialization; 7 | 8 | namespace WmiExplorer.Classes 9 | { 10 | // Reference Link: David Rickard's Blog 11 | // http://blogs.msdn.com/b/davidrickard/archive/2010/03/09/saving-window-size-and-location-in-wpf-and-winforms.aspx 12 | 13 | // POINT structure required by WINDOWPLACEMENT structure 14 | [Serializable] 15 | [StructLayout(LayoutKind.Sequential)] 16 | public struct POINT 17 | { 18 | public int X; 19 | public int Y; 20 | 21 | public POINT(int x, int y) 22 | { 23 | X = x; 24 | Y = y; 25 | } 26 | } 27 | 28 | // RECT structure required by WINDOWPLACEMENT structure 29 | [Serializable] 30 | [StructLayout(LayoutKind.Sequential)] 31 | public struct RECT 32 | { 33 | public int Left; 34 | public int Top; 35 | public int Right; 36 | public int Bottom; 37 | 38 | public RECT(int left, int top, int right, int bottom) 39 | { 40 | Left = left; 41 | Top = top; 42 | Right = right; 43 | Bottom = bottom; 44 | } 45 | } 46 | 47 | // WINDOWPLACEMENT stores the position, size, and state of a window 48 | [Serializable] 49 | [StructLayout(LayoutKind.Sequential)] 50 | public struct WINDOWPLACEMENT 51 | { 52 | public int length; 53 | public int flags; 54 | public int showCmd; 55 | public POINT minPosition; 56 | public POINT maxPosition; 57 | public RECT normalPosition; 58 | } 59 | 60 | internal class WindowPlacement 61 | { 62 | private const int SW_SHOWMINIMIZED = 2; 63 | private const int SW_SHOWNORMAL = 1; 64 | private static readonly Encoding Encoding = new ASCIIEncoding(); 65 | private static readonly XmlSerializer Serializer = new XmlSerializer(typeof(WINDOWPLACEMENT)); 66 | 67 | public static string GetPlacement(IntPtr windowHandle) 68 | { 69 | WINDOWPLACEMENT placement; 70 | NativeMethods.GetWindowPlacement(windowHandle, out placement); 71 | 72 | using (MemoryStream memoryStream = new MemoryStream()) 73 | { 74 | using (XmlTextWriter xmlTextWriter = new XmlTextWriter(memoryStream, Encoding.ASCII)) 75 | { 76 | Serializer.Serialize(xmlTextWriter, placement); 77 | byte[] xmlBytes = memoryStream.ToArray(); 78 | return Encoding.GetString(xmlBytes); 79 | } 80 | } 81 | } 82 | 83 | public static void SetPlacement(IntPtr windowHandle, string placementXml) 84 | { 85 | if (string.IsNullOrEmpty(placementXml)) 86 | { 87 | return; 88 | } 89 | 90 | byte[] xmlBytes = Encoding.GetBytes(placementXml); 91 | 92 | try 93 | { 94 | WINDOWPLACEMENT placement; 95 | using (MemoryStream memoryStream = new MemoryStream(xmlBytes)) 96 | { 97 | placement = (WINDOWPLACEMENT)Serializer.Deserialize(memoryStream); 98 | } 99 | 100 | placement.length = Marshal.SizeOf(typeof(WINDOWPLACEMENT)); 101 | placement.flags = 0; 102 | placement.showCmd = (placement.showCmd == SW_SHOWMINIMIZED ? SW_SHOWNORMAL : placement.showCmd); 103 | NativeMethods.SetWindowPlacement(windowHandle, ref placement); 104 | } 105 | catch (InvalidOperationException) 106 | { 107 | // Parsing placement XML failed. Fail silently. 108 | } 109 | } 110 | } 111 | } -------------------------------------------------------------------------------- /WmiExplorer/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | False 15 | 16 | 17 | True 18 | 19 | 20 | True 21 | 22 | 23 | True 24 | 25 | 26 | False 27 | 28 | 29 | True 30 | 31 | 32 | 60 33 | 34 | 35 | None 36 | 37 | 38 | 1970-01-01 39 | 40 | 41 | 220 42 | 43 | 44 | 200 45 | 46 | 47 | 180 48 | 49 | 50 | 7 51 | 52 | 53 | https://wmie.codeplex.com 54 | 55 | 56 | 57 | 58 | 59 | True 60 | 61 | 62 | True 63 | 64 | 65 | 66 | 67 | 68 | 69 | https://wmie.svn.codeplex.com/svn/wmiexplorer/wmiexplorer/releases.xml 70 | 71 | 72 | http://wmie.azurewebsites.net/releases.xml 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /WmiExplorer/bin/Debug/WMIExplorer.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | False 15 | 16 | 17 | True 18 | 19 | 20 | True 21 | 22 | 23 | True 24 | 25 | 26 | False 27 | 28 | 29 | True 30 | 31 | 32 | 60 33 | 34 | 35 | None 36 | 37 | 38 | 1970-01-01 39 | 40 | 41 | 220 42 | 43 | 44 | 200 45 | 46 | 47 | 180 48 | 49 | 50 | 7 51 | 52 | 53 | https://wmie.codeplex.com 54 | 55 | 56 | 57 | 58 | 59 | True 60 | 61 | 62 | True 63 | 64 | 65 | 66 | 67 | 68 | 69 | https://wmie.svn.codeplex.com/svn/wmiexplorer/wmiexplorer/releases.xml 70 | 71 | 72 | http://wmie.azurewebsites.net/releases.xml 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /WmiExplorer/bin/Release/WMIExplorer.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | False 15 | 16 | 17 | True 18 | 19 | 20 | True 21 | 22 | 23 | True 24 | 25 | 26 | False 27 | 28 | 29 | True 30 | 31 | 32 | 60 33 | 34 | 35 | None 36 | 37 | 38 | 1970-01-01 39 | 40 | 41 | 220 42 | 43 | 44 | 200 45 | 46 | 47 | 180 48 | 49 | 50 | 7 51 | 52 | 53 | https://wmie.codeplex.com 54 | 55 | 56 | 57 | 58 | 59 | True 60 | 61 | 62 | True 63 | 64 | 65 | 66 | 67 | 68 | 69 | https://wmie.svn.codeplex.com/svn/wmiexplorer/wmiexplorer/releases.xml 70 | 71 | 72 | http://wmie.azurewebsites.net/releases.xml 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /WmiExplorer/bin/Debug/WMIExplorer.vshost.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | False 15 | 16 | 17 | True 18 | 19 | 20 | True 21 | 22 | 23 | True 24 | 25 | 26 | False 27 | 28 | 29 | True 30 | 31 | 32 | 60 33 | 34 | 35 | None 36 | 37 | 38 | 1970-01-01 39 | 40 | 41 | 220 42 | 43 | 44 | 200 45 | 46 | 47 | 180 48 | 49 | 50 | 7 51 | 52 | 53 | https://wmie.codeplex.com 54 | 55 | 56 | 57 | 58 | 59 | True 60 | 61 | 62 | True 63 | 64 | 65 | 66 | 67 | 68 | 69 | https://wmie.svn.codeplex.com/svn/wmiexplorer/wmiexplorer/releases.xml 70 | 71 | 72 | http://wmie.azurewebsites.net/releases.xml 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /WmiExplorer/bin/Release/WMIExplorer.vshost.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | False 15 | 16 | 17 | True 18 | 19 | 20 | True 21 | 22 | 23 | True 24 | 25 | 26 | False 27 | 28 | 29 | True 30 | 31 | 32 | 60 33 | 34 | 35 | None 36 | 37 | 38 | 1970-01-01 39 | 40 | 41 | 220 42 | 43 | 44 | 200 45 | 46 | 47 | 180 48 | 49 | 50 | 7 51 | 52 | 53 | https://wmie.codeplex.com 54 | 55 | 56 | 57 | 58 | 59 | True 60 | 61 | 62 | True 63 | 64 | 65 | 66 | 67 | 68 | 69 | https://wmie.svn.codeplex.com/svn/wmiexplorer/wmiexplorer/releases.xml 70 | 71 | 72 | http://wmie.azurewebsites.net/releases.xml 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /WmiExplorer/Forms/Form_ShowMof.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace WmiExplorer 2 | { 3 | sealed partial class Form_ShowMof 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.textBoxShowMOF = new System.Windows.Forms.TextBox(); 32 | this.buttonCloseMof = new System.Windows.Forms.Button(); 33 | this.SuspendLayout(); 34 | // 35 | // textBoxShowMOF 36 | // 37 | this.textBoxShowMOF.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 38 | | System.Windows.Forms.AnchorStyles.Left) 39 | | System.Windows.Forms.AnchorStyles.Right))); 40 | this.textBoxShowMOF.BackColor = System.Drawing.SystemColors.Control; 41 | this.textBoxShowMOF.ImeMode = System.Windows.Forms.ImeMode.Off; 42 | this.textBoxShowMOF.Location = new System.Drawing.Point(12, 13); 43 | this.textBoxShowMOF.Multiline = true; 44 | this.textBoxShowMOF.Name = "textBoxShowMOF"; 45 | this.textBoxShowMOF.ReadOnly = true; 46 | this.textBoxShowMOF.ScrollBars = System.Windows.Forms.ScrollBars.Both; 47 | this.textBoxShowMOF.Size = new System.Drawing.Size(510, 253); 48 | this.textBoxShowMOF.TabIndex = 0; 49 | this.textBoxShowMOF.TabStop = false; 50 | this.textBoxShowMOF.WordWrap = false; 51 | // 52 | // buttonCloseMof 53 | // 54 | this.buttonCloseMof.Anchor = System.Windows.Forms.AnchorStyles.Bottom; 55 | this.buttonCloseMof.DialogResult = System.Windows.Forms.DialogResult.Cancel; 56 | this.buttonCloseMof.Location = new System.Drawing.Point(227, 274); 57 | this.buttonCloseMof.Name = "buttonCloseMof"; 58 | this.buttonCloseMof.Size = new System.Drawing.Size(75, 25); 59 | this.buttonCloseMof.TabIndex = 1; 60 | this.buttonCloseMof.Text = "Close"; 61 | this.buttonCloseMof.UseVisualStyleBackColor = true; 62 | this.buttonCloseMof.Click += new System.EventHandler(this.buttonCloseMOF_Click); 63 | // 64 | // Form_ShowMof 65 | // 66 | this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); 67 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; 68 | this.BackColor = System.Drawing.SystemColors.Control; 69 | this.CancelButton = this.buttonCloseMof; 70 | this.ClientSize = new System.Drawing.Size(534, 311); 71 | this.Controls.Add(this.buttonCloseMof); 72 | this.Controls.Add(this.textBoxShowMOF); 73 | this.Name = "Form_ShowMof"; 74 | this.ShowIcon = false; 75 | this.ShowInTaskbar = false; 76 | this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show; 77 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 78 | this.Text = "MOF"; 79 | this.ResumeLayout(false); 80 | this.PerformLayout(); 81 | 82 | } 83 | 84 | #endregion 85 | 86 | private System.Windows.Forms.TextBox textBoxShowMOF; 87 | private System.Windows.Forms.Button buttonCloseMof; 88 | } 89 | } -------------------------------------------------------------------------------- /WmiExplorer/Forms/Form_Update.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace WmiExplorer.Forms 2 | { 3 | partial class Form_Update 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.richTextBoxUpdate = new System.Windows.Forms.RichTextBox(); 32 | this.buttonCancelHidden = new System.Windows.Forms.Button(); 33 | this.SuspendLayout(); 34 | // 35 | // richTextBoxUpdate 36 | // 37 | this.richTextBoxUpdate.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 38 | | System.Windows.Forms.AnchorStyles.Left) 39 | | System.Windows.Forms.AnchorStyles.Right))); 40 | this.richTextBoxUpdate.BorderStyle = System.Windows.Forms.BorderStyle.None; 41 | this.richTextBoxUpdate.Cursor = System.Windows.Forms.Cursors.IBeam; 42 | this.richTextBoxUpdate.Location = new System.Drawing.Point(12, 12); 43 | this.richTextBoxUpdate.Name = "richTextBoxUpdate"; 44 | this.richTextBoxUpdate.ReadOnly = true; 45 | this.richTextBoxUpdate.Size = new System.Drawing.Size(471, 156); 46 | this.richTextBoxUpdate.TabIndex = 0; 47 | this.richTextBoxUpdate.Text = ""; 48 | this.richTextBoxUpdate.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.richTextBoxUpdate_LinkClicked); 49 | // 50 | // buttonCancelHidden 51 | // 52 | this.buttonCancelHidden.Anchor = System.Windows.Forms.AnchorStyles.Bottom; 53 | this.buttonCancelHidden.DialogResult = System.Windows.Forms.DialogResult.Cancel; 54 | this.buttonCancelHidden.Location = new System.Drawing.Point(193, 174); 55 | this.buttonCancelHidden.Name = "buttonCancelHidden"; 56 | this.buttonCancelHidden.Size = new System.Drawing.Size(100, 25); 57 | this.buttonCancelHidden.TabIndex = 1; 58 | this.buttonCancelHidden.Text = "OK"; 59 | this.buttonCancelHidden.UseVisualStyleBackColor = true; 60 | this.buttonCancelHidden.Click += new System.EventHandler(this.button1_Click); 61 | // 62 | // Form_Update 63 | // 64 | this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); 65 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; 66 | this.AutoSize = true; 67 | this.CancelButton = this.buttonCancelHidden; 68 | this.ClientSize = new System.Drawing.Size(484, 211); 69 | this.Controls.Add(this.richTextBoxUpdate); 70 | this.Controls.Add(this.buttonCancelHidden); 71 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 72 | this.MaximizeBox = false; 73 | this.MinimizeBox = false; 74 | this.Name = "Form_Update"; 75 | this.ShowInTaskbar = false; 76 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 77 | this.Text = "WMI Explorer Update"; 78 | this.ResumeLayout(false); 79 | 80 | } 81 | 82 | #endregion 83 | 84 | private System.Windows.Forms.RichTextBox richTextBoxUpdate; 85 | private System.Windows.Forms.Button buttonCancelHidden; 86 | } 87 | } -------------------------------------------------------------------------------- /WmiExplorer/Forms/Form_DisplayText.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace WmiExplorer.Forms 2 | { 3 | partial class Form_DisplayText 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.buttonOk = new System.Windows.Forms.Button(); 32 | this.richTextBox = new System.Windows.Forms.RichTextBox(); 33 | this.labelCaption = new System.Windows.Forms.Label(); 34 | this.SuspendLayout(); 35 | // 36 | // buttonOk 37 | // 38 | this.buttonOk.Anchor = System.Windows.Forms.AnchorStyles.Bottom; 39 | this.buttonOk.DialogResult = System.Windows.Forms.DialogResult.Cancel; 40 | this.buttonOk.Location = new System.Drawing.Point(194, 249); 41 | this.buttonOk.Name = "buttonOk"; 42 | this.buttonOk.Size = new System.Drawing.Size(100, 25); 43 | this.buttonOk.TabIndex = 2; 44 | this.buttonOk.Text = "OK"; 45 | this.buttonOk.UseVisualStyleBackColor = true; 46 | this.buttonOk.Click += new System.EventHandler(this.buttonOk_Click); 47 | // 48 | // richTextBox 49 | // 50 | this.richTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 51 | | System.Windows.Forms.AnchorStyles.Left) 52 | | System.Windows.Forms.AnchorStyles.Right))); 53 | this.richTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; 54 | this.richTextBox.Location = new System.Drawing.Point(12, 49); 55 | this.richTextBox.Name = "richTextBox"; 56 | this.richTextBox.ReadOnly = true; 57 | this.richTextBox.Size = new System.Drawing.Size(470, 194); 58 | this.richTextBox.TabIndex = 3; 59 | this.richTextBox.Text = ""; 60 | this.richTextBox.WordWrap = false; 61 | // 62 | // labelCaption 63 | // 64 | this.labelCaption.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 65 | | System.Windows.Forms.AnchorStyles.Right))); 66 | this.labelCaption.BackColor = System.Drawing.Color.LightSteelBlue; 67 | this.labelCaption.Location = new System.Drawing.Point(0, 0); 68 | this.labelCaption.Name = "labelCaption"; 69 | this.labelCaption.Padding = new System.Windows.Forms.Padding(5); 70 | this.labelCaption.Size = new System.Drawing.Size(488, 35); 71 | this.labelCaption.TabIndex = 5; 72 | this.labelCaption.Text = "Title"; 73 | this.labelCaption.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 74 | // 75 | // Form_DisplayText 76 | // 77 | this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); 78 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; 79 | this.CancelButton = this.buttonOk; 80 | this.ClientSize = new System.Drawing.Size(484, 286); 81 | this.Controls.Add(this.labelCaption); 82 | this.Controls.Add(this.richTextBox); 83 | this.Controls.Add(this.buttonOk); 84 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; 85 | this.Name = "Form_DisplayText"; 86 | this.ShowIcon = false; 87 | this.ShowInTaskbar = false; 88 | this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show; 89 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 90 | this.Text = "Form_DisplayText"; 91 | this.ResumeLayout(false); 92 | 93 | } 94 | 95 | #endregion 96 | 97 | private System.Windows.Forms.Button buttonOk; 98 | private System.Windows.Forms.RichTextBox richTextBox; 99 | private System.Windows.Forms.Label labelCaption; 100 | } 101 | } -------------------------------------------------------------------------------- /WmiExplorer/Classes/ObserverHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Management; 4 | using System.Runtime.Caching; 5 | using System.Windows.Forms; 6 | 7 | namespace WmiExplorer.Classes 8 | { 9 | internal class ObserverHandler 10 | { 11 | private readonly bool _isClass; 12 | private readonly bool _isNamespace; 13 | private readonly Stopwatch _stopwatch = new Stopwatch(); 14 | private readonly WmiClass _wmiClass; 15 | private readonly WmiNamespace _wmiNamespace; 16 | 17 | /// 18 | /// Constructor for observer working on retrieving classes for a Namespace 19 | /// 20 | /// Instance of WmiNamespace for which to enumerate classes 21 | public ObserverHandler(WmiNamespace wmiNamespace) 22 | { 23 | _wmiNamespace = wmiNamespace; 24 | _wmiNamespace.IsEnumerating = true; 25 | _isNamespace = true; 26 | _stopwatch.Start(); 27 | } 28 | 29 | /// 30 | /// Constructor for observer working on retrieving instances for a Class 31 | /// 32 | /// Instance of WmiClass for which to enumerate instances 33 | public ObserverHandler(WmiClass wmiClass) 34 | { 35 | _wmiClass = wmiClass; 36 | _wmiClass.IsEnumerating = true; 37 | _isClass = true; 38 | _stopwatch.Start(); 39 | } 40 | 41 | public bool IsComplete { get; private set; } 42 | 43 | public void Done(object sender, CompletedEventArgs e) 44 | { 45 | _stopwatch.Stop(); 46 | 47 | if (_isNamespace) 48 | { 49 | if (e.Status == ManagementStatus.CallCanceled) 50 | { 51 | _wmiNamespace.IsPartiallyEnumerated = true; 52 | _wmiNamespace.IsEnumerationCancelled = true; 53 | } 54 | else 55 | { 56 | _wmiNamespace.IsPartiallyEnumerated = false; 57 | _wmiNamespace.IsEnumerationCancelled = false; 58 | } 59 | 60 | _wmiNamespace.IsEnumerated = true; 61 | _wmiNamespace.IsEnumerating = false; 62 | _wmiNamespace.EnumerationStatus = e.Status.ToString(); 63 | _wmiNamespace.EnumTime = DateTime.Now; 64 | _wmiNamespace.EnumTimeElapsed = _stopwatch.Elapsed; 65 | 66 | CacheItem ci = new CacheItem(_wmiNamespace.Path, _wmiNamespace.Classes); 67 | WmiExplorer.AppCache.Set(ci, WmiExplorer.CachePolicy); 68 | _wmiNamespace.ResetClasses(); 69 | } 70 | 71 | if (_isClass) 72 | { 73 | if (e.Status == ManagementStatus.CallCanceled) 74 | { 75 | _wmiClass.IsPartiallyEnumerated = true; 76 | _wmiClass.IsEnumerationCancelled = true; 77 | } 78 | else 79 | { 80 | _wmiClass.IsPartiallyEnumerated = false; 81 | _wmiClass.IsEnumerationCancelled = false; 82 | } 83 | 84 | _wmiClass.IsEnumerated = true; 85 | _wmiClass.IsEnumerating = false; 86 | _wmiClass.IsEnumerationCancelled = false; 87 | _wmiClass.EnumerationStatus = e.Status.ToString(); 88 | _wmiClass.EnumTime = DateTime.Now; 89 | _wmiClass.EnumTimeElapsed = _stopwatch.Elapsed; 90 | 91 | CacheItem ci = new CacheItem(_wmiClass.Path, _wmiClass.Instances); 92 | WmiExplorer.AppCache.Set(ci, WmiExplorer.CachePolicy); 93 | _wmiClass.ResetInstances(); 94 | } 95 | 96 | IsComplete = true; 97 | } 98 | 99 | public void NewObject(object sender, ObjectReadyEventArgs e) 100 | { 101 | ManagementObject mObject = (ManagementObject)e.NewObject; 102 | 103 | if (mObject.Path.IsClass && _isNamespace) 104 | { 105 | WmiClass wmiClass = new WmiClass(mObject as ManagementClass); 106 | 107 | ListViewItem li = new ListViewItem 108 | { 109 | Name = wmiClass.Path, 110 | Text = wmiClass.DisplayName, 111 | ToolTipText = wmiClass.Description, 112 | Tag = wmiClass 113 | }; 114 | 115 | // Add Lazy Properties, Description, and Path columns 116 | li.SubItems.Add(wmiClass.HasLazyProperties.ToString()); 117 | li.SubItems.Add(wmiClass.Description); 118 | li.SubItems.Add(wmiClass.Path); 119 | 120 | _wmiNamespace.AddClass(li); 121 | } 122 | 123 | if (mObject.Path.IsInstance && _isClass) 124 | { 125 | WmiInstance wmiInstance = new WmiInstance(mObject); 126 | 127 | ListViewItem li = new ListViewItem 128 | { 129 | Name = wmiInstance.Path, 130 | Text = wmiInstance.RelativePath, 131 | ToolTipText = wmiInstance.RelativePath, 132 | Tag = wmiInstance 133 | }; 134 | 135 | _wmiClass.AddInstance(li); 136 | } 137 | } 138 | } 139 | } -------------------------------------------------------------------------------- /WmiExplorer/Classes/ListViewExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Windows.Forms; 4 | 5 | // ReSharper disable InconsistentNaming 6 | // ReSharper disable UnusedMember.Local 7 | 8 | namespace WmiExplorer.Classes 9 | { 10 | // Sort listview Columns and Set Sort Arrow Icon on Column Header 11 | // http://www.codeproject.com/Tips/734463/Sort-listview-Columns-and-Set-Sort-Arrow-Icon-on-C 12 | internal static class ListViewExtensions 13 | { 14 | [StructLayout(LayoutKind.Sequential)] 15 | public struct LVCOLUMN 16 | { 17 | public Int32 mask; 18 | public Int32 cx; 19 | 20 | [MarshalAs(UnmanagedType.LPTStr)] 21 | public string pszText; 22 | 23 | public IntPtr hbm; 24 | public Int32 cchTextMax; 25 | public Int32 fmt; 26 | public Int32 iSubItem; 27 | public Int32 iImage; 28 | public Int32 iOrder; 29 | } 30 | 31 | private const Int32 HDI_WIDTH = 0x0001; 32 | private const Int32 HDI_HEIGHT = HDI_WIDTH; 33 | private const Int32 HDI_TEXT = 0x0002; 34 | private const Int32 HDI_FORMAT = 0x0004; 35 | private const Int32 HDI_LPARAM = 0x0008; 36 | private const Int32 HDI_BITMAP = 0x0010; 37 | private const Int32 HDI_IMAGE = 0x0020; 38 | private const Int32 HDI_DI_SETITEM = 0x0040; 39 | private const Int32 HDI_ORDER = 0x0080; 40 | private const Int32 HDI_FILTER = 0x0100; 41 | 42 | private const Int32 HDF_LEFT = 0x0000; 43 | private const Int32 HDF_RIGHT = 0x0001; 44 | private const Int32 HDF_CENTER = 0x0002; 45 | private const Int32 HDF_JUSTIFYMASK = 0x0003; 46 | private const Int32 HDF_RTLREADING = 0x0004; 47 | private const Int32 HDF_OWNERDRAW = 0x8000; 48 | private const Int32 HDF_STRING = 0x4000; 49 | private const Int32 HDF_BITMAP = 0x2000; 50 | private const Int32 HDF_BITMAP_ON_RIGHT = 0x1000; 51 | private const Int32 HDF_IMAGE = 0x0800; 52 | private const Int32 HDF_SORTUP = 0x0400; 53 | private const Int32 HDF_SORTDOWN = 0x0200; 54 | 55 | private const Int32 LVM_FIRST = 0x1000; // List messages 56 | private const Int32 LVM_GETHEADER = LVM_FIRST + 31; 57 | private const Int32 HDM_FIRST = 0x1200; // Header messages 58 | private const Int32 HDM_SETIMAGELIST = HDM_FIRST + 8; 59 | private const Int32 HDM_GETIMAGELIST = HDM_FIRST + 9; 60 | private const Int32 HDM_GETITEM = HDM_FIRST + 11; 61 | private const Int32 HDM_SETITEM = HDM_FIRST + 12; 62 | 63 | //This method is used to set arrow icon 64 | public static void SetSortIcon(this ListView listView, int columnIndex, SortOrder order) 65 | { 66 | IntPtr columnHeader = NativeMethods.SendMessage(listView.Handle, LVM_GETHEADER, IntPtr.Zero, IntPtr.Zero); 67 | 68 | for (int columnNumber = 0; columnNumber <= listView.Columns.Count - 1; columnNumber++) 69 | { 70 | IntPtr columnPtr = new IntPtr(columnNumber); 71 | LVCOLUMN lvColumn = new LVCOLUMN(); 72 | lvColumn.mask = HDI_FORMAT; 73 | 74 | NativeMethods.SendMessageLVCOLUMN(columnHeader, HDM_GETITEM, columnPtr, ref lvColumn); 75 | 76 | if (!(order == SortOrder.None) && columnNumber == columnIndex) 77 | { 78 | switch (order) 79 | { 80 | case SortOrder.Ascending: 81 | lvColumn.fmt &= ~HDF_SORTDOWN; 82 | lvColumn.fmt |= HDF_SORTUP; 83 | break; 84 | 85 | case SortOrder.Descending: 86 | lvColumn.fmt &= ~HDF_SORTUP; 87 | lvColumn.fmt |= HDF_SORTDOWN; 88 | break; 89 | } 90 | lvColumn.fmt |= (HDF_LEFT | HDF_BITMAP_ON_RIGHT); 91 | } 92 | else 93 | { 94 | lvColumn.fmt &= ~HDF_SORTDOWN & ~HDF_SORTUP & ~HDF_BITMAP_ON_RIGHT; 95 | } 96 | 97 | NativeMethods.SendMessageLVCOLUMN(columnHeader, HDM_SETITEM, columnPtr, ref lvColumn); 98 | } 99 | } 100 | 101 | // Reference link: 102 | // http://stackoverflow.com/questions/14133225/listview-autoresizecolumns-based-on-both-column-content-and-header 103 | // Reference link 104 | public static void ResizeColumns(this ListView lv) 105 | { 106 | //lv.AutoResizeColumns(lv.Items.Count > 0 107 | // ? ColumnHeaderAutoResizeStyle.ColumnContent 108 | // : ColumnHeaderAutoResizeStyle.HeaderSize); 109 | 110 | lv.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); 111 | lv.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); 112 | 113 | //lv.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); 114 | //ListView.ColumnHeaderCollection cc = lv.Columns; 115 | //for (int i = 0; i < cc.Count; i++) 116 | //{ 117 | // int colWidth = TextRenderer.MeasureText(cc[i].Text, lv.Font).Width + 10; 118 | // if (colWidth > cc[i].Width) 119 | // { 120 | // cc[i].Width = colWidth; 121 | // } 122 | //} 123 | } 124 | } 125 | } 126 | 127 | // ReSharper restore InconsistentNaming 128 | // ReSharper restore UnusedMember.Local -------------------------------------------------------------------------------- /WmiExplorer/Classes/WmiClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Management; 5 | using System.Windows.Forms; 6 | 7 | namespace WmiExplorer.Classes 8 | { 9 | internal class WmiClass 10 | { 11 | public List Instances = new List(); 12 | private string _description; 13 | private string _displayName; 14 | private string _enumerationStatus; 15 | private DateTime _enumTime; 16 | private TimeSpan _enumTimeElapsed; 17 | private bool _hasLazyProperties; 18 | private string _instanceFilterQuick; 19 | private string _namespacePath; 20 | private string _path; 21 | private string _relativePath; 22 | 23 | public WmiClass(ManagementClass actualClass) 24 | { 25 | Class = actualClass; 26 | } 27 | 28 | public ManagementClass Class { get; set; } 29 | 30 | public string Description 31 | { 32 | get 33 | { 34 | try 35 | { 36 | foreach (QualifierData q in from QualifierData q in Class.Qualifiers where q.Name.Equals("Description", StringComparison.CurrentCultureIgnoreCase) select q) 37 | { 38 | _description = Class.GetQualifierValue("Description").ToString(); 39 | } 40 | } 41 | catch (ManagementException ex) 42 | { 43 | if ((ex.ErrorCode).ToString() == "NotFound") 44 | _description = String.Empty; 45 | else 46 | _description = "Error getting Class Description"; 47 | } 48 | 49 | return _description; 50 | } 51 | } 52 | 53 | public string DisplayName 54 | { 55 | get 56 | { 57 | if (_displayName == null) 58 | _displayName = Class.ClassPath.ClassName; 59 | 60 | return _displayName; 61 | } 62 | set { _displayName = value; } 63 | } 64 | 65 | public string EnumerationStatus 66 | { 67 | get 68 | { 69 | if (String.IsNullOrEmpty(_enumerationStatus)) 70 | _enumerationStatus = "NoError"; 71 | 72 | return _enumerationStatus; 73 | } 74 | set { _enumerationStatus = value; } 75 | } 76 | 77 | public DateTime EnumTime 78 | { 79 | get { return _enumTime; } 80 | set { _enumTime = value; } 81 | } 82 | 83 | public TimeSpan EnumTimeElapsed 84 | { 85 | get { return _enumTimeElapsed; } 86 | set { _enumTimeElapsed = value; } 87 | } 88 | 89 | public bool HasLazyProperties 90 | { 91 | get 92 | { 93 | foreach (PropertyData pd in Class.Properties) 94 | { 95 | foreach (QualifierData qd in pd.Qualifiers) 96 | { 97 | if (qd.Name.Equals("lazy", StringComparison.CurrentCultureIgnoreCase)) 98 | { 99 | _hasLazyProperties = true; 100 | return _hasLazyProperties; 101 | } 102 | } 103 | } 104 | 105 | return _hasLazyProperties; 106 | } 107 | } 108 | 109 | public int InstanceCount { get; set; } 110 | 111 | public string InstanceFilterQuick 112 | { 113 | get 114 | { 115 | if (_instanceFilterQuick == null) 116 | _instanceFilterQuick = String.Empty; 117 | 118 | return _instanceFilterQuick; 119 | } 120 | set { _instanceFilterQuick = value; } 121 | } 122 | 123 | // Indicates if class has instances enumerated 124 | public bool IsEnumerated { get; set; } 125 | 126 | // Indicates if class is currently being enumerated 127 | public bool IsEnumerating { get; set; } 128 | 129 | // Indicates if cancellation is requested for this class. 130 | public bool IsEnumerationCancelled { get; set; } 131 | 132 | // Indicates if class has instances partially enumerated. This can occur if user cancels operation. 133 | public bool IsPartiallyEnumerated { get; set; } 134 | 135 | public string NamespacePath 136 | { 137 | get 138 | { 139 | if (_namespacePath == null) 140 | _namespacePath = Class.Scope.Path.Path; 141 | 142 | return _namespacePath; 143 | } 144 | } 145 | 146 | public string Path 147 | { 148 | get 149 | { 150 | if (_path == null) 151 | _path = Class.Path.Path; 152 | return _path; 153 | } 154 | } 155 | 156 | public string RelativePath 157 | { 158 | get 159 | { 160 | if (_relativePath == null) 161 | _relativePath = Class.Path.RelativePath; 162 | 163 | return _relativePath; 164 | } 165 | } 166 | 167 | public void AddInstance(ListViewItem listItemInstance) 168 | { 169 | Instances.Add(listItemInstance); 170 | } 171 | 172 | public string GetClassMof(bool bAmended = false) 173 | { 174 | Class.Options.UseAmendedQualifiers = bAmended; 175 | Class.Get(); 176 | return Class.GetText(TextFormat.Mof).Replace("\n", "\r\n"); 177 | } 178 | 179 | public void ResetInstances() 180 | { 181 | InstanceCount = Instances.Count; 182 | Instances = new List(); 183 | } 184 | } 185 | } -------------------------------------------------------------------------------- /WmiExplorer/Forms/Form_ConnectAs.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /WmiExplorer/Forms/Form_Settings.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /WmiExplorer/Forms/Form_ShowMof.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /WmiExplorer/Forms/Form_Update.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /WmiExplorer/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /WmiExplorer/Forms/Form_DisplayText.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /WmiExplorer/Forms/Form_ExecMethod.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | -------------------------------------------------------------------------------- /WmiExplorer/Classes/WmiNamespace.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Management; 4 | using System.Windows.Forms; 5 | 6 | namespace WmiExplorer.Classes 7 | { 8 | internal class WmiNamespace 9 | { 10 | public int ClassCount = 0; 11 | public List Classes = new List(); 12 | private readonly ManagementObject _wmiNamespace; 13 | private string _classFilter; // Class Filter for current namespace 14 | private string _classFilterQuick; // Quick Filter for current namespace 15 | private string _displayName; // Display Name of the current namespace 16 | private string _enumerationStatus; // Class Enumeration status of current namespace 17 | private DateTime _enumTime; // Enumeration Time of current namespace 18 | private TimeSpan _enumTimeElapsed; // Time taken to enumerate classes for current namespace 19 | private bool _isRootNode; // Indicates if current namespace is the root node 20 | private string _path; // Path of the current namespace 21 | private string _relativePath; // Relative Path of current namespace 22 | private string _serverName; // Server name 23 | 24 | public WmiNamespace(ManagementObject actualNamespace) 25 | { 26 | _wmiNamespace = actualNamespace; 27 | } 28 | 29 | public string ClassFilter 30 | { 31 | get 32 | { 33 | if (_classFilter == null) 34 | _classFilter = "%"; 35 | 36 | return _classFilter; 37 | } 38 | set { _classFilter = value; } 39 | } 40 | 41 | public string ClassFilterQuick 42 | { 43 | get 44 | { 45 | if (_classFilterQuick == null) 46 | _classFilterQuick = String.Empty; 47 | 48 | return _classFilterQuick; 49 | } 50 | set { _classFilterQuick = value; } 51 | } 52 | 53 | public string DisplayName 54 | { 55 | get 56 | { 57 | if (_displayName == null) 58 | { 59 | if (IsRootNode) 60 | _displayName = _wmiNamespace.Scope.Path.Path.ToUpper(); 61 | else 62 | _displayName = RelativePath; 63 | } 64 | return _displayName; 65 | } 66 | set { _displayName = value; } 67 | } 68 | 69 | public string EnumerationStatus 70 | { 71 | get 72 | { 73 | if (String.IsNullOrEmpty(_enumerationStatus)) 74 | _enumerationStatus = "NoError"; 75 | 76 | return _enumerationStatus; 77 | } 78 | set { _enumerationStatus = value; } 79 | } 80 | 81 | public DateTime EnumTime 82 | { 83 | get { return _enumTime; } 84 | set { _enumTime = value; } 85 | } 86 | 87 | public TimeSpan EnumTimeElapsed 88 | { 89 | get { return _enumTimeElapsed; } 90 | set { _enumTimeElapsed = value; } 91 | } 92 | 93 | // Indicates if current namespace has classes enumerated 94 | public bool IsEnumerated { get; set; } 95 | 96 | // Indicates if current namespace is currently being enumerated 97 | public bool IsEnumerating { get; set; } 98 | 99 | // Indicates if cancellation is requested for this namespace. 100 | public bool IsEnumerationCancelled { get; set; } 101 | 102 | // Indicates if current namespace has classes partially enumerated. This can occur if user cancels operation. 103 | public bool IsPartiallyEnumerated { get; set; } 104 | 105 | public bool IsRootNode 106 | { 107 | get 108 | { 109 | // Namespace in root node has Path.Path set to Empty string 110 | if (String.IsNullOrEmpty(_wmiNamespace.Path.Path)) 111 | _isRootNode = true; 112 | else 113 | _isRootNode = false; 114 | 115 | return _isRootNode; 116 | } 117 | } 118 | 119 | public string Path 120 | { 121 | get 122 | { 123 | if (_path == null) 124 | { 125 | if (IsRootNode) 126 | _path = _wmiNamespace.Scope.Path.Path.ToUpper(); 127 | else 128 | _path = "\\\\" + _wmiNamespace.Path.Server + "\\" + _wmiNamespace.GetPropertyValue("__Namespace") + "\\" + _wmiNamespace.GetPropertyValue("Name"); 129 | } 130 | return _path; 131 | } 132 | } 133 | 134 | public string RelativePath 135 | { 136 | get 137 | { 138 | if (_relativePath == null) 139 | { 140 | if (IsRootNode) 141 | _relativePath = _wmiNamespace.Scope.Path.NamespacePath.ToUpper(); 142 | else 143 | _relativePath = _wmiNamespace.GetPropertyValue("__NAMESPACE") + "\\" + _wmiNamespace.GetPropertyValue("Name"); 144 | } 145 | return _relativePath; 146 | } 147 | } 148 | 149 | public string ServerName 150 | { 151 | get 152 | { 153 | if (_serverName == null) 154 | _serverName = _wmiNamespace.Scope.Path.Server; 155 | 156 | return _serverName; 157 | } 158 | set { _serverName = value; } 159 | } 160 | 161 | /// 162 | /// Adds new list item to _classes. Called by ObserverHandler when NewObject arrives. 163 | /// 164 | /// 165 | public void AddClass(ListViewItem listItemClass) 166 | { 167 | Classes.Add(listItemClass); 168 | } 169 | 170 | /// 171 | /// Resets contents of _classes 172 | /// 173 | public void ResetClasses() 174 | { 175 | ClassCount = Classes.Count; 176 | Classes = new List(); 177 | } 178 | } 179 | } -------------------------------------------------------------------------------- /WmiExplorer/Forms/Form_ConnectAs.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace WmiExplorer.Forms 2 | { 3 | partial class Form_ConnectAs 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.buttonCancel = new System.Windows.Forms.Button(); 32 | this.buttonConnect = new System.Windows.Forms.Button(); 33 | this.labelPassword = new System.Windows.Forms.Label(); 34 | this.textBoxPassword = new System.Windows.Forms.TextBox(); 35 | this.labelUsername = new System.Windows.Forms.Label(); 36 | this.textBoxUsername = new System.Windows.Forms.TextBox(); 37 | this.labelPath = new System.Windows.Forms.Label(); 38 | this.textBoxPath = new System.Windows.Forms.TextBox(); 39 | this.labelDescription = new System.Windows.Forms.Label(); 40 | this.SuspendLayout(); 41 | // 42 | // buttonCancel 43 | // 44 | this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; 45 | this.buttonCancel.Location = new System.Drawing.Point(15, 178); 46 | this.buttonCancel.Margin = new System.Windows.Forms.Padding(10); 47 | this.buttonCancel.Name = "buttonCancel"; 48 | this.buttonCancel.Size = new System.Drawing.Size(108, 23); 49 | this.buttonCancel.TabIndex = 4; 50 | this.buttonCancel.Text = "Cancel"; 51 | this.buttonCancel.UseVisualStyleBackColor = true; 52 | this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); 53 | // 54 | // buttonConnect 55 | // 56 | this.buttonConnect.Location = new System.Drawing.Point(259, 178); 57 | this.buttonConnect.Margin = new System.Windows.Forms.Padding(10); 58 | this.buttonConnect.Name = "buttonConnect"; 59 | this.buttonConnect.Size = new System.Drawing.Size(113, 23); 60 | this.buttonConnect.TabIndex = 3; 61 | this.buttonConnect.Text = "Connect"; 62 | this.buttonConnect.UseVisualStyleBackColor = true; 63 | this.buttonConnect.Click += new System.EventHandler(this.buttonOk_Click); 64 | // 65 | // labelPassword 66 | // 67 | this.labelPassword.AutoSize = true; 68 | this.labelPassword.Location = new System.Drawing.Point(12, 129); 69 | this.labelPassword.Name = "labelPassword"; 70 | this.labelPassword.Size = new System.Drawing.Size(56, 13); 71 | this.labelPassword.TabIndex = 18; 72 | this.labelPassword.Text = "Password:"; 73 | // 74 | // textBoxPassword 75 | // 76 | this.textBoxPassword.Location = new System.Drawing.Point(15, 146); 77 | this.textBoxPassword.Name = "textBoxPassword"; 78 | this.textBoxPassword.Size = new System.Drawing.Size(357, 20); 79 | this.textBoxPassword.TabIndex = 2; 80 | this.textBoxPassword.UseSystemPasswordChar = true; 81 | // 82 | // labelUsername 83 | // 84 | this.labelUsername.AutoSize = true; 85 | this.labelUsername.Location = new System.Drawing.Point(12, 86); 86 | this.labelUsername.Name = "labelUsername"; 87 | this.labelUsername.Size = new System.Drawing.Size(169, 13); 88 | this.labelUsername.TabIndex = 16; 89 | this.labelUsername.Text = "Username (DOMAIN\\User format):"; 90 | // 91 | // textBoxUsername 92 | // 93 | this.textBoxUsername.Location = new System.Drawing.Point(15, 103); 94 | this.textBoxUsername.Name = "textBoxUsername"; 95 | this.textBoxUsername.Size = new System.Drawing.Size(357, 20); 96 | this.textBoxUsername.TabIndex = 1; 97 | // 98 | // labelPath 99 | // 100 | this.labelPath.AutoSize = true; 101 | this.labelPath.Location = new System.Drawing.Point(12, 43); 102 | this.labelPath.Name = "labelPath"; 103 | this.labelPath.Size = new System.Drawing.Size(122, 13); 104 | this.labelPath.TabIndex = 14; 105 | this.labelPath.Text = "Remote Computer/Path:"; 106 | // 107 | // textBoxPath 108 | // 109 | this.textBoxPath.Location = new System.Drawing.Point(15, 60); 110 | this.textBoxPath.Name = "textBoxPath"; 111 | this.textBoxPath.Size = new System.Drawing.Size(357, 20); 112 | this.textBoxPath.TabIndex = 0; 113 | // 114 | // labelDescription 115 | // 116 | this.labelDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 117 | | System.Windows.Forms.AnchorStyles.Right))); 118 | this.labelDescription.Location = new System.Drawing.Point(12, 9); 119 | this.labelDescription.Name = "labelDescription"; 120 | this.labelDescription.Size = new System.Drawing.Size(360, 36); 121 | this.labelDescription.TabIndex = 5; 122 | this.labelDescription.Text = "Connect to a remote computer/path using Alternate Credentials. Alternate Credenti" + 123 | "als can only be used for remote connections."; 124 | // 125 | // Form_ConnectAs 126 | // 127 | this.AcceptButton = this.buttonConnect; 128 | this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); 129 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; 130 | this.AutoSize = true; 131 | this.CancelButton = this.buttonCancel; 132 | this.ClientSize = new System.Drawing.Size(384, 211); 133 | this.ControlBox = false; 134 | this.Controls.Add(this.buttonConnect); 135 | this.Controls.Add(this.buttonCancel); 136 | this.Controls.Add(this.textBoxPassword); 137 | this.Controls.Add(this.labelPassword); 138 | this.Controls.Add(this.textBoxUsername); 139 | this.Controls.Add(this.labelUsername); 140 | this.Controls.Add(this.textBoxPath); 141 | this.Controls.Add(this.labelPath); 142 | this.Controls.Add(this.labelDescription); 143 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 144 | this.MinimizeBox = false; 145 | this.Name = "Form_ConnectAs"; 146 | this.ShowIcon = false; 147 | this.ShowInTaskbar = false; 148 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 149 | this.Text = "Connect As..."; 150 | this.ResumeLayout(false); 151 | this.PerformLayout(); 152 | 153 | } 154 | 155 | #endregion 156 | 157 | private System.Windows.Forms.Button buttonCancel; 158 | private System.Windows.Forms.Button buttonConnect; 159 | private System.Windows.Forms.Label labelPassword; 160 | private System.Windows.Forms.TextBox textBoxPassword; 161 | private System.Windows.Forms.Label labelUsername; 162 | private System.Windows.Forms.TextBox textBoxUsername; 163 | private System.Windows.Forms.Label labelPath; 164 | private System.Windows.Forms.TextBox textBoxPath; 165 | private System.Windows.Forms.Label labelDescription; 166 | 167 | 168 | } 169 | } -------------------------------------------------------------------------------- /WmiExplorer/Classes/ManagementBaseObjectPropertyDescriptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Management; 4 | 5 | namespace WmiExplorer.Classes 6 | { 7 | /// 8 | /// Required for Implementation of ICustomTypeDescriptor 9 | /// Reference Links and Tutorials: 10 | /// http://www.codeproject.com/Articles/539202/CIMTool-for-Windows-Management-Instrumentation-Par 11 | /// http://www.codeproject.com/Articles/4448/Customized-display-of-collection-data-in-a-Propert 12 | /// http://msdn.microsoft.com/en-us/magazine/cc163816.aspx 13 | /// 14 | [TypeConverter(typeof(ManagementBaseObjectWConverter))] 15 | internal class ManagementBaseObjectPropertyDescriptor : PropertyDescriptor 16 | { 17 | protected string category; 18 | private readonly PropertyData _property; 19 | private readonly ManagementBaseObjectW _wrapperObject; 20 | 21 | public ManagementBaseObjectPropertyDescriptor(ManagementBaseObjectW actualObject, PropertyData property) 22 | : base(property.Name, null) 23 | { 24 | _wrapperObject = actualObject; 25 | _property = property; 26 | 27 | if (_property.Origin == "___SYSTEM") 28 | category = "System Properties"; 29 | else 30 | category = "Properties"; 31 | } 32 | 33 | public override string Category 34 | { 35 | get 36 | { 37 | return category; 38 | } 39 | } 40 | 41 | public override Type ComponentType 42 | { 43 | get 44 | { 45 | return _wrapperObject.GetType(); 46 | } 47 | } 48 | 49 | public override string Description 50 | { 51 | get 52 | { 53 | // Embedded instance 54 | if (_property.Value is ManagementBaseObject || _property.Type == CimType.Object) 55 | { 56 | string derivation; 57 | 58 | try 59 | { 60 | derivation = "Embedded " + _property.Qualifiers["CIMTYPE"].Value; 61 | } 62 | catch 63 | { 64 | derivation = "Embedded Object"; 65 | } 66 | 67 | return derivation; 68 | } 69 | 70 | string retVal = "Type - " + _property.Type; 71 | 72 | if (_property.IsArray) 73 | retVal += " []"; 74 | 75 | if (_property.Type == CimType.DateTime && _property.Value != null && !_property.IsArray) 76 | retVal = retVal + " - Normalized Value: " + GetNormalizedDate(_property); 77 | 78 | string pDesc = ""; 79 | try 80 | { 81 | ManagementClass mClass = new ManagementClass(_wrapperObject.ClassPath.Path); 82 | mClass.Options.UseAmendedQualifiers = true; 83 | 84 | foreach (QualifierData qd in mClass.Properties[_property.Name].Qualifiers) 85 | { 86 | if (qd.Name == "Description") 87 | pDesc = qd.Value.ToString(); 88 | 89 | if (qd.Name == "lazy") 90 | retVal += Environment.NewLine + "Lazy Property"; 91 | 92 | if (qd.Name == "enumeration") 93 | retVal += Environment.NewLine + "Enumeration: " + qd.Value; 94 | // TODO: Find other qualifier containing enumerations (Values, ValueMap) 95 | } 96 | } 97 | catch (Exception) 98 | { 99 | pDesc = ""; 100 | } 101 | 102 | if (pDesc != "") 103 | retVal += Environment.NewLine + pDesc; 104 | 105 | return retVal; 106 | } 107 | } 108 | 109 | public override string DisplayName 110 | { 111 | get 112 | { 113 | string retVal = _property.Name; 114 | 115 | foreach (QualifierData q in _property.Qualifiers) 116 | { 117 | if (q.Name == "key") 118 | retVal = "*" + retVal; 119 | } 120 | 121 | return retVal; 122 | } 123 | } 124 | 125 | public override bool IsReadOnly 126 | { 127 | get 128 | { 129 | return true; 130 | } 131 | } 132 | 133 | public override Type PropertyType 134 | { 135 | get 136 | { 137 | return GetDotNetType(); 138 | } 139 | } 140 | 141 | public override bool CanResetValue(object component) 142 | { 143 | return false; 144 | } 145 | 146 | public Type GetDotNetType() 147 | { 148 | if ((_property.Type == CimType.Object) && (_property.Value is ManagementBaseObject)) 149 | { 150 | if (_property.Value is ManagementClass) 151 | { 152 | return typeof(ManagementClass); 153 | } 154 | 155 | if (_property.Value is ManagementObject) 156 | { 157 | return typeof(ManagementObject); 158 | } 159 | 160 | return typeof(ManagementBaseObject); 161 | } 162 | 163 | return ManagementBaseObjectW.GetTypeFor(_property.Type, _property.IsArray); 164 | } 165 | 166 | public override object GetValue(object component) 167 | { 168 | // To expand and display embedded instances, such as Props for SMS SCI classes. 169 | var val = ((ManagementBaseObjectW)component)[_property.Name]; 170 | 171 | if (val is ManagementBaseObject[]) 172 | { 173 | ManagementBaseObject[] props = (ManagementBaseObject[])val; 174 | ManagementBaseObjectW[] propvalues = new ManagementBaseObjectW[props.Length]; 175 | for (int i = 0; i < props.Length; i++) 176 | { 177 | propvalues[i] = new ManagementBaseObjectW(props[i]); 178 | } 179 | return propvalues; 180 | } 181 | 182 | if (val is ManagementBaseObject) 183 | { 184 | ManagementBaseObject props = (ManagementBaseObject)val; 185 | ManagementBaseObjectW propvalue = new ManagementBaseObjectW(props); 186 | return propvalue; 187 | } 188 | 189 | return val; 190 | } 191 | 192 | public override void ResetValue(object component) 193 | { 194 | } 195 | 196 | public override void SetValue(object component, object value) 197 | { 198 | ((ManagementBaseObjectW)component)[_property.Name] = value; 199 | } 200 | 201 | public override bool ShouldSerializeValue(object component) 202 | { 203 | return true; 204 | } 205 | 206 | protected static object GetNormalizedDate(PropertyData propertyData) 207 | { 208 | object retVal = propertyData.Value; 209 | 210 | if (propertyData.Type == CimType.DateTime && propertyData.Value != null) 211 | { 212 | //20080409032454.676631-420 213 | // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 214 | // Y 2 0 0 8 M 0 4 D 0 9 H 0 3 M 2 4 S 5 4 . m 6 7 6 6 3 1 U-420 215 | string dateString = propertyData.Value.ToString(); 216 | try 217 | { 218 | retVal = new DateTime( 219 | int.Parse(dateString.Substring(0, 4)), 220 | int.Parse(dateString.Substring(4, 2)), 221 | int.Parse(dateString.Substring(6, 2)), 222 | int.Parse(dateString.Substring(8, 2)), 223 | int.Parse(dateString.Substring(10, 2)), 224 | int.Parse(dateString.Substring(12, 2)), 225 | int.Parse(dateString.Substring(15, 6)) / 1000, DateTimeKind.Local); 226 | } 227 | catch (ArgumentOutOfRangeException) 228 | { 229 | retVal = dateString; 230 | } 231 | } 232 | 233 | return retVal; 234 | } 235 | } 236 | } -------------------------------------------------------------------------------- /WmiExplorer/Classes/Utilities.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Specialized; 3 | using System.Configuration; 4 | using System.Diagnostics; 5 | using System.Linq; 6 | using System.Runtime.InteropServices; 7 | using System.Security; 8 | using System.Security.Principal; 9 | using System.Windows.Forms; 10 | using WmiExplorer.Properties; 11 | 12 | namespace WmiExplorer.Classes 13 | { 14 | public static class Utilities 15 | { 16 | /// 17 | /// Checks if Application is running as Administrator 18 | /// 19 | /// True if running as Administrator. 20 | public static bool CheckIfElevated() 21 | { 22 | try 23 | { 24 | WindowsIdentity userIdentity = WindowsIdentity.GetCurrent(); 25 | WindowsPrincipal userPrincipal = new WindowsPrincipal(userIdentity); 26 | 27 | if (userPrincipal.IsInRole(WindowsBuiltInRole.Administrator)) 28 | return true; 29 | 30 | return false; 31 | } 32 | catch (Exception ex) 33 | { 34 | MessageBox.Show("Failed to determine if Application is running as Administrator: " + ex.Message); 35 | //Log("Unable to determine whether Application is running Elevated. Error: " + ex.Message); 36 | return false; 37 | } 38 | } 39 | 40 | /// 41 | /// To search and highlight text in Rich Text Box 42 | /// http://www.dotnetcurry.com/showarticle.aspx?ID=146 43 | /// 44 | /// Text to Search in RichTextBox rtb 45 | /// Start index for search 46 | /// Index of Last Search result 47 | /// RichTextBox to search in 48 | /// 49 | public static int FindTextInRichTextBox(string txtToSearch, int searchStart, int indexOfSearchText, RichTextBox rtb) 50 | { 51 | // Set the return value to -1 by default. 52 | int retVal = -1; 53 | int searchEnd = rtb.Text.Length; 54 | 55 | // A valid starting index should be specified. 56 | // if _indexOfSearchText = -1, the end of search 57 | if (searchStart >= 0 && indexOfSearchText >= 0) 58 | { 59 | // A valid ending index 60 | if (searchEnd > searchStart || searchEnd == -1) 61 | { 62 | // Find the position of search string in RichTextBox 63 | indexOfSearchText = rtb.Find(txtToSearch, searchStart, searchEnd, RichTextBoxFinds.None); 64 | 65 | // Determine whether the text was found in rtb. 66 | if (indexOfSearchText != -1) 67 | { 68 | // Return the index to the specified search text. 69 | retVal = indexOfSearchText; 70 | } 71 | } 72 | } 73 | return retVal; 74 | } 75 | 76 | /// 77 | /// Returns all Application settings 78 | /// 79 | /// String value containing name & value of all settings 80 | public static string GetSettings() 81 | { 82 | string settings = String.Empty; 83 | 84 | foreach (SettingsProperty p in from SettingsProperty p in Settings.Default.Properties 85 | orderby p.Name 86 | select p) 87 | { 88 | // Exclude UpdateCheckUrl and WindowPlacement settings 89 | if (p.Name.StartsWith("UpdateCheckUrl", StringComparison.InvariantCultureIgnoreCase) || p.Name.Equals("WindowPlacement", StringComparison.InvariantCultureIgnoreCase)) 90 | continue; 91 | 92 | // Settings containing a string array 93 | if (Settings.Default[p.Name] is StringCollection) 94 | { 95 | settings += p.Name + " = "; 96 | foreach (var s in Settings.Default[p.Name] as StringCollection) 97 | settings += s + ", "; 98 | settings += "\r\n"; 99 | continue; 100 | } 101 | 102 | // Settings without default values 103 | if (p.DefaultValue == null) 104 | { 105 | settings += p.Name + " = " + Settings.Default[p.Name] + "\r\n"; 106 | continue; 107 | } 108 | 109 | // Other settings with indicator whether value is the default value 110 | if (p.DefaultValue.ToString() == Settings.Default[p.Name].ToString()) 111 | settings += p.Name + " = " + Settings.Default[p.Name] + " (Default)\r\n"; 112 | else 113 | settings += p.Name + " = " + Settings.Default[p.Name] + "\r\n"; 114 | } 115 | 116 | return settings; 117 | } 118 | 119 | /// 120 | /// Launch the specified program 121 | /// 122 | /// Command to run 123 | public static void LaunchProgram(string sCmd) 124 | { 125 | try 126 | { 127 | Process.Start(sCmd); 128 | } 129 | catch (Exception ex) 130 | { 131 | MessageBox.Show(ex.Message, "Error launching program", MessageBoxButtons.OK, MessageBoxIcon.Error); 132 | } 133 | } 134 | 135 | public static void RelaunchAsAdmin() 136 | { 137 | if (CheckIfElevated()) 138 | { 139 | System.Windows.Forms.MessageBox.Show("Already Running as Admin"); 140 | return; 141 | } 142 | else 143 | { 144 | string myPath = System.Reflection.Assembly.GetExecutingAssembly().Location; 145 | 146 | // Restart program and run as admin 147 | ProcessStartInfo startInfo = new ProcessStartInfo(myPath); 148 | startInfo.Verb = "runas"; 149 | System.Diagnostics.Process.Start(startInfo); 150 | Application.Exit(); 151 | return; 152 | } 153 | } 154 | 155 | /// 156 | /// Launch the specified program with arguments 157 | /// 158 | /// Command to run 159 | /// Argument for the command 160 | /// Wait for the command to Exit 161 | public static void LaunchProgram(string sCmd, string sArgument, bool bWaitForExit) 162 | { 163 | try 164 | { 165 | if (bWaitForExit) 166 | Process.Start(sCmd, sArgument).WaitForExit(); 167 | else 168 | Process.Start(sCmd, sArgument); 169 | } 170 | catch (Exception ex) 171 | { 172 | MessageBox.Show(ex.Message, "Error launching program", MessageBoxButtons.OK, MessageBoxIcon.Error); 173 | } 174 | } 175 | 176 | /// 177 | /// Returns a string from the source SecureString 178 | /// http://blogs.msdn.com/b/fpintos/archive/2009/06/12/how-to-properly-convert-securestring-to-string.aspx 179 | /// 180 | /// SecureString to convert to String 181 | /// String 182 | public static string SecureStringToString(this SecureString secureString) 183 | { 184 | if (secureString == null) 185 | throw new ArgumentNullException("secureString"); 186 | 187 | IntPtr unmanagedString = IntPtr.Zero; 188 | try 189 | { 190 | unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(secureString); 191 | return Marshal.PtrToStringUni(unmanagedString); 192 | } 193 | finally 194 | { 195 | Marshal.ZeroFreeGlobalAllocUnicode(unmanagedString); 196 | } 197 | } 198 | 199 | /// 200 | /// Returns a Secure string from the source string 201 | /// http://msdn.microsoft.com/en-us/library/system.security.securestring(v=vs.110).aspx 202 | /// 203 | /// String to convert to SecureString 204 | /// SecureString 205 | public static SecureString StringToSecureString(this string source) 206 | { 207 | if (String.IsNullOrWhiteSpace(source)) 208 | return null; 209 | 210 | SecureString result = new SecureString(); 211 | foreach (char c in source.ToCharArray()) 212 | result.AppendChar(c); 213 | 214 | return result; 215 | } 216 | 217 | /// 218 | /// Update User Settings on Application version update 219 | /// http://www.ngpixel.com/2011/05/05/c-keep-user-settings-between-versions/ 220 | /// 221 | public static void UpdateSettings() 222 | { 223 | try 224 | { 225 | Settings.Default.Upgrade(); 226 | Settings.Default.bUpgradeSettings = false; 227 | Settings.Default.bUpdateAvailable = false; 228 | Settings.Default.Save(); 229 | } 230 | catch (Exception ex) 231 | { 232 | MessageBox.Show("Failed to upgrade user settings. Error: " + ex.Message); 233 | } 234 | } 235 | } 236 | } -------------------------------------------------------------------------------- /WmiExplorer/Forms/Form_About.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace WmiExplorer.Forms 2 | { 3 | partial class Form_About 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | protected override void Dispose(bool disposing) 14 | { 15 | if (disposing && (components != null)) 16 | { 17 | components.Dispose(); 18 | } 19 | base.Dispose(disposing); 20 | } 21 | 22 | #region Windows Form Designer generated code 23 | 24 | /// 25 | /// Required method for Designer support - do not modify 26 | /// the contents of this method with the code editor. 27 | /// 28 | private void InitializeComponent() 29 | { 30 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form_About)); 31 | this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); 32 | this.logoPictureBox = new System.Windows.Forms.PictureBox(); 33 | this.labelProductName = new System.Windows.Forms.Label(); 34 | this.labelVersion = new System.Windows.Forms.Label(); 35 | this.labelCopyright = new System.Windows.Forms.Label(); 36 | this.okButton = new System.Windows.Forms.Button(); 37 | this.textBoxDescription = new System.Windows.Forms.TextBox(); 38 | this.tableLayoutPanel.SuspendLayout(); 39 | ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).BeginInit(); 40 | this.SuspendLayout(); 41 | // 42 | // tableLayoutPanel 43 | // 44 | this.tableLayoutPanel.ColumnCount = 2; 45 | this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F)); 46 | this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 67F)); 47 | this.tableLayoutPanel.Controls.Add(this.logoPictureBox, 0, 0); 48 | this.tableLayoutPanel.Controls.Add(this.labelProductName, 1, 0); 49 | this.tableLayoutPanel.Controls.Add(this.labelVersion, 1, 1); 50 | this.tableLayoutPanel.Controls.Add(this.labelCopyright, 1, 2); 51 | this.tableLayoutPanel.Controls.Add(this.okButton, 1, 5); 52 | this.tableLayoutPanel.Controls.Add(this.textBoxDescription, 1, 4); 53 | this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; 54 | this.tableLayoutPanel.Location = new System.Drawing.Point(9, 9); 55 | this.tableLayoutPanel.Name = "tableLayoutPanel"; 56 | this.tableLayoutPanel.RowCount = 6; 57 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); 58 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); 59 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); 60 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 4F)); 61 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 56F)); 62 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); 63 | this.tableLayoutPanel.Size = new System.Drawing.Size(416, 263); 64 | this.tableLayoutPanel.TabIndex = 0; 65 | // 66 | // logoPictureBox 67 | // 68 | this.logoPictureBox.Dock = System.Windows.Forms.DockStyle.Fill; 69 | this.logoPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("logoPictureBox.Image"))); 70 | this.logoPictureBox.Location = new System.Drawing.Point(3, 3); 71 | this.logoPictureBox.Name = "logoPictureBox"; 72 | this.tableLayoutPanel.SetRowSpan(this.logoPictureBox, 6); 73 | this.logoPictureBox.Size = new System.Drawing.Size(131, 257); 74 | this.logoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; 75 | this.logoPictureBox.TabIndex = 12; 76 | this.logoPictureBox.TabStop = false; 77 | // 78 | // labelProductName 79 | // 80 | this.labelProductName.Dock = System.Windows.Forms.DockStyle.Fill; 81 | this.labelProductName.Location = new System.Drawing.Point(143, 0); 82 | this.labelProductName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); 83 | this.labelProductName.MaximumSize = new System.Drawing.Size(0, 17); 84 | this.labelProductName.Name = "labelProductName"; 85 | this.labelProductName.Size = new System.Drawing.Size(270, 17); 86 | this.labelProductName.TabIndex = 19; 87 | this.labelProductName.Text = "Product Name"; 88 | this.labelProductName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; 89 | // 90 | // labelVersion 91 | // 92 | this.labelVersion.Dock = System.Windows.Forms.DockStyle.Fill; 93 | this.labelVersion.Location = new System.Drawing.Point(143, 26); 94 | this.labelVersion.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); 95 | this.labelVersion.MaximumSize = new System.Drawing.Size(0, 17); 96 | this.labelVersion.Name = "labelVersion"; 97 | this.labelVersion.Size = new System.Drawing.Size(270, 17); 98 | this.labelVersion.TabIndex = 0; 99 | this.labelVersion.Text = "Version"; 100 | this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; 101 | // 102 | // labelCopyright 103 | // 104 | this.labelCopyright.Dock = System.Windows.Forms.DockStyle.Fill; 105 | this.labelCopyright.Location = new System.Drawing.Point(143, 52); 106 | this.labelCopyright.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); 107 | this.labelCopyright.MaximumSize = new System.Drawing.Size(0, 17); 108 | this.labelCopyright.Name = "labelCopyright"; 109 | this.labelCopyright.Size = new System.Drawing.Size(270, 17); 110 | this.labelCopyright.TabIndex = 21; 111 | this.labelCopyright.Text = "Copyright"; 112 | this.labelCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; 113 | // 114 | // okButton 115 | // 116 | this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 117 | this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 118 | this.okButton.Location = new System.Drawing.Point(338, 238); 119 | this.okButton.Name = "okButton"; 120 | this.okButton.Size = new System.Drawing.Size(75, 22); 121 | this.okButton.TabIndex = 24; 122 | this.okButton.Text = "&OK"; 123 | // 124 | // textBoxDescription 125 | // 126 | this.textBoxDescription.BorderStyle = System.Windows.Forms.BorderStyle.None; 127 | this.textBoxDescription.Dock = System.Windows.Forms.DockStyle.Fill; 128 | this.textBoxDescription.Location = new System.Drawing.Point(143, 91); 129 | this.textBoxDescription.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3); 130 | this.textBoxDescription.Multiline = true; 131 | this.textBoxDescription.Name = "textBoxDescription"; 132 | this.textBoxDescription.ReadOnly = true; 133 | this.textBoxDescription.Size = new System.Drawing.Size(270, 141); 134 | this.textBoxDescription.TabIndex = 23; 135 | this.textBoxDescription.TabStop = false; 136 | this.textBoxDescription.Text = resources.GetString("textBoxDescription.Text"); 137 | // 138 | // Form_About 139 | // 140 | this.AcceptButton = this.okButton; 141 | this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); 142 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; 143 | this.AutoSize = true; 144 | this.CancelButton = this.okButton; 145 | this.ClientSize = new System.Drawing.Size(434, 281); 146 | this.Controls.Add(this.tableLayoutPanel); 147 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 148 | this.MaximizeBox = false; 149 | this.MinimizeBox = false; 150 | this.Name = "Form_About"; 151 | this.Padding = new System.Windows.Forms.Padding(9); 152 | this.ShowIcon = false; 153 | this.ShowInTaskbar = false; 154 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 155 | this.Text = "Form_About"; 156 | this.tableLayoutPanel.ResumeLayout(false); 157 | this.tableLayoutPanel.PerformLayout(); 158 | ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).EndInit(); 159 | this.ResumeLayout(false); 160 | 161 | } 162 | 163 | #endregion 164 | 165 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel; 166 | private System.Windows.Forms.PictureBox logoPictureBox; 167 | private System.Windows.Forms.Label labelProductName; 168 | private System.Windows.Forms.Label labelVersion; 169 | private System.Windows.Forms.Label labelCopyright; 170 | private System.Windows.Forms.TextBox textBoxDescription; 171 | private System.Windows.Forms.Button okButton; 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /WmiExplorer/Sms/SmsClientActions.cs: -------------------------------------------------------------------------------- 1 | namespace WmiExplorer.Sms 2 | { 3 | internal class SmsClientActions 4 | { 5 | public SmsClientActions() 6 | { 7 | } 8 | 9 | public static SmsClientAction HardwareInventory 10 | { 11 | // {00000000-0000-0000-0000-000000000101} is the same 12 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000001}", "Hardware Inventory Cycle", ActionGroup.Inventory); } 13 | } 14 | 15 | public static SmsClientAction SoftwareInventory 16 | { 17 | // {00000000-0000-0000-0000-000000000102} is the same 18 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000002}", "Software Inventory Cycle", ActionGroup.Inventory); } 19 | } 20 | 21 | public static SmsClientAction HeartbeatDiscovery 22 | { 23 | // {00000000-0000-0000-0000-000000000103} is the same 24 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000003}", "Discovery Data Collection Cycle", ActionGroup.Inventory); } 25 | } 26 | 27 | public static SmsClientAction FileCollection 28 | { 29 | // {00000000-0000-0000-0000-000000000104} is the same 30 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000010}", "File Collection Cycle", ActionGroup.Inventory); } 31 | } 32 | 33 | public static SmsClientAction IdmifCollection 34 | { 35 | // {00000000-0000-0000-0000-000000000105} is the same 36 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000011}", "IDMIF Collection Cycle", ActionGroup.Inventory); } 37 | } 38 | 39 | public static SmsClientAction ClientMachineAuthentication 40 | { 41 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000012}", "Client Machine Authentication", ActionGroup.Other); } 42 | } 43 | 44 | public static SmsClientAction MachineAssignmentsRequest 45 | { 46 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000021}", "Request Machine Assignments", ActionGroup.Policy); } 47 | } 48 | 49 | public static SmsClientAction MachineAssignmentsEvaluate 50 | { 51 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000022}", "Evaluate Machine Assignments", ActionGroup.Policy); } 52 | } 53 | 54 | public static SmsClientAction LocationRefreshDefaultMp 55 | { 56 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000023}", "Refresh Default MP", ActionGroup.LocationServices); } 57 | } 58 | 59 | public static SmsClientAction LocationRefreshLocations 60 | { 61 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000024}", "Refresh Locations", ActionGroup.LocationServices); } 62 | } 63 | 64 | public static SmsClientAction LocationTimeoutRefresh 65 | { 66 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000025}", "Timeout Refresh", ActionGroup.LocationServices); } 67 | } 68 | 69 | public static SmsClientAction UserAssignmentsRequest 70 | { 71 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000026}", "Request User Assignments", ActionGroup.Policy); } 72 | } 73 | 74 | public static SmsClientAction UserAssignmentsEvaluate 75 | { 76 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000027}", "Evaluate User Assignments", ActionGroup.Policy); } 77 | } 78 | 79 | public static SmsClientAction SoftwareMeterUsageReport 80 | { 81 | // {00000000-0000-0000-0000-000000000106} 82 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000031}", "Software Metering Usage Report Cycle", ActionGroup.Inventory); } 83 | } 84 | 85 | public static SmsClientAction SourceUpdateCycle 86 | { 87 | // {00000000-0000-0000-0000-000000000107} 88 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000032}", "Windows Installer Source List Update Cycle", ActionGroup.Other); } 89 | } 90 | 91 | public static SmsClientAction ProxySettingsCacheClear 92 | { 93 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000037}", "Clear Proxy Settings Cache", ActionGroup.Other); } 94 | } 95 | 96 | public static SmsClientAction PolicyAgentCleanupMachine 97 | { 98 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000040}", "Policy Agent Cleanup Cycle (Machine)", ActionGroup.Policy); } 99 | } 100 | 101 | public static SmsClientAction PolicyAgentCleanupUser 102 | { 103 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000041}", "Policy Agent Cleanup Cycle (User)", ActionGroup.Policy); } 104 | } 105 | 106 | public static SmsClientAction PolicyAgentValidateMachine 107 | { 108 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000042}", "Validate Machine Policy/Assignment", ActionGroup.Policy); } 109 | } 110 | 111 | public static SmsClientAction PolicyAgentValidateUser 112 | { 113 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000043}", "Validate User Policy/Assignment", ActionGroup.Policy); } 114 | } 115 | 116 | public static SmsClientAction RetryRefreshCertificate 117 | { 118 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000051}", "Retry/Refresh Certificates in AD on MP", ActionGroup.Other); } 119 | } 120 | 121 | public static SmsClientAction SoftwareUpdateInstallSchedule 122 | { 123 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000063}", "Software Updates Install Schedule", ActionGroup.SoftwareUpdates); } 124 | } 125 | 126 | public static SmsClientAction Nap 127 | { 128 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000071}", "Network Access Protection Schedule", ActionGroup.Other); } 129 | } 130 | 131 | public static SmsClientAction SoftwareUpdateAssignmentEvaluation 132 | { 133 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000108}", "Software Updates Assignment Evaluation Cycle", ActionGroup.SoftwareUpdates); } 134 | } 135 | 136 | public static SmsClientAction DcmPolicy 137 | { 138 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000110}", "DCM Policy", ActionGroup.Other); } 139 | } 140 | 141 | public static SmsClientAction StateMessageSendUnsent 142 | { 143 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000111}", "Send Unsent State Messages", ActionGroup.StateMessage); } 144 | } 145 | 146 | public static SmsClientAction StateMessagePolicyCacheClean 147 | { 148 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000112}", "State System Policy Cache Clean", ActionGroup.StateMessage); } 149 | } 150 | 151 | public static SmsClientAction SoftwareUpdateScan 152 | { 153 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000113}", "Software Update Scan Cycle", ActionGroup.SoftwareUpdates); } 154 | } 155 | 156 | public static SmsClientAction SoftwareUpdateStore 157 | { 158 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000114}", "Software Update Store Refresh", ActionGroup.SoftwareUpdates); } 159 | } 160 | 161 | public static SmsClientAction StateMessageSendHigh 162 | { 163 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000115}", "Bulk Send High Priority", ActionGroup.StateMessage); } 164 | } 165 | 166 | public static SmsClientAction StateMessageSendLow 167 | { 168 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000116}", "Bulk Send Low Priority", ActionGroup.StateMessage); } 169 | } 170 | 171 | public static SmsClientAction AmtStatusCheck 172 | { 173 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000120}", "AMT Status Check Policy", ActionGroup.Other); } 174 | } 175 | 176 | public static SmsClientAction ApplicationPolicy 177 | { 178 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000121}", "Application Manager Machine Policy", ActionGroup.ApplicationEvaluation); } 179 | } 180 | 181 | public static SmsClientAction ApplicationPolicyUser 182 | { 183 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000122}", "Application Manager User Policy", ActionGroup.ApplicationEvaluation); } 184 | } 185 | 186 | public static SmsClientAction ApplicationPolicyGlobal 187 | { 188 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000123}", "Application Manager Global Evaluation Policy", ActionGroup.ApplicationEvaluation); } 189 | } 190 | 191 | public static SmsClientAction PowerMgmtSummarize 192 | { 193 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000131}", "Power Management Summarizer", ActionGroup.Other); } 194 | } 195 | 196 | public static SmsClientAction EpDeploymentReevaluate 197 | { 198 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000221}", "Endpoint Protection Deployment Re-Evaluate", ActionGroup.Endpoint); } 199 | } 200 | 201 | public static SmsClientAction EpAmPolicyReevaluate 202 | { 203 | get { return new SmsClientAction("{00000000-0000-0000-0000-000000000222}", "Endpoint Protection AM Policy Re-Evaluate", ActionGroup.Endpoint); } 204 | } 205 | 206 | // Excluded Actions: 207 | // {00000000-0000-0000-0000-000000000061} 208 | // {00000000-0000-0000-0000-000000000062} 209 | // {00000000-0000-0000-0000-000000000101} 210 | // {00000000-0000-0000-0000-000000000109} 211 | // {00000000-0000-0000-0000-000000000223} 212 | } 213 | } --------------------------------------------------------------------------------