I am configuring a local application user (part of BUILTIN\Users) on a Windows 7 kiosk. The kiosk has a special USB device running on a virtual COM port. The user needs permission to read the WMI class, MSSerial_PortName
, in the root\WMI
namespace, to find the COM port. In PowerShell (which I'm using to verify the configuration)
PS> Get-WmiObject -namespace 'root\WMI' -class 'MSSerial_PortName'
and by regular .NET code (which is how the application is written)
ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSSerial_PortName");
I get "access denied" errors unless running as an Administrator or elevated session. I have read plenty of Q&A on similar access problems, but most seem to recommend running as Administrator. That's not an option for this user/kiosk/configuration. And, at the moment, I am unable to use the managed wrapper from the device vendor.
I played around in the Microsoft Management Console, loading the WMI Control, and modified the Properties | Security | namespace: Root\WMI. I set the Users group to have the same permissions as the Administrators group. But that didn't work (I was just guessing anyway).
I can't find any MSDN documentation on MSSerial_PortName
the MSSerial
"base" class or other related classes in the namespace (as suggested by this article). And I don't know anything else about WMI security.
I hit the same wall today. This works for me temporarily...
I've found another way in PowerShell and it does not require admin privileges:
Unfortunately it does not give you portname in COMx form, but using a simple text parsing you should be able to extract the port name from device name.