How can I use the COM object “VirtualPC.Application” to automate Windows Virtual PC from c#

StackOverflow https://stackoverflow.com/questions/2185333

  •  25-09-2019
  •  | 
  •  

문제

I've read that Windows Virtual PC comes with a COM interface (VirtualPC.Application). I've read blogs about how to use it from Powershell. But how can I use it from c#? Specifically, is there a Primary Interop Assembly (PIA) that I can use in c# to get intellisense in visual studio?

도움이 되었습니까?

해결책

  • Export the COM wrapper with:

    tlbimp c:\windows\system32\vpc.exe /out:\vpc.dll

  • Add a reference to the generated dll: vpc.dll

  • Create the object and use it from C#: var vpc_obj = new vpc.VMVirtualPCClass();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top