none
GPO Startup Script to Delete Logs Not Running

    Question

  • Hello,

    I am trying to run the following command below as a GPO startup script on windows 7 PCs and it is not working. The purpose of the script is delete the logs in the folder below at startup. I have tested the script locally on a windows 7 PC and it works fine.

    I am not great at writing scripts and could use some help or if someone know a better way I am open to anything that works even a powershell scipt.

    set folder="C:\Users\%username%\AppData\Roaming\Thomson Reuters\Checkpoint<< Tools Framework"

    cd /d %folder%

    del *.log


    cshsysadmin

    Tuesday, February 2, 2016 8:32 PM

Answers

  • Hi,
     
    When you run a script as part of GPO, you’ll need to decide what security context it will run under. If you run this script as a Startup script in GPO, then it will run under the computer security context.
     
    For your specific script, you are accessing a user's "AppData\Roaming" folder. Try to deploy it as a Logon script instead, this way it will run under the user's own security context.
     
    For any specific question about the script itself, you might want to try in our dedicated scripting forum:
     
    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
     

    Regards,

    Ethan Hua


    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com

    Wednesday, February 3, 2016 6:16 AM
    Moderator

All replies

  • Hi,
     
    When you run a script as part of GPO, you’ll need to decide what security context it will run under. If you run this script as a Startup script in GPO, then it will run under the computer security context.
     
    For your specific script, you are accessing a user's "AppData\Roaming" folder. Try to deploy it as a Logon script instead, this way it will run under the user's own security context.
     
    For any specific question about the script itself, you might want to try in our dedicated scripting forum:
     
    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
     

    Regards,

    Ethan Hua


    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com

    Wednesday, February 3, 2016 6:16 AM
    Moderator
  • Ethan,

    I changed it from a startup script to a logon script and appears to be working now. Thanks for the suggestion.


    cshsysadmin

    Wednesday, February 3, 2016 3:50 PM