Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何为我的应用程序创建powershell扩展_C#_Powershell - Fatal编程技术网

C# 如何为我的应用程序创建powershell扩展

C# 如何为我的应用程序创建powershell扩展,c#,powershell,C#,Powershell,我正在开发一个平台,因为它有很多配置和参数,我认为允许系统管理员编写任务脚本和类似的东西会很好,就像SharePoint一样。。。不仅如此:因为我将在相当长的一段时间内管理它,所以我并不真正需要(或有时间构建)GUI,但我不想继续疯狂地运行tsql脚本 所以我的问题是:我该怎么做?我如何告诉PowerShell,当有人输入Get MyAppTenants时,他应该调用我的DLL并执行方法retrieveAlltenants()?我建议您编写一个二进制cmdlet,因为您将在单独的库中使用方法。您

我正在开发一个平台,因为它有很多配置和参数,我认为允许系统管理员编写任务脚本和类似的东西会很好,就像SharePoint一样。。。不仅如此:因为我将在相当长的一段时间内管理它,所以我并不真正需要(或有时间构建)GUI,但我不想继续疯狂地运行tsql脚本


所以我的问题是:我该怎么做?我如何告诉PowerShell,当有人输入
Get MyAppTenants
时,他应该调用我的DLL并执行方法
retrieveAlltenants()

我建议您编写一个二进制cmdlet,因为您将在单独的库中使用方法。您可以用C#编写它,这样您就可以使用您已有的技能,只需为您的应用程序提供PowerShell模块

可在此处找到启动指南: