I created a batch logon script that checks and removes old versions of a specific piece of software and installs the newest version. Both the install and uninstall process use an .EXE file. The script works great if the user is an administrator, but because logon scripts are run with user permissions, it fails with a normal end-user account.

What is the best way to have the logon script run as an administrator?

  • There's a product called PowerBroker that I've used in the past with logon scripts. We already owned the product, though. It might be overkill for your particular use. – Katherine Villyard May 3 '16 at 17:59

This is a poor use case for login scripts. A startup script or a scheduled task can both easily run as the SYSTEM account take care of your software installation.

Generally I suggest using some kind of deployment system - SCCM, Patch Manager, Puppet, etc - but there is a quick and dirty solution available if you have a 2008+ domain.

Basically it is scheduled task deployed as a group policy preference. This can be run under the SYSTEM account to provide admin rights. Combined with item level targeting you can easily install only when your conditions are met.

  • 1
    Agreed -- this is the wrong tool for the job. Use of Puppet would be a lot easier (and smarter in the long term). – Shyatic May 2 '16 at 19:56

Is it necessary to use a logon script? I normaly try to do as much as possible with startup scripts... These run in system context with highest privileges.

  • I don't believe a startup script will work for me. Only a small group of end-users in different OUs need this application installed, so I don't want it to run on every PC. – iFetus May 3 '16 at 15:42
  • If you know the PCs, create a group, put the computer accounts in and target the GPO with the startup script at that group. – Robert R May 5 '16 at 13:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.