• Register
0 votes

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)
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

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 113 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 291 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 94 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 15 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 Aliza313 720 points
0 votes
2 answers 252 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