I am using Visual Studio 2010 Ultimate Beta 2. What is the relevant namespace/classes for creating a PowerShell cmdlet in C#?
I assume there is an interface or abstract class to derive from.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’ll need to derive from System.Management.Automation.Cmdlet.
It lives in system.management.automation.dll. If you’re on Windows Vista or newer, the file’s in your GAC, which can be referenced but it’s tricky. It’s probably easiest to install the PowerShell SDK, and then you can reference the assembly directly from “Add Reference…” in Visual Studio. (Full path is
C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0.)