Here is the pin out on a normal ATX Power supply:

DescriptionWire colorPin numberPin numberWire colorDescription
+3.3 voltsOrange113Orange+3.3 volts
+3.3 voltsOrange214Blue-12 volts
GroundBlack315BlackGround
+5 voltsRed416Green
PS_ON#
GroundBlack517BlackGround
+5 voltsRed618BlackGround
GroundBlack719BlackGround
PWR_OKGray820White-5 volts (optional)
VSB +5 voltsPurple921Red+5 volts
+12 voltsYellow1022Red+5 volts
+12 voltsYellow1123Red+5 volts
+3.3 voltsOrange1224BlackGround

Here is the Pin out of the HP EliteDesk 800 G2 P1 connector:

DescriptionWire colorPin numberPin numberWire colorDescription
GroundBlack14Yellow+12 volts
GroundBlack25Yellow+12 volts
-12 voltsBlue36Purple+12 volts standby

Here is the Pin out of the HP EliteDesk 800 G2 P2 connector:

DescriptionWire colorPin number
EmptyNone1
EmptyNone2
PWR_OKGray3
PS_ON#Green4
TACWhite5
FANCMDWhite/Red6

Here is the Pin out of the HP EliteDesk 800 P3 connector:

DescriptionWire colorPin numberPin numberWire colorDescription
GroundBlack13Brown+12 volts
GroundBlack24Brown+12 volts

I will be doing this soon but basically you match all the colors of the P1 and P2 cables to the colors on the normal power supply. The purple needs converted from +5v to +12v. I bought this on Amazon to do that.

The White Cable from the P2 connector can be connected to the Gray cable on the CHFAN2 plug to resolve the fan error on boot.

The White/Red cable from the P2 connector does not need to be used and can be taped off. This cable controls the fan inside the original PS.

The P3 connector is the same connector as a normal power supply so just use the one on the normal power supply to power the CPU.

Well just now while typing all of the above I got the correct cable I ordered to do this modification and will be using the cable. Hope the info above can be helpful to someone. I ordered this:

https://www.moddiy.com/products/HP-Z240-PSU-Main-Power-24-Pin-to-6-Pin-Adapter-Cable-30cm.html

The only difference I see on their cable is on Connector P2 they put pin 1 to pin 17 on the ATX power supply which is ground.

References:
https://www.moddiy.com/pages/Power-Supply-Connectors-and-Pinouts.html
https://superuser.com/questions/869600/what-is-the-6-pin-power-connector-on-an-hp-prodesk