Login script ran as admin RRS feed

  • Question

  • I have created a small powershell script that I have added using GPA to run during login or users. Problem is that it works fine for admin accounts but not for normal users. Is there a way to force this script to run as admin each time?

    I've searched and found a few saying to use scheduled task instead but I have a message box that needs to appear as a warning for certain event that seem to make it hang if using as tasks.

    Friday, April 19, 2019 1:14 PM

All replies

  • A logon script runs AS the logged on user. If this user isn't an admin it's not gonna work. If you run this script as another user (admin) for the logged on user this user will never see the interactive message box appearing for the admin user.

    The issue is not about scripting - it is about scope.

    Live long and prosper!


    Friday, April 19, 2019 1:30 PM
  • Scripts that require administrator privileges should only be run by Administrators.

    However, if the script does something that can be performed by a local Administrator, then perhaps it can run as a Startup script. Startup scripts run with the permissions of the local computer account. Such a script cannot modify user settings. And of course, no one will see any interactive message box. Why is the message box required?

    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    Friday, April 19, 2019 2:12 PM
  • I have a O drive configured for my outlook OST files. I applied GPO to have the OST files saved to the O drive and to have it cache 12 months. My script essentially just makes sure the O drive is present and if its not it removed the GPO for the cache files. The message box is to let the users know there is a problem with the O drive and to advise support.
    Friday, April 19, 2019 7:03 PM