Quantcast
Channel: CodeProject Latest postings for ASP.NET
Viewing all articles
Browse latest Browse all 3938

call a server side Powershell script?

$
0
0
I am trying to allow my users to check if they have ActiveSync enabled for email and if they do return you are good to go, else tell them they need to complete a form. So a simple test I setup tried to start with a powershell.asp page containing:

<form action="doPowershell.asp" method="post">
    Network Username: <input type="textbox" name="userName"/><input type="submit"/></form>


Then the resulting doPowershell.asp page I have for testing:

<%
Dim userName
userName = Request.Form("userName")
response.write(userName)

Server.Execute("activesync.ps1")%>


the activesync.ps1 file contains

(Get-CASMailbox -Identity <username>).ActiveSyncEnabled


On the screen it outputs the value the user entered and then outputs the content of the ps1 file. Doesn't physically run anything. Thoughts?

Note: The current form doesn't really effect the PowerShell script. Just a shell I wrote to see if I could run it. The PS1 right now is just hardcoded with a physical username.

Viewing all articles
Browse latest Browse all 3938

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>