Last post Jun 08, 2018 11:38 AM by PatriceSc
Jun 08, 2018 06:19 AM|balu.devara|LINK
I have created one application which is executing the PowerShell script and displayed result as well , it is working in iis express but when I try to host application in IIS the powershell script is notworking.
please help us.
PowerShellInstance = PowerShell.Create();
Collection<PSObject> PSOutput = PowerShellInstance.Invoke();
Jun 08, 2018 09:21 AM|PatriceSc|LINK
It shows an authentication prompt locally ? Keep in mind this code runs server side so it would "show" this on the web server where nobody could interact with that prompt so stricly speaking I'm not sure this code will ever be able to work as you want. What
are you trying to do ?
Jun 08, 2018 10:49 AM|balu.devara|LINK
I want to display vm admin users list.
Jun 08, 2018 11:38 AM|PatriceSc|LINK
Ok. Does it show a popup locally ? If yes it can't work this way and you would have to pass credentials so that no user action is required when the command runs.
It might be a start but depending on what to do next rather than using PowerShell commands, you could perhaps use the Azure or Graph API ? See
https://docs.microsoft.com/en-us/rest/api/azure/ which should be usable through
Finally if you have an error, it's best to tell which error you have (you may need a runspace, if I remember you may have something to enable first or you could have a PowerShell version issue etc...) so it"s always best to start from the EXACT error you
have rather than trying to figure out which error you have by reading the code (it's not rare that even for few line of codes you could have multiple things that could go wrong).