I have a USB cable that I plug my iPhone into while I'm at my desk. Often when I reach to plug it in, there is a small electric shock (especially during winter).
Will this damage anything? I know that electrical equipment can be damaged by small electric discharges. Are USB ports grounded or anything that would protect them?
Yes, USB cables are grounded, provided your computer itself is grounded. The external shield for the connection pins is required to connect to the ground wire that runs through the cable. (Source: USB 2.0 Specification)
It sounds like you are experiencing a discharge of static electricity built up by walking on the carpet etc.
The short answer is that unprotected electronic equipment can be damaged or distroyed by static electricity. That is why when you buy memory or other chips they are in special static safe packages and require special handling during installation.
Most all of the top quality devices and most average devices will include ESD protection on the USB and other connectors to protect against static.
Cheap imported electronics like USB hubs for $5 probably don't include such protection so it is always a good idea to be careful.
I've always been cursed with the ability to develop a static charge very easily.
It's never caused problems just sitting at my keyboard before. (I always discharge before I get inside to tinker)
My system recently started shutting down when I come back to my desk and discharge a shock on my keyboard tray. I've used the same configuration for quite a while. The PC is over 3 years old. I've been at this desk for 2 years and have had the keyboard tray for about a year. A month ago I moved my PC from under my desk on the left to under it on the right. However, the shocks turning off the PC only started happening within the last couple of weeks.
Even though My APC power strip "protection working" light was on. I swapped out the strip and power cable from the PC. I'm not sure what to check next.
Static discharge can cause a short which will trigger your power supply to automatically flip off.
If you are getting a lot of static in your environment, you may want to think about getting a humidifier. We had to do that for our old office. We were literally discharging every time we touched a wall or a light switch or touched a case. A humidifier will keep the air from getting too dry, and will drastically reduce the amount of static build up.
With what you say about this only happening recently, you may want to check and make sure that all your connections are good. If you have some loose connections, especially wires that may be brushing up against the case itself, it may make it more susceptible to static discharge causing it to short out.
You may be able to reduce the likelihood of this happening by grounding the metal parts of your keyboard tray. You don't need real heavy wire, I would probably just use 18 AWG. You may also be able to get away with just wrapping one end around a screw on your computer case.
If you start getting a strong shock, you may be able to put a low ohm resistor in-line with the wire.
Before doing any of this, make sure your outlet, and computer case are well-grounded.