Group policy on domain controller VM, to run a run command

ZM-3283 65 Reputation points
2024-09-04T20:57:48.46+00:00

i have 58 vms all on the same domain, I require to run a specific command on each of those vms

However instead of doing it one by one, I'm aware I can do a Group policy on domain controller VM, to run the command to all the vms at one go.

However i haven't done this before and documentation I've used hasn't helped me.

Could i get a step by step guide on how to do it?

script is

Set-MpPreference -EnableNetworkProtection Enabled
Set-MpPreference -AllowNetworkProtectionOnWinServer 1
Set-MpPreference -AllowNetworkProtectionDownLevel 1
Set-MpPreference -AllowDatagramProcessingOnWinServer 1
Windows for business Windows Client for IT Pros Directory services Active Directory
Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2024-09-05T00:40:02.82+00:00

    Hi,

    You can create a group policy to run a startup script. Please follow these steps:

    1. Open the Group Policy Management Console (GPMC): You can do this by typing gpmc.msc in the Run dialog (press Win + R to open the Run dialog).
    2. Create a New Group Policy Object (GPO): Right-click on the domain or organizational unit (OU) where you want to create the GPO, and select "Create a GPO in this domain, and Link it here...". Give your GPO a name.
    3. Edit the GPO: Right-click on the newly created GPO and select "Edit". This will open the Group Policy Management Editor.
    4. Navigate to the Scripts (Startup/Shutdown) Section: In the console tree, go to Computer Configuration -> Policies -> Windows Settings -> Scripts (Startup/Shutdown). User's image
    5. Add the Startup Script: In the results pane, double-click on "Startup". In the Startup Properties dialog box, click "Add". In the Add a Script dialog box, do the following:
      • In the "Script Name" field, type the path of the script, or click "Browse" to search for the script file in the Netlogon shared folder on the domain controller.
      • In the "Script Parameters" field, type the parameters you want (if any), exactly as you would type them on the command line.
    6. Specify Script Options: In the Startup Properties dialog box, specify the options that you want. If you assign multiple scripts, the scripts are processed in the order that you specify. You can move a script up or down in the list by selecting it and clicking "Up" or "Down".
    7. Apply and Close: Click "OK" to apply the settings and close the dialog boxes.

    For more detailed instructions, you can refer to this link.

    https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/dn789196%28v=ws.11%29

    Best Regards,

    Ian Xue


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

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.