GPO can be used to run script at computer startup and shutdown as well as User logon and logoff. These script can be windows powershell or any Windows Script Host (WSH) language.
The scripts are specified in:
User or Computer configuration/Policies/Windows Settings/Scripts
If there are multiple scripts the order in which they run can be specified as well as if powershell scripts run first or last.