Created
August 4, 2022 01:25
-
-
Save joe-desimone/87c7ec8495676139b2e8d785a326e1a9 to your computer and use it in GitHub Desktop.
Snapit - MMC Installer, things
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.ManagementConsole; | |
| using System.ComponentModel; | |
| using System; | |
| using System.Security.Permissions; | |
| using System.Collections; | |
| /* | |
| C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /target:library /reference:C:\Windows\assembly\GAC_MSIL\microsoft.managementconsole\3.0.0.0__31bf3856ad364e35\microsoft.managementconsole.dll .\Snapit.cs | |
| C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe SnapIt.dll | |
| */ | |
| [assembly: PermissionSetAttribute(SecurityAction.RequestMinimum, Unrestricted = true)] | |
| namespace Microsoft.ManagementConsole.Samples | |
| { | |
| /// <summary> | |
| /// The RunInstaller attribute allows the .Net framework to install the assembly. | |
| /// </summary> | |
| [RunInstaller(true)] | |
| public class InstallUtilSupport : SnapInInstaller | |
| { | |
| public override void Install( IDictionary stateSaver ) { | |
| Console.WriteLine("BoomTown! INSTALL"); | |
| } | |
| public override void Uninstall( IDictionary savedState ) { | |
| Console.WriteLine("BoomTown! UNINSTALL"); | |
| } | |
| } | |
| /// <summary> | |
| /// The main entry point for the creation of the snap-in. | |
| /// </summary> | |
| [SnapInSettings("{CFAA3895-4B02-4431-A168-A6416013C3DD}", | |
| DisplayName = "- Simple SnapIn Sample", | |
| Description = "Simple Hello World SnapIn")] | |
| public class SimpleSnapIn : SnapIn | |
| { | |
| /// <summary> | |
| /// The constructor. | |
| /// </summary> | |
| public SimpleSnapIn() | |
| { | |
| // Update tree pane with a node in the tree | |
| this.RootNode = new ScopeNode(); | |
| this.RootNode.DisplayName = "Hello World"; | |
| } | |
| } // class | |
| } // namespace |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment