Yes, adding the script via the group policy editor is the correct method.
https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/dn789190(v=ws.11)
--please don't forget to Accept as answer if the reply is helpful--