• Register
0 votes
88 views

Problem :

I am very new to ASP.Net. I have created my first ASP.Net application which impersonates the user in order to create the AD group, and after that it launches the powershell process as the user saperately.

But because of some reason the group creation works fine and shows as success in the Event Viewer, and when it tries to run my PowerShell script, I face the following error:

The user has not been granted the requested logon type at this machine.

The below is my code which is failing:

SecureString securePassword = new SecureString();
foreach (char c in model.AdminPassword)
{
securePassword.AppendChar(c);
}
PSCredential psCredential = new PSCredential("CONTOSO\\" + User.Identity.Name, securePassword);
ProcessStartMyinfo myinfo = new ProcessStartMyinfo("c:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe", "c:\\PowershellScripts\\EnableDL.ps1 -dlName '" + model.Name + "'");
myinfo.UseShellExecute = false;
myinfo.RedirectStandardOutput = true;
myinfo.RedirectStandardError = true;
myinfo.RedirectStandardInput = true;
myinfo.CreateNoWindow = true;
myinfo.Domain = "CONTOSO.COM";
myinfo.UserName = User.Identity.Name;
myinfo.Password = securePassword;

Is there any way to remove this error? I would rather not compromise with the security policy with the server ideally, and this application will be used by around 100+ users.

6 5 3
7,540 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I have managed to find the solution for you. You just need to go to Start->Administrative Tools->Local Security Policy.

And navigate to Local Policies->User Rights Assignment->Allow Log On Locally, and finally add the required usernames of the accounts/groups needs access.

9 7 4
38,600 points

Related questions

0 votes
1 answer 228 views
228 views
Problem : I have my home network with the XP laptop, a Vista desktop and now new one Win 7 desktop. I have attached my Win7 to my existing home network. I can see and access files on my XP & Vista machines from my Win 7 box. I can see the Win 7 ... message. Logon failure: the user has not been granted the requested logon type for this computer. Please let me know if any solution on my problem.
asked Dec 7, 2019 alecxe 7.5k points
1 vote
1 answer 459 views
459 views
Problem : We are now running the 32-bit Windows server 2008 with the IIS version of 7. We are trying to publish the asp.net 4.0 webapp but so far our attempts have failed and only yielded the few warnings in our serverlog without even the stopping our 4.0 application ... very badly after that we ran out of the ideas on what to do on our issue so any form of the input would be greatly appreciated.
asked Dec 30, 2019 alecxe 7.5k points
0 votes
1 answer 116 views
116 views
Problem : I am new to ASP.Net and I have an ASP.Net application which runs correctly on my local development machine. But when I try to run this application online, it shows me following error Format of the initialization string does not conform to specification starting at index 0 I don’t have any clue about this error. Does anybody have any idea regarding solution on this error?
asked Nov 25, 2019 alecxe 7.5k points
0 votes
1 answer 23 views
23 views
How can you find the mime type of a file based on the file signature, not the extension in .Net? I want a simple way to get a mime type where the file extension is incorrect or not given, something similar?
asked Aug 29, 2020 Aliza313 720 points
0 votes
2 answers 363 views
363 views
Problem : Currently I am migrating from the Identity 1.0.0 to Identity 2.0.1. But the migrations code generated is nothing about the new IdentityUser. And It does not even add the new columns. So I tried to make the new project and also I ... current context At below line IdentityResult result = await UserManager.CreateAsync(user, model.Password); Any clue about the solution on my above problem?
asked Dec 25, 2019 alecxe 7.5k points
0 votes
1 answer 130 views
130 views
Problem : I have recently installed a website on my local machine using IIS 7 successfully. But when I tried to deploy it on the live server, I got a following error: "The page cannot be displayed because an internal server error has occurred" Nothing else. Using a same IIS 7 on live and also set to have the Detailed errors in Error Pages module, but still getting a same. What can be the reason?
asked Jan 28, 2020 jwilliam 3.9k points
1 vote
1 answer 124 views
124 views
Problem: I have fundamental knowledge about Asp.net and Mysql. I have written code in Asp.net. Now I am facing below error if I try to connect to mysql database to the editor. Fill: selectcommand.connection property has not been initialized. Please find below my code ... server" Text="Button" OnClick="MyButton1_Click" /> </form> I need to fix above error please guide me in fixing it for me.
asked Jun 2, 2020 Martin K 6.6k points
0 votes
2 answers 318 views
318 views
Problem : I have scheduled the task to run the SSIS job using my Task Scheduler (TS). It is configured to run as the User who belongs to the Admin group. The security is to "Run whether user is logged on or not" is checked and "Dont store password" is checked and "Run ... that "Run whether user is logged on or not" must run my task when my user is not logged on. Am I missing something? Any clues ?
asked Dec 23, 2019 alecxe 7.5k points
0 votes
1 answer 10 views
1 vote
1 answer 16 views
16 views
Problem: I am having fundamental knowledge on C#. Currently I am unable to connect to the HTTPS server with the use of WebRequest as I am facing below error message: "The request was aborted: Could not create SSL/TLS secure channel." I understand that my ... my server never really validates a certificate and it fails with a above error. Kindly guide me in fixing above certificate related error.
asked Jun 30, 2020 Raphael Pacheco 4.9k points