6 Replies - 997 Views - Last Post: 10 June 2010 - 11:57 PM Rate Topic: -----

#1 Adkins   User is offline

  • D.I.C Addict
  • member icon

Reputation: 66
  • View blog
  • Posts: 560
  • Joined: 27-October 09

Modifying or checking user rights

Posted 10 June 2010 - 02:25 AM

So here is the deal. I am trying to check if a user has the rights to start a service. It will be in an installation program, that will check for this right, then run the MSI, then start the server that was installed. I am really hung up on how to do the check. Also is it possible to change the rights (temporarily) so that the server's service can be started after the install? Thanks for any help, input, or boots in the right direction!
Is This A Good Question/Topic? 0
  • +

Replies To: Modifying or checking user rights

#2 elbielefeld   User is offline

  • D.I.C Head

Reputation: 70
  • View blog
  • Posts: 217
  • Joined: 18-May 10

Re: Modifying or checking user rights

Posted 10 June 2010 - 09:50 AM

Hi,

easiest way would be to check for administrator rights.
Was This Post Helpful? 0
  • +
  • -

#3 Frinavale   User is offline

  • D.I.C Addict
  • member icon

Reputation: 205
  • View blog
  • Posts: 776
  • Joined: 03-June 10

Re: Modifying or checking user rights

Posted 10 June 2010 - 10:53 AM

Have you seen the WindowsPrincipal class?

It lets check the Windows group membership of a Windows user....it let's you check if the user is an administrator etc. (see the linky because it has code examples etc)

-Frinny
Was This Post Helpful? 0
  • +
  • -

#4 Adkins   User is offline

  • D.I.C Addict
  • member icon

Reputation: 66
  • View blog
  • Posts: 560
  • Joined: 27-October 09

Re: Modifying or checking user rights

Posted 10 June 2010 - 11:47 AM

The problem is that not every administrator has the built in right to explicitly start services like that. I have found more often than not with System Administrators (that is no Domain administrators) actually don't have the needed rights.

@Frinavale - I have looked into WindowsPrincipal class. Again the problem is that I don't have an exact user group that I have found that has the rights I need.
Was This Post Helpful? 0
  • +
  • -

#5 elbielefeld   User is offline

  • D.I.C Head

Reputation: 70
  • View blog
  • Posts: 217
  • Joined: 18-May 10

Re: Modifying or checking user rights

Posted 10 June 2010 - 10:04 PM

Do you really mean start service?
Or do you mean "Logon as service"?

If you mean logon as service, have a look at the Ntrights.exe from the W2K3 Resource Kit:
http://support.micro....com/?id=279664
Was This Post Helpful? 0
  • +
  • -

#6 Adkins   User is offline

  • D.I.C Addict
  • member icon

Reputation: 66
  • View blog
  • Posts: 560
  • Joined: 27-October 09

Re: Modifying or checking user rights

Posted 10 June 2010 - 11:45 PM

sorry. I did in fact mean "Logon as service."

NTrights.exe looks perfect except that support for it is being discontinued because it is geared towards Windows 2000. Does anyone know of any built in functionality that comes standard with .NET or any third party libraries that have this kind of power. I am assuming not, as normally you don't want to mess with user rights programmatically for fear of facing the wrath of Admins :P but I still hope to find something.
Was This Post Helpful? 0
  • +
  • -

#7 elbielefeld   User is offline

  • D.I.C Head

Reputation: 70
  • View blog
  • Posts: 217
  • Joined: 18-May 10

Re: Modifying or checking user rights

Posted 10 June 2010 - 11:57 PM

Just try it. On Win7 x64 it works.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1