Set PowerShell script or batch file to run before user logs into Windows 10 computer

IT Guy
IT Guy used Ask the Experts™
on
Is it possible to set a PowerShell script or batch file to run before a user logs into a Windows 10 computer that is a member of a Server 2016 Active Directory domain?

If so how can this be done?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2014

Commented:
You can set a computer startup script to run via Group Policy.  This will run before any user logs on.

A user logon script will run at the time of logon.  If you need the script to run in the context of the user logging in, you can't have it run before that user logs in because it has no idea what user will be logging in, and has no access to the session, user permissions, etc.
IT GuyNetwork Engineer

Author

Commented:
Can someone please provide me with the exact steps on how to set a computer startup script to run via Group Policy that will run before any user logs on?
Technical Specialist
Awarded 2017
Distinguished Expert 2018
Commented:
Wrong image, should be a network path or relative path to GPO
startup-script-3-e1427833355513-1-.png
Distinguished Expert 2018
Commented:
But keep in mind that startup scripts will only run after restarts and not after shutdown - restart. That is due to thefeature "fast startup" that win8 and win10 are using. If unclear what I am talking about: https://www.experts-exchange.com/articles/25279/Overcoming-software-deployment-pitfalls-on-modern-Windows.html has all the theory and all the steps to overcome this limitation. The systems will detect policy changes and disable fast startup if configured using the steps in that article.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial