Microsoft does not recommend changing the master page in SharePoint Online. Though custom master pages are still supported, but you cannot completely control when the next updates are applied, that may break your customization. With this limitation, adding any scripts always comes across as a challenge.
Here is a sample command:
- Name is the unique identifier under which script will be registered. Can also be used to remove any specific script.
Getting Started with PnpPowerShell Commands
GitHub has good documentation on getting started with PnpPowerShell commands. Installation requires installing the setup files and running Install-Module commands.
Quick Tip: You may get following error while running this command: “The term ‘Install-Module’ is not recognized…”. Try running PowerShell command prompt as an administrator.