There are some cases, where you have a USB device which requires more power than regular devices, like for example some USB Miners where the required power is at least 2A.
The same is when you want to connect a lot of USB devices on your PC, like HDDs. Then, a powered HUB is needed. There are many solutions, like this USB power cable (still powered by the PC), this 5VUSB 5v power injector or a Powered USB Hub. But let's see and another solution, where you can get any power your device needs.
This circuit is very easy and cheap to make (~$5, without the PS). It connects on any USB port and can supplied by any source with 9-12VDC.
When Q1 take power on its base (like when the PC in turned on), then triggers the Q2, which is a ast Switching Power MOSFET and then allows power to pass within and power up the device. After the PC is turned off, Q1 closes and alongside the Q2, disallowing any power to pass.
In the circuit, the Q1 is a PN100, but is difficult to find it. As alternative, use any equivalent (2N2222, BC107, BC147, BC547, 2N2369). I used an BC147 and in the above image, i added BC147's connectors.
Take any male to female USB cable and cut it in half. Use these plugs to make this project.