Created
September 13, 2023 01:14
-
-
Save santisq/031812efc045b19eab2dc073361c0c02 to your computer and use it in GitHub Desktop.
how to perform OnRemove in C#
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
Add-Type ' | |
using System; | |
using System.Management.Automation; | |
namespace IModuleAssemblyCleanupTest; | |
public class Testing : IModuleAssemblyCleanup | |
{ | |
public void OnRemove(PSModuleInfo psModuleInfo) => | |
Console.WriteLine("Hello!"); | |
}' -PassThru | | |
Import-Module -Assembly { $_.Assembly } -PassThru | | |
Remove-Module |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment