To power the encoder using the 5 V pins on the NI 9411 module, you have to plug in an external power supply to the Vsupp and COM terminals on the NI 9411.
Depending on your encoder, it might be needed to to add a pull-up or pull-down resistors to get appropriate measurements. Those resistors are needed to make sure the appropriate voltage levels are provided to the Digital Input. Refer to the NI 9411 Datasheet
to learn more about the required logic levels and other relevant specifications.
Not all encoders have a Z output. If your encoder does not, just leave the corresponding channels unwired.