'Word Powershell Page Numbers

I'm currently using PowerShell to create word documents and deploy them to users on the network. I have added page numbers in using the following line of code. As it stands it just puts the number on in the footer but I have been asked if I can put it on so it says Page 1 of 2 and Page 2 of 2 etc. Is there a way to do this in PowerShell?

[void]$Section.Footers(1).PageNumbers.Add($wdAlignPageNumberCenter)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source