Solved

Harder to call PowerShell from web application (ASP.Net)?

Posted on 2016-08-22
3
68 Views
Last Modified: 2016-09-08
A developer told me that it takes a lot more effort to program an ASP.Net C# web application to call PowerShell to query Active Directory & Windows using a service account (not the user's credentials) than to program a C# client-server application to do the same.  That doesn't seem very intuitive to me.  Can you all confirm or disagree?  Thanks!
0
Comment
Question by:humbleamateur
3 Comments
 
LVL 78

Accepted Solution

by:
David Johnson, CD, MVP earned 250 total points
ID: 41766178
since the Website is using C# .net why don't you code it in the code behind? Everything you can do in powershell can be done in C#.  It seems counter-intuitive to have to start a new process (powershell), pass the variables,run the script and then return the results. You don't need a client/server c# app though it can be done that way.
1
 
LVL 30

Assisted Solution

by:MlandaT
MlandaT earned 250 total points
ID: 41766235
I agree with David. Here are some examples to get you started..

http://ianatkinson.net/computing/adcsharp.htm
https://msdn.microsoft.com/en-us/library/ms973834.aspx
http://www.macaalay.com/2010/06/28/active-directory-c/

You'll be able to get tonnes of examples of how to accomplish various tasks in AD using C#. No need for PowerShell
0
 

Author Closing Comment

by:humbleamateur
ID: 41790695
Thanks so much!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Image(2) 3 29
Can’t delete a file 14 87
install app on other machine 13 16
WIX Redirect 1 1
This article will help you understand what HashTables are and how to use them in PowerShell.
A procedure for exporting installed hotfix details of remote computers using powershell
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now