I don't know much about powershell, but I saw this in the documentation:
Command.Parameters Property
Please try it in the code:
public void OnImport()
{
using (PowerShell ps = PowerShell.Create(RunspaceMode.CurrentRunspace))
{
PSCommand pSCommand = ps.Commands;
foreach (var item in pSCommand.Commands)
{
CommandParameterCollection commandParameters = item.Parameters;
foreach (var paras in commandParameters)
{
var param = paras.Name;
}
}
}
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.