PrinWinPrincipal.isinrole
Hi all, I am not quite sure that this post belongs here however, here goes I am having an issue with PrinWinPrincipal.isinrole with Windows 7 Ultimate. History - Have developed using Windows Server 2003 with Windows Professional 2003 for several years and the following code worked as expected in that environment. Option Strict On Imports System.Security.Principal Imports System.Threading Imports System.IO Public Class CusAuthen Function IsAdministrator() As Boolean ' This procedure verifies whether the currently logged-in Windows user ' is an Administrator. Dim prinWinPrincipal As WindowsPrincipal = CType(Thread.CurrentPrincipal, WindowsPrincipal) 'Dim WPIN As String = prinWinPrincipal.Identity.Name ' Check if the user account is an Administrator. If prinWinPrincipal.IsInRole(WindowsBuiltInRole.Administrator) Then Return True Else Return False End If End Function End Class for login 'custuser' with administrator priveledges logged in on a Workgroup Desktop This code snippet as part of the application was ported to a WorkGroup Desktop running Windows 7 Ultimate with Visual Studio Professional 2010 and login 'custuser' and with administrator priveledges But ' If prinWinPrincipal.IsInRole(WindowsBuiltInRole.Administrator) ' Fails ( Returns False) I am not sure if I have missed something. I have had this on the back burner for several months and would appreciate any help. Thanks in Advance
July 2nd, 2011 6:49am

Hi, According to your description, I suggest you asking MSDN for further help: http://social.msdn.microsoft.com/Forums/en-US/windowsgeneraldevelopmentissues/threads The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding. Regards, Leo Huang Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
July 5th, 2011 5:36am

I ran into this also, and haven't solved it for myself, but found the article below to make a lot of sense out of it. It has something to do with UAC being in the way for Windows 7. There's a somewhat lengthy code workaround too... http://stackoverflow.com/questions/2674182/calling-iprincipal-isinrole-on-windows-7 -peace
August 13th, 2011 10:10am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics