3

I am working on a project where I have to validate the Platform for Intel Atom processor and Windows 7 OS.

I have Used:

ManagementClass mgmt = new ManagementClass("Win32_Processor");
//for Intel Atom, "Win32_OperatingSystem" for Win 7 OS

Now, This Logic is working fine when login as Admin or Standard user, But When login as Guest User I am getting System.UnauthorizedAccessException in method:

void ThrowExceptionForHRInternal(Int32, IntPtr)
description: Access is denied

Is there any restriction for the Guest Account to fetch Platform details?

Aamir
  • 14,882
  • 6
  • 45
  • 69
user724789
  • 521
  • 1
  • 4
  • 3
  • Normally this validation is done as part of application installation. And to install application you usually required to be an administrator. Why does not this work for you? What kind of application this is and what is the reason for this validation? If you have to validate at run time and not at the installation time you can have a service running under elevated account that fetches the data and feeds them to the application, but I can't imagine a scenario, where this could be useful. Can you tell me more about your app? – Andrew Savinykh Apr 26 '11 at 06:17
  • Related, but not a duplicate: http://stackoverflow.com/questions/2796930/how-to-get-system-information-in-guest-account-c – alex Apr 26 '11 at 06:18
  • The Requirement is like, you have to validate the plateform every time when you are launching the app. – user724789 Apr 26 '11 at 06:24
  • @user724789: What exactly does 'validate the platform' mean? Have you tried using System.Environment? – alex Apr 26 '11 at 06:27
  • Can we get Processor and OS information from System.Enviroment? – user724789 Apr 26 '11 at 06:39
  • >>"The Requirement is like, you have to validate the platform every time when you are launching the app" It helps to understand why. Could you explain? – Andrew Savinykh Apr 26 '11 at 07:28

1 Answers1

3

Yes they are.

You will not get around this without dcom changes or impersonation. I am not able to test it right now but I am quite sure the Environment class will throw a exception also.

You simply have restricted access as guest and that included most wmi access and most environment access that goes further than username. And impersonation is a bad thing in this context that I wouldn't do. I am not even sure that it will work for you in that case or just throws another Exception.

sra
  • 23,820
  • 7
  • 55
  • 89