这里的第一个问题:)
所以我必须使用 Visual Studio 2010 Express 为 Powershell 2.0 创建一个自定义 CMDLet。我遵循了这个看似简单的教程:http: //blogs.msdn.com/b/saveenr/archive/2010/03/08/how-to-create-a-powershell-2-0-module-and-cmdlet- with-visual-studio-2010-screencast-included.aspx
我的代码几乎相同(甚至尝试复制粘贴他们的代码)但是在我调用Import-Module "path_to_dll"之后
然后调用Get-Module,我看到了我导入的模块,但没有可用的 ExportedCommands。
ModuleType Name ExportedCommands
---------- ---- ----------------
Binary PowerShellCMDLetsLibrary {}
C#代码:
namespace PowerShellCMDLetsLibrary
{
[System.Management.Automation.Cmdlet(System.Management.Automation.VerbsCommon.Get,"RemedyXml")]
public class Get_RemedyXml:System.Management.Automation.PSCmdlet
{
[System.Management.Automation.Parameter(Position = 0, Mandatory = true)]
public string TicketID;
protected override void ProcessRecord()
{
...
this.WriteObject(Result.InnerXml, true);
}
可能是个错误,我只是看不到它