Working off of Frode's answer, I found a DLL named CoreASP.dll and tried to import this into my project but received an error that the library was invalid.
I was able to use the "Type Library Importer" tool in visual studio to convert the COM type library into equivalent definitions.
command: tlbimp.exe CoreAsp.dll\1
This created another DLL "CoreAspiLib.dll" that I was able to import into my Visual Studio project.
Thank you Frode for leading me in the right direction.
Update:
So this method SOMETIMES works, it seems like I would have to call the command 3-4 times to get it to work as expected. To avoid the headache I ended up calling powershell from c#, making sure to hold the runspace open so that I don't have to reload it for subsequent commands (I may be calling this function 50+ times per minute).
Example of calling the script 1000 times:
Runspace runspace = RunspaceFactory.CreateRunspace();
string scriptText =
"$wug = New-Object -ComObject CoreAsp.EventHelper;" +
"$wug.SendChangeEvent(2,519,1)";
runspace.Open();
for (int x = 0; x < 1000; x++)
{
Console.WriteLine("Running Event "+(x+1).ToString());
Pipeline pipeline = runspace.CreatePipeline();
pipeline.Commands.AddScript(scriptText);
pipeline.Commands.Add("Out-String");
pipeline.Invoke();
Thread.Sleep(1000);
}
runspace.Close();
This seems to work 100% of the time.
Joe I also tried your method and ended up with the same result as my first test, no errors but the function did not run as expected.