Solved

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

Posted on 2016-08-22
3
77 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 79

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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This video teaches users how to migrate an existing Wordpress website to a new domain.
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…

861 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

22 Experts available now in Live!

Get 1:1 Help Now