I need a script to find out what devices are active

Hi,
I have a computer which runs on windows XP and I am looking to use a script either VBS or batch in order to find out what devices are active at that instant. The structure of the code should be something similar to this IF the Printer is plugged In:
Show Dialog: Your HP Printer is plugged in.
ELSE: Do nothing.
Anyone who has the knowledge in this field please help.
