By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,684 Members | 1,439 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,684 IT Pros & Developers. It's quick & easy.

Access Denied to use WMI getting remote resource

P: n/a
I have the access denied on my ASP.NET C# program while deploy my project from my PC (WinXP) to Server 2003
The program works fine on my PC but get access denied on Server 2003.

However the program works fine on Windows Server 2003 while trying to use WMI to get resource from the itsself computer, just has the problem while remoting to other computer.

I did put the permission of all security to "Everyone" on "Windows Managment and Instrustmentation" in Component Service, or even put the ASP.NET account is as a group of Administrators and no help, did I do anything wrong? Thank you.

Here is the stack trace:
[UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))]
System.Runtime.InteropServices.Marshal.ThrowExcept ionForHRInternal(Int32 errorCode, IntPtr errorInfo) +0
System.Management.ManagementScope.InitializeGuts(O bject o) +784
System.Management.ManagementScope.Initialize() +216
System.Management.ManagementScope.Connect() +5
_Default.showUserList(String password, String server) +293
_Default.btnSubmit_Click(Object sender, EventArgs e) +58
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102

Here is some of the code in "Default.aspx"

Protected Sub showUserList(ByVal password As String, ByVal server As String)
If server = "" Then
MS = New ManagementScope("\\.\root\cimv2")
MS.Connect()
objQuery = New System.Management.ObjectQuery("Select Name from Win32_UserAccount")
Else
conn.Username = "administrator"
conn.Password = password
MS = New ManagementScope("\\" & server & "\root\cimv2", conn)
MS.Connect()
objQuery = New System.Management.ObjectQuery("Select Name from Win32_UserAccount")
End If
.........
End Sub
Jun 7 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hello LamSoft,

Maybe this helps http://dotnetjunkies.com/Forums/Show...x?PostID=11159
guys discussed the same problem

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

LSystem.Runtime.InteropServices.Marshal.ThrowExcep tionForHRInternal
L>
Jun 7 '07 #2

P: n/a
I changed the processModel back to machine from system. system runs as
localsystem with high permissions while machine runs as low privilege user
account.

Sorry, I don't understand that guy meaning, what is the processModel and
where he changed the permission?
Thanks

"Michael Nemtsev" <ne*****@msn.comwrote in message
news:a2***************************@msnews.microsof t.com...
Hello LamSoft,

Maybe this helps
http://dotnetjunkies.com/Forums/Show...x?PostID=11159
guys discussed the same problem

---
WBR, Michael Nemtsev [.NET/C# MVP]. My blog:
http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

LSystem.Runtime.InteropServices.Marshal.ThrowExcep tionForHRInternal
L>

Jun 7 '07 #3

P: n/a
Hello LamSoft,

MSDN will help u http://msdn2.microsoft.com/en-us/library/7w2sway1.aspx

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

LI changed the processModel back to machine from system. system runs
Las localsystem with high permissions while machine runs as low
Lprivilege user account.
L>
LSorry, I don't understand that guy meaning, what is the processModel
Land
Lwhere he changed the permission?
LThanks
L"Michael Nemtsev" <ne*****@msn.comwrote in message
Lnews:a2***************************@msnews.microso ft.com...
L>
>Hello LamSoft,

Maybe this helps
http://dotnetjunkies.com/Forums/Show...x?PostID=11159 guys
discussed the same problem

---
WBR, Michael Nemtsev [.NET/C# MVP]. My blog:
http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/
"The greatest danger for most of us is not that our aim is too high
and we miss it, but that it is too low and we reach it" (c)
Michelangelo

LSystem.Runtime.InteropServices.Marshal.ThrowExce ptionForHRInternal
L>

Jun 7 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.