return undef for empty list

This allows proper fallback on pkg command if needed.
return immediatly in case of failure
fix WMI call mocking
use logger if avalailable only
this is not an hash
fix registry key name
pass the logger object
fix logic error, and use better error messages