none
run bat, power shell scripts over GP

    Question

  • Hello,

    I was trying to run simple bat and also power shell script over GP on Windows Server 2012. I have followed procedure and created new GP object, linked it to OU and added to Script-> Logon section. After restarting end user PC nothing happened it seems BAT did not run even run. Any advice on how to check on what went wrong? I already tried to run "gpresult /h" and I can see script is in deployed section.





    • Edited by waer01 Wednesday, February 1, 2017 3:18 PM
    Wednesday, February 1, 2017 3:15 PM

All replies

  • Hi,

    To configure logon script

    1. Create a folder and put scripts in it
    2. Share the folder to those users so that users could run them
    3. Create a OU, and add those user, which need run the script, to the OU
    4. Create a GPO link to the users OU
    5. Navigate User Configuration\Policies\Windows Settings\scripts\logon
    6. Fill with UNC path like below
    7. Run gpupdate /force on client

    Best Regards,

    Jay


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

    • Proposed as answer by Jay GuModerator Wednesday, February 22, 2017 10:35 AM
    Thursday, February 2, 2017 11:35 AM
    Moderator
  • Hi,

    Are there any updates?

    Best Regards,

    Jay


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

    Wednesday, February 22, 2017 10:36 AM
    Moderator
  • Hi,

    If the reply above has resolved your problem, please mark it as answer as it would be helpful to anyone who encounters the similar issue.

    Thank you.

    Best Regards,

    Jay


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

    Tuesday, February 28, 2017 3:21 PM
    Moderator
  • Hi,

    Are there any updates?

    Best Regards,

    Jay


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

    Tuesday, March 14, 2017 2:52 PM
    Moderator
  • hi Jay,

    Thanks for the steps mentioned in your first reply but for some reason GP does not work for PC's in one of the branches. but it does work for PC's in other branches which are authenticating against different AD server. But all AD servers/controllers are synced and linked. so I am still looking into this issue


    MK

    Tuesday, March 14, 2017 3:30 PM
  • Hi MK,

    Did you mean that the group policy has been applied to some users?

    Due to the Logon script is under User Configuration, it applied to users instead of computers. Please try to logon the branches computers with the users, which is member of the OU.

    If it still not applied, please run gpresult /h gpreport.html and post it to us.

    Best Regards,

    Jay


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

    Wednesday, March 15, 2017 1:33 AM
    Moderator
  • hi,

    I have a few branches and a few DC's across sites. it seems gp worked in other branches but not in my branch. I have checked gpresults and I can see policy has been applied under user configuration Hello_test in this case, but did not see anything happen, no cmd window show up. Please see attached :

    .


    MK

    Wednesday, March 15, 2017 2:02 PM
  • Hi,

    Would you provide more information about the Hello_test group policy(the logon script setting)?

    Best Regards,

    Jay


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

    Wednesday, March 15, 2017 2:45 PM
    Moderator
  • yes, it is configured exactly following these steps and I made sure share is accessible via client laptop:

    1. Create a folder and put scripts in it
    2. Share the folder to those users so that users could run them
    3. Create a OU, and add those user, which need run the script, to the OU
    4. Create a GPO link to the users OU
    5. Navigate User Configuration\Policies\Windows Settings\scripts\logon
    6. Fill with UNC path like below
    7. Run gpupdate /force on client


    MK

    Wednesday, March 15, 2017 2:59 PM
  • Hi,

    Sorry, I did not make myself clear.

    I mean that the setting configuration in gpresult like below.

    Best Regards,

    Jay


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

    Wednesday, March 15, 2017 3:21 PM
    Moderator
  • is there a way so I can attach a report for you to take a look.. honestly, I cannot find that script mentioned under Settings and policies..

    MK

    Wednesday, March 15, 2017 4:12 PM
  • Hi,

    You could post the report to us with OneDrive.

    And if you do not see the script setting in gpreport like I posted, it maybe that the script is not applied to the users.

    Best Regards,

    Jay


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

    Thursday, March 16, 2017 1:57 AM
    Moderator
  • Yes, that's what I am trying to figure out why it was not applied.. Here is a link to onedrive report:

    https://1drv.ms/u/s!AnRlIceReMo7gbZ8VXPlSXrUPFLWJQ

     

    MK

    Thursday, March 16, 2017 12:40 PM
  • Hi,

    You provide gpresult like:

    It should be like:

    Please provided gpresult like second.

    Best Regards,

    Jay


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

    Thursday, March 16, 2017 1:29 PM
    Moderator
  • hi,

    if you download a document you should be able to see results like in a screenshot 2. 



    MK

    Thursday, March 16, 2017 2:22 PM
  • Hi,

    I notice that the Hello_test link to the location ad.crfhealth.com/CRFHealth Staff/ITS/Test.

    Is the location site? User OU? Computer OU?

    Best Regards,

    Jay


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

    Thursday, March 16, 2017 2:44 PM
    Moderator
  • This is OU under where users are. In this case I placed my user under ITS\test OU so GP is applied only for my user

    MK

    Thursday, March 16, 2017 3:36 PM
  • Hi,

    Did you configure other setting under User Configuration in Hello_test GPO?

    Best Regards,

    Jay


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

    Thursday, March 16, 2017 3:55 PM
    Moderator
  • yes I did, as per posts above

    MK

    Thursday, March 16, 2017 4:51 PM