Remote Procedure Call (RPC) dynamic port allocation is used by server applications and remote administration applications such as Dynamic Host Configuration Protocol (DHCP) Manager, Windows Internet Name Service (WINS) Manager, and so on.
Basically, the automation of this article.
https://support.microsoft.com/kb/154596?wa=wsignin1.0
I've added this at Script Center.
Please download at https://gallery.technet.microsoft.com/scriptcenter/RPC-Port-Allocation-using-7f1c52c1.