We have run into a situation where some user accounts on a small number of PCs are getting:
Access is denied: 0x80070005 (E_ACCESSDENIED)
when trying to get to a portion of the application that is looking for the COM port that has a barcode scanner attached to it.
I'm thinking it's breaking in one of the following sections of code:
Public Shared Function ProcessConnectionOptions() As ConnectionOptions Dim options As New ConnectionOptions() options.Impersonation = ImpersonationLevel.Impersonate options.Authentication = AuthenticationLevel.[Default] options.EnablePrivileges = True Return options End Function
Public Shared Function ConnectionScope(ByVal machineName As String, ByVal options As ConnectionOptions, ByVal path As String) As ManagementScope Dim connectScope As New ManagementScope() connectScope.Path = New ManagementPath("\\" & machineName & path) connectScope.Options = options connectScope.Connect() Return connectScope End Function
Dim options As ConnectionOptions = ProcessConnection.ProcessConnectionOptions() Dim connectionScope As ManagementScope = ProcessConnection.ConnectionScope(Environment.MachineName, options, "\root\CIMV2") Dim objectQuery As New ObjectQuery("SELECT * FROM Win32_PnPEntity WHERE ConfigManagerErrorCode = 0") Dim comPortSearcher As New ManagementObjectSearcher(connectionScope, objectQuery)
Is there a particular permission that a specific user account has to have in order to be able to access the COM ports on a PC?
User contributions licensed under CC BY-SA 3.0