且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在ASP.NET/C#页面中提示输入凭据,并传递给PowerShell

更新时间:2023-02-07 12:08:52

我认为最简单的方法是使用模拟。也就是说,您获得了用户的凭据,然后以该用户身份启动Powershell进程,从而可以以该用户身份执行所需的任何操作。

I think the easiest way is to use impersonation. i.e. you get the credentials of the user, and launch the powershell process as that user which allows you to execute anything you want as that user.

请参阅:

使用用户模拟从ASP.NET执行PowerShell cmdlet -具有模拟当前用户运行PowerShell的步骤

Execute PowerShell cmdlets from ASP.NET With User Impersonation - Has steps to impersonate the current user to run PowerShell

or

如何从ASP.NET以模拟方式运行PowerShell脚本-有关如何以模拟方式运行PowerShell的***问题。

How to run PowerShell scripts from ASP.NET with Impersonation - *** question on how to run PowerShell with impersonation.