I need to verify if "com ports" are disabled or enabled on windows servers, so i run this command in my script"get-itemproperty -path hklm:hardware\devicemap\serialcomm" and it shows me thisPSChildName : serialcomm PSDrive : HKLM PSProvider : Microsoft.PowerShell.Core\Registry \??\Root#PORTS#0000#{86e0d1e0-8089-11d0-9ce4-08003e301f73} : COM4 \??\Root#PORTS#0001#{86e0d1e0-8089-11d0-9ce4-08003e301f73} : COM5 Winachsf0 : COM3 If the "com ports" have been disabled in device manger then the output should not show any com ports listed or pathsSo if i change the command to say thisget-itemproperty -path hklm:hardware\devicemap\serialcomm | Select-Object -Property 'PSChildName','Winachsf0'I get this @{PSChildName=serialcomm; Winachsf0=COM3} and if i do -Property for the other paths
\??\Root#PORTS#0000#{86e0d1e0-8089-11d0-9ce4-08003e301f73}\??\Root#PORTS#0001#{86e0d1e0-8089-11d0-9ce4-08003e301f73}I would get the results for COM4 and COM5But is there a way to just get the "com" info. So that if none are found then they will have been disable but if any show then they are active and it list's which ones? Anyone how to do this? Thank you
\??\Root#PORTS#0000#{86e0d1e0-8089-11d0-9ce4-08003e301f73}\??\Root#PORTS#0001#{86e0d1e0-8089-11d0-9ce4-08003e301f73}I would get the results for COM4 and COM5But is there a way to just get the "com" info. So that if none are found then they will have been disable but if any show then they are active and it list's which ones?
Anyone how to do this?
Thank you
I can't help I'm afraid as I don't have access to a machine with COM ports
But check
Get-WmiObject -Class Win32_SerialPort
and
Win32_SerialPortConfiguration
and see if they return anything you could use