Permission problem with System.Diagnostics.Process.GetProcesses(MachineName)
-
Hi all, whenever use this little section of code i get a permission error. I have admin rights to all the boxes i want to check but im not sure how to pass admin credentials to the machines to can get use the GetProcesses method code follows: foreach (System.Diagnostics.Process proc in System.Diagnostics.Process.GetProcesses(MachineName)) { try { textBox3.AppendText("Proc Name: " + proc.ProcessName.ToString() + " @ " + proc.StartTime.ToString() + "\n"); } catch { } }
-
Hi all, whenever use this little section of code i get a permission error. I have admin rights to all the boxes i want to check but im not sure how to pass admin credentials to the machines to can get use the GetProcesses method code follows: foreach (System.Diagnostics.Process proc in System.Diagnostics.Process.GetProcesses(MachineName)) { try { textBox3.AppendText("Proc Name: " + proc.ProcessName.ToString() + " @ " + proc.StartTime.ToString() + "\n"); } catch { } }
What Permission Error it says?
Regards, Satips.:rose:
-
What Permission Error it says?
Regards, Satips.:rose:
-
Try with LOGON32_LOGON_NETWORK (value 3) as LogonType, the token returned by LogonUser is an "impersonation token", such a token CANNOT be used in WindowsIdentity.Impersonate() in order to access network resources. Then go with the code.
Regards, Satips.:rose:
-
Try with LOGON32_LOGON_NETWORK (value 3) as LogonType, the token returned by LogonUser is an "impersonation token", such a token CANNOT be used in WindowsIdentity.Impersonate() in order to access network resources. Then go with the code.
Regards, Satips.:rose:
-
Hi all, whenever use this little section of code i get a permission error. I have admin rights to all the boxes i want to check but im not sure how to pass admin credentials to the machines to can get use the GetProcesses method code follows: foreach (System.Diagnostics.Process proc in System.Diagnostics.Process.GetProcesses(MachineName)) { try { textBox3.AppendText("Proc Name: " + proc.ProcessName.ToString() + " @ " + proc.StartTime.ToString() + "\n"); } catch { } }
Are all these machines in the same domain, or is this a Workgroup environment? If domain, then the code has to run under an admin account that the domain trusts. If workgroup, then the Admin account username AND password must match those on the machine that's running your code, exactly, meaning exact same username and exact same password. This really isn't caused by a problem in your code. It's more of an understanding of how Windows networking works.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Are all these machines in the same domain, or is this a Workgroup environment? If domain, then the code has to run under an admin account that the domain trusts. If workgroup, then the Admin account username AND password must match those on the machine that's running your code, exactly, meaning exact same username and exact same password. This really isn't caused by a problem in your code. It's more of an understanding of how Windows networking works.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007its a domain i am an admin to my machine and my log on gives me admin rights to all the computers i need to access also i know the cred's to THE admin account across all the computers from my session on my laptop i can see and access all the computers (\\usat-whatever\c$\whatever)
-
Hi all, whenever use this little section of code i get a permission error. I have admin rights to all the boxes i want to check but im not sure how to pass admin credentials to the machines to can get use the GetProcesses method code follows: foreach (System.Diagnostics.Process proc in System.Diagnostics.Process.GetProcesses(MachineName)) { try { textBox3.AppendText("Proc Name: " + proc.ProcessName.ToString() + " @ " + proc.StartTime.ToString() + "\n"); } catch { } }
Hello Have you got the solution of your problem...if yes then plz tell me because i am facing the same problem... Thanks
Devesh Mishra
-
Hello Have you got the solution of your problem...if yes then plz tell me because i am facing the same problem... Thanks
Devesh Mishra
-
its a domain i am an admin to my machine and my log on gives me admin rights to all the computers i need to access also i know the cred's to THE admin account across all the computers from my session on my laptop i can see and access all the computers (\\usat-whatever\c$\whatever)
Well, you need an account that gives you admin rights to all the machines. Your code is saying that the account it's running under doesn't have it. Just having access to the hidden shares on the machines isn't enough.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Well, you need an account that gives you admin rights to all the machines. Your code is saying that the account it's running under doesn't have it. Just having access to the hidden shares on the machines isn't enough.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007well i do know the "administrator" and its password account for each box i need how would i pass that to the machine -- modified at 9:19 Monday 18th June, 2007 for example lets say i usually log in as User:administrator Pass:crash893 to the local machine how would i pass that too the get proccess method so that the computer on the other end would know its me?
-
well i do know the "administrator" and its password account for each box i need how would i pass that to the machine -- modified at 9:19 Monday 18th June, 2007 for example lets say i usually log in as User:administrator Pass:crash893 to the local machine how would i pass that too the get proccess method so that the computer on the other end would know its me?
Well, it might be you can do something like:
System.Threading.Thread.CurrentThread.CurrentPrinciple = New System.Net.NetworkCredential("user","pw")
or something along those lines. I HAVE NO IDEA IF THIS WILL WORK!! I HAVE NOT TESTED IT AND DON'T HAVE AN ENVIRONMENT TO TRY IT IN!!
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Well, it might be you can do something like:
System.Threading.Thread.CurrentThread.CurrentPrinciple = New System.Net.NetworkCredential("user","pw")
or something along those lines. I HAVE NO IDEA IF THIS WILL WORK!! I HAVE NOT TESTED IT AND DON'T HAVE AN ENVIRONMENT TO TRY IT IN!!
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
that looks very promising i will try it at work tommrow would i run that at form load? or in the event? edit did you mean CurrentCulture i dont see anything else close?