M
matisq
Hello
I need to run this type of code in my windows Service:
///////////////////////////////////////////////////////////////////////////////
Protected Overrides Sub OnStart(ByVal args() As String)
If User= "Administrator" Then
'do code
Else
'do nothing
End If
End
/////////////////////////////////////////////////////////////////////////////////
Can I check who is logged in to the computer with help of service?
When I try to:
/////////////////////////////////////////////////////////////////////////////////
If My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator) Then
or
If My.User.CurrentPrincipal.Identity.Name = "Administrator" Then
//////////////////////////////////////////////////////////////////////////////
It does't work (goes directly to 'Else)..
Best Regards
I need to run this type of code in my windows Service:
///////////////////////////////////////////////////////////////////////////////
Protected Overrides Sub OnStart(ByVal args() As String)
If User= "Administrator" Then
'do code
Else
'do nothing
End If
End
/////////////////////////////////////////////////////////////////////////////////
Can I check who is logged in to the computer with help of service?
When I try to:
/////////////////////////////////////////////////////////////////////////////////
If My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator) Then
or
If My.User.CurrentPrincipal.Identity.Name = "Administrator" Then
//////////////////////////////////////////////////////////////////////////////
It does't work (goes directly to 'Else)..
Best Regards