Solved

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

Posted on 2016-08-22
3
145 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 82

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

636 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