Enable Windows Defender with PowerShell in a Client Command

Last modified by Sabrina V. on 2024/10/08 11:35

Initial situation

You can use a Client Command to install and deploy programs to all your Clients. This can be useful, for example, if you need to react quickly to security risks, such as deploying an antivirus program. With Client Commands you are not hindered by the physical distance between your employees and can control a programme centrally and in a targeted manner.

This use case describes how you can use a Client Command to install and enable the Windows Defender antivirus feature. The Windows Server 2016 operating system is used in this example to show a way to include or exclude different operating systems.
Follow the steps below:

Select Script

  1. Navigate to the Client Commands > Create module.
  2. Click Add on the ribbon bar. The Client Command Editor will open and you will need to decide whether it is a Console or Client Script. In this case select Client Script.

Select and edit the PowerShell Script Command

  1. Choose Processes and Shell > Execute PowerShell script.
  2. Double click to open the Command.
  3. Switch to the General tab.
  4. In the Action description box, type a name, for example, „Install Microsoft Defender Antivirus“.
  5. Switch to the Details tab.
  6. In the text area, type the Commands that you want to run as a PowerShell Script.
    In this case, you need to type „Install-WindowsFeature -Name Windows-Defender“ in the first line.

Hinweis  Note:  

You can copy the text area from an existing script or type it manually. Only ASCII characters can be used.

65_Use Case Client Commands_Microsoft Defender Antivirus installieren_478.png

Inserting PowerShell Script

    7. Finish your work on the Command by clicking OK.

Inserting and customising the If operating system is (not) Command

  1. Load the If operating system is (not) (Conditions) Command into the Script by double clicking it in the Command List, just like the previous Command.
  2. Ensure that the "If operating system ist" option is selected in the Details tab.
  3. Select the required operation system from the Settings.
    In this example, Windows Server 2016 is selected.
  4. Switch to the General tab.
  5. Enter a meaningful description of the action, e.g. "The operating system is "Windows Server 2016"".
  6. Click OK to complete the Command.

65_Use Case Client Commands_Betriebssystem auswählen_484.png

Select operating system

Insert and edit the Execute PowerShell Script Command

  1. Choose Processes and Shell > Execute PowerShell Script.
  2. Double click the Command to open it. 

Hinweis  Note:  

Indent this Command by using either the quick selection bar or the CTRL+right arrow shortcut so that it appears below the previous Command. When adding this Command, you can also simply drag it to the operating system line, which will insert it correctly.

       3. Type the Commands that you want to run as PowerShell Scripts in the text area.
       4. In this case, you need to type "Install-WindowsFeature-Name Windows-Defender-GUI" in in the line.

Hinweis  Note:  

You can copy the text area from an existing script or type it manually. Only ASCII characters can be used.

      5. Switch to the General tab.
      6. Enter a name under Action description, for example "Enable GUI".

65_Use Case Client Commands_Execute PowerShell script.png

Enter a Defender GUI

     7. Close the Command by clicking OK.

Save your Client Command and name it. In this case, we have named this example "Activate Microsoft Defender using PowerShell".

65_Use Case Client Commands_Microsoft Defender über PowerShell aktivieren_1083.png

Client Command Editor: Enable Defender via a Client Command

 

Running through Client Command phases

Before you can use the Client Command, you must go through the Test, Synchronize, Release and Execute phases. Only then can you install and enable Microsoft Defender on the selected Clients.

© Aagon GmbH 2024
Besuchen Sie unsere neue Aagon-Community