Startup Batch Script not applying through GPO

Chauhan, Aniket 10 Reputation points
2023-02-07T20:48:24.4733333+00:00

Here is the configuration for my startup script. Basically The script includes 1 line to enable bitlocker which requires administrative privileges to run the batch script. How do i pass the parameter so my batch script runs at startup

My script parameters are powershell.exe -executionpolicy bypass -file "bitlocker.ps1"

The batch file content is

@Echo off

manage-bde -on C: -recoverypassword -skiphardwaretest

when i run the script as an administrator locally, the script runs fine, so i believe it has something to do with parameters i have passed on. Can someone help me out with this question ?

User's image

Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
4,802 questions
0 comments No comments
{count} vote

3 answers

Sort by: Most helpful
  1. Daisy Zhou 18,721 Reputation points Microsoft Vendor
    2023-02-09T07:28:08.9633333+00:00

    Hello @Chauhan, Aniket,

    Thank you for posting in our Q&A forum.

    I understand you deploy the startup script via domain GPO.

    You can try the steps below.

    1. Create a GPO and rename it (such as "startup script to enable bitlocker").
      2.Create an OU and rename it (such as PC) and put the machine which you run the script as an administrator locally to this OU to test the script.
      3.Link the GPO "startup script to enable bitlocker" to OU "PC".
      4.Put the script file to the path below (for example):

    \a.com\SYSVOL\a.com\Policies{5EE96627-35BD-434C-9C6A-4AE328E7D13A}\Machine\Scripts\Startup
    ss2

    5.Edit the gpo as below:
    script

    Check if gpo applies.
    1.Check if you can access the script file on domain machine above.
    2.Start up the domain machine above and check if the script takes effect.
    3.Logon the domain machine using domain administrator.
    Open CMD and run gpresult /h C:\gpo.html and click Enter.
    Open gpo.html and check if you can see gpo setting under "Computer Details".

    Hope the information above is helpful. If you have any question or concern, please feel free to let us know.

    Best Regards,

    Daisy Zhou

    ===============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.


  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    1 deleted comment

    Comments have been turned off. Learn more

  3. Chauhan, Aniket 10 Reputation points
    2023-02-09T16:28:34.9533333+00:00

    Hi everyone,

    As Daisy mentioned, i have the script setup in the same location, although it is a batch script. If i run my script locally as an administrator, it turns on the bitlocker just fine but the script does not run through GPO. I have also tried setting up the scheduled task but it does not run through GPO. what should be my script paramaters in the GPO for the batch script, is what i have setup correct ?