# Active Directory Windows Agent Installation

## Option 1: Prepare the MSI Package

* Please navigate to "Settings & Reporting" -> "Deployment Settings" page.
* On that page, copy your tenant-specific URL parameter and then download the MSI (x64) installer.

**Note**: The URL parameter is tenant-specific. Do not share it outside your organization.&#x20;

## Option 2: Prepare the EXE Package

* Please navigate to "Settings & Reporting" -> "Deployment Settings" page.
* On that page download the EXE agent.&#x20;

**Note**: The agent is tenant-specific. Do not share it outside your organization

## Deploy Agent with Bat/PowerShell Script

* Please navigate to "Group Policy Managment" and create a new GPO under the OU.

<figure><img src="/files/9Zk5a77qyEdecOX7gEGA" alt=""><figcaption></figcaption></figure>

* The GPO name can be "CyberCyte\_Installation".

<figure><img src="/files/AYwHmXje6WFfF2MUH9Kc" alt=""><figcaption></figcaption></figure>

* Under the "Scope" -> "Security Filtering" add Domain Computers and Domain Users.

<figure><img src="/files/u0I4rLowP6HRVGvpariU" alt=""><figcaption></figcaption></figure>

* Right-click on the GPO and select "Edit".

<figure><img src="/files/JGL7X0RnAzY4P3SBuUEp" alt=""><figcaption></figcaption></figure>

* The "Group Policy Managment Editor" will appear. Please navigate to "Computer Configuration" -> "Policies" -> "Windows Settings" -> "Scripts (Startup/Shutdown)".

<figure><img src="/files/qjvgOBafGpiMHw2Yd0rE" alt=""><figcaption></figcaption></figure>

* Double-click on the "Startup" and add the script. The script can be .bat format or .ps1 format, it is optional. Please make sure the script location is under the default script path, e.g:“\\\dc01\sysvol\domain.local\scripts\install.bat”.
* Also, please upload CyberCyte package under the default script path, same as the startup script. The script and the package should be in the same directory for proper installation.
* Click "Apply" and exit.
* Run "gpupdate /force" in CMD.

<figure><img src="/files/tZaNMLD9pfbiG60erZY5" alt=""><figcaption></figcaption></figure>

* The machines should get the policy after the next startup.
* For execution logs, please navigate to "C:\ProgramData\ ". The logs will appear after the startup script execution.

## Additional Configurations and Troubleshooting

* Please make sure the startup scripts are always wait by default:
* Please navigate to “Computer Configuration” → “Policies” → “Administrative Templates” → “System” → “Logon”
* Set “Always wait for the network at computer startup and logon” = Enabled.

<figure><img src="/files/IaEikrLIMm2re7X24joG" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/FPRUhxvKRlatCZsSQgv8" alt=""><figcaption></figcaption></figure>

* We can edit the delegation if it is required Click on the GPO and navigate the Delegation section.

<figure><img src="/files/3BfXKy621UNqiOVeY58F" alt=""><figcaption></figcaption></figure>

* Click the advanced button. Then select the user, computer or group. Give the read permission. Read permission is enough.

<figure><img src="/files/I1HnlFVnhJlrxL5fiFam" alt=""><figcaption></figcaption></figure>

## Startup Scripts

* Bat script for exe formatted agent:

```
@echo off
setlocal enableextensions

set "SRC=\\<domain-name-eg-contoso.com>\<gp-startup-path>\<PM Installer Name>"
set "LOG=C:\ProgramData\CyberCyte_exe_uninstall_install.log"

echo [%date% %time%] START >> "%LOG%"

if not exist "%SRC%" (
  echo [%date% %time%] FILE NOT FOUND: %SRC% >> "%LOG%"
  exit /b 1
)

start /wait "" "%SRC%" --silent --reinstallOnProblem --install --versioncheck=true  >> "%LOG%" 2>&1
set "RC=%ERRORLEVEL%"

echo [%date% %time%] FINISH ExitCode=%RC% >> "%LOG%"
exit /b %RC%
```

* Bat script for msi formatted agent:

```
@echo off
setlocal enableextensions
set "LOG=C:\ProgramData\CyberCyte_msi_uninstall_install.txt"
set "MSILOG=C:\ProgramData\uninstall_install_log.txt"
set "MSI=\\<domain-name-eg-contoso.com>\<gp-startup-path>\<PM Installer Name>"

echo [%date% %time%] START >> "%LOG%"

if not exist "%MSI%" (
  echo [%date% %time%] MSI NOT FOUND: %MSI% >> "%LOG%"
  exit /b 1619
)

:: Agent will uninstall if agent is already installed, then install it again...
start /wait msiexec.exe /i "%MSI%" ^
  REINSTALL_ON_PROBLEM=true ^
  URL="URL" ^
  PROXY_URL= ^
  PROXY_USERNAME= ^
  PROXY_PASSWORD= ^
  /qn /norestart /l*v "%MSILOG%"

echo [%date% %time%] FINISH ExitCode=%errorlevel% >> "%LOG%"
exit /b %errorlevel%
```

* Ps1 script for exe formatted agent:

```
$ErrorActionPreference = 'Stop'

$SRC = '\\<domain-name-eg-contoso.com>\<gp-startup-path>\<PM Installer Name>'
$LOG = 'C:\ProgramData\CyberCyte_exe_uninstall_install.log'

function Log($t){
    "$((Get-Date).ToString('yyyy-MM-dd HH:mm:ss'))  $t" | Out-File -FilePath $LOG -Append -Encoding UTF8
}

Log 'Powershell Script Starting'

if (-not (Test-Path $SRC)) {
    Log "NOT FOUND: $SRC"
    exit 1619
}

try {
    Log "EXEC: $SRC --silent --uninstall --install --versioncheck=false"
    $p = Start-Process -FilePath $SRC -ArgumentList '--silent --uninstall --install --versioncheck=false' -Wait -PassThru -WindowStyle Hidden
    $rc = $p.ExitCode
    Log "FINISH ExitCode=$rc"
    exit $rc
}
catch {
    Log "EXCEPTION: $($_.Exception.Message)"
    if ($_.Exception.InnerException) { Log "INNER: $($_.Exception.InnerException.Message)" }
    exit 1
}

Log 'Powershell Script Finished'
```

* Ps1 script for msi formatted agent:

```
Start-Transcript -Path C:\ProgramData\uninstall_install_log.txt -Append
Write-Output "Powershell Script Starting: $(Get-Date)"
 
$msiPath = "\\<domain-name-eg-contoso.com>\<gp-startup-path>\<PM Installer Name>"
$installArgs = "/i `"$msiPath`" /qn URL=`"URL`" PROXY_URL=`` PROXY_USERNAME=`` PROXY_PASSWORD=`` /norestart RUN_UNINSTALL_SCRIPT=true UNINSTALL_OPTION=uninstallall"

try {
   $process = Start-Process -FilePath "msiexec.exe" -ArgumentList $installArgs -Wait -PassThru -WindowStyle Hidden
   Write-Output "Exit Code: $($process.ExitCode)"
   Write-Output "Installation finished: $(Get-Date)"
}
catch {
   Write-Output "Error: $($_.Exception.Message)"
}

Write-Output "Powershell Script Finished: $(Get-Date)"

Stop-Transcript
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cloudcyte.com/pre-requirements-and-initialization-of-the-platform/agent-installations/active-directory-windows-agent-installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
