MS Intune Deployment for Windows
    • 03 Nov 2025
    • 3 Minutes to read
    • Dark
      Light
    • PDF

    MS Intune Deployment for Windows

    • Dark
      Light
    • PDF

    Article summary

    MS Intune Deployment for Windows

    This document provides the required steps and scripts to deploy the NectarEPC Agent via Microsoft Intune.
    All examples below use version 3.1.128; update version numbers and paths as appropriate for your environment.

    Prerequisites

    Directory Structure

    Example working directory for packaging (paths will vary by customer environment):

    C:\Users\jbarnett\Downloads\NectarEPC-v128\
     │
     ├─ NectarEPClientInstaller64-3.1.128.exe
     ├─ install-nectar.bat
     ├─ uninstall-nectar.bat
     └─ IntuneWinAppUtil.exe
    

    For assistance, please contact support@nectarcorp.com

    Packaging Command

    Run the following command to build the .intunewin package.

    You must specify an output directory for the compiled installer:

    IntuneWinAppUtil.exe -c . -s install-nectar.bat -o .\output

    Code

    Batch File Code 

    @echo off
    setlocal EnableExtensions
    
    REM ==============================================
    REM  NectarEPC - Intune silent install (sanitized)
    REM ==============================================
    
    REM ----- REQUIRED: your org-specific values -----
    set "AGENT_ORGID=<OrgID>"
    set "AGENT_GRPID=<OrgGrpID>"
    set "MGMT_DOMAIN_NAME=<Domain Name>"
    set "MGMT_DOMAIN_PASS=<Domain Password>"
    set "CONTROLLER_HOST=<Controller information>"
    REM ----------------------------------------------
    
    REM Use hostname for agent name (reliable under SYSTEM)
    REM The %COMPUTERNAME% below can be changed to match what Nectar will require within the DXP.
    set "AGENT_NAME=%COMPUTERNAME%"
    set "CONTROLLER_CSV=%CONTROLLER_HOST%:40006"
    
    REM Paths
    set "HERE=%~dp0"
    set "SETUP=%HERE%NectarEPClientInstaller64-3.1.128.exe"
    set "LOGDIR=%ProgramData%\NectarEPC\InstallLogs"
    set "WRAPLOG=%LOGDIR%\wrapper-install.log"
    
    REM Create timestamped MSI log filename
    for /f "tokens=1-3 delims=/-. " %%a in ("%date%") do set "YY=%%c" & set "MM=%%a" & set "DD=%%b"
    set "HH=%time:~0,2%" & set "MN=%time:~3,2%" & set "SS=%time:~6,2%"
    set "HH=%HH: =0%"
    set "TS=%YY%%MM%%DD%_%HH%%MN%%SS%"
    set "MSI_LOG=%LOGDIR%\NectarEPC_%TS%.log"
    
    if not exist "%SETUP%" (
      echo ERROR: Installer not found at "%SETUP%"
      exit /b 2
    )
    
    if not exist "%LOGDIR%" mkdir "%LOGDIR%" >nul 2>&1
    echo ==================================================>> "%WRAPLOG%"
    echo [%date% %time%] Starting NectarEPC install >> "%WRAPLOG%"
    
    REM --- Sanitize values ---
    for /f "usebackq delims=" %%A in (`powershell -NoProfile -Command "$v='%AGENT_NAME%';$v -replace '[^A-Za-z0-9\.-]',''"`) do set "SAN_AGENT_NAME=%%A"
    for /f "usebackq delims=" %%A in (`powershell -NoProfile -Command "$v='%AGENT_ORGID%';$v -replace '[^A-Za-z0-9\.-]',''"`) do set "SAN_AGENT_ORGID=%%A"
    for /f "usebackq delims=" %%A in (`powershell -NoProfile -Command "$v='%AGENT_GRPID%';$v -replace '[^A-Za-z0-9\.-]',''"`) do set "SAN_AGENT_GRPID=%%A"
    for /f "usebackq delims=" %%A in (`powershell -NoProfile -Command "$v='%MGMT_DOMAIN_NAME%';$v -replace '[^A-Za-z0-9\.-]',''"`) do set "SAN_DOMAIN=%%A"
    for /f "usebackq delims=" %%A in (`powershell -NoProfile -Command "$v='%CONTROLLER_CSV%';$v -replace '[^A-Za-z0-9\.\-:]',''"`) do set "SAN_CONTROLLER_CSV=%%A"
    
    REM Fail fast if missing values
    if "%SAN_AGENT_ORGID%"=="" exit /b 1639
    if "%SAN_AGENT_GRPID%"=="" exit /b 1639
    if "%SAN_DOMAIN%"==""     exit /b 1639
    if "%SAN_CONTROLLER_CSV%"=="" exit /b 1639
    
    REM Build MSI property block
    set "MSI_PROPS=AGENT_NAME=%SAN_AGENT_NAME% AGENT_ORGID=%SAN_AGENT_ORGID% AGENT_GRPID=%SAN_AGENT_GRPID% MGMT_DOMAIN_PASS=\"%MGMT_DOMAIN_PASS%\" MGMT_DOMAIN_NAME=%SAN_DOMAIN% CONTROLLER_CSV=%SAN_CONTROLLER_CSV% CONTROLLER_PORT_ISFIXED=TRUE AGENT_LOG_LEVEL=INFO"
    
    echo Setup: "%SETUP%" >> "%WRAPLOG%"
    echo MSI log: "%MSI_LOG%" >> "%WRAPLOG%"
    echo Command: "%SETUP%" /s /v"/qn %MSI_PROPS% /L*v \"%MSI_LOG%\"" >> "%WRAPLOG%"
    
    start /wait "" "%SETUP%" /s /v"/qn %MSI_PROPS% /L*v \"%MSI_LOG%\""
    set "RC=%ERRORLEVEL%"
    echo [%date% %time%] Installer exit code: %RC% >> "%WRAPLOG%"
    echo Installer exit code: %RC%
    
    REM -------- File-based detection marker --------
    set "MARKER_DIR=%ProgramData%\NectarEPC"
    set "MARKER_FILE=%MARKER_DIR%\installed.tag"
    
    if %RC%==0 (
      if not exist "%MARKER_DIR%" mkdir "%MARKER_DIR%" >nul 2>&1
      (
        echo Installed=1
        echo Version=3.1.128
        echo OrgID=%SAN_AGENT_ORGID%
        echo GroupID=%SAN_AGENT_GRPID%
        echo Domain=%SAN_DOMAIN%
        echo Controller=%SAN_CONTROLLER_CSV%
        echo Timestamp=%date% %time%
      ) > "%MARKER_FILE%"
      exit /b 0
    ) else (
      echo [%date% %time%] Skipping marker creation due to installer code %RC% >> "%WRAPLOG%"
      exit /b %RC%
    )
    


    Uninstall Code Batch

    @echo off
    setlocal EnableExtensions
    
    REM ==============================================
    REM  NectarEPC - Intune uninstall (safe cleanup)
    REM ==============================================
    
    REM If the agent provides its own uninstaller:
    set "UNINSTALLER=C:\Program Files\Nectar\NectarEPC\uninstall.exe"
    
    if exist "%UNINSTALLER%" (
      echo [%date% %time%] Launching vendor uninstaller...
      start /wait "" "%UNINSTALLER%" /S
    )
    
    REM Clean up leftover files or logs (optional)
    rmdir /s /q "%ProgramData%\NectarEPC" >nul 2>&1
    
    exit /b 0
    
    :RegDelTreeIfExists
    reg query %~1 /reg:64 >nul 2>&1 || goto :eof
    reg delete %~1 /f /reg:64 >nul 2>&1
    goto :eof
    

    Additional Instructions

    From Intune

    In Intune Admin Center → Apps → Windows → Add → Windows app (Win32):

    Field

    Value

    App package file

    install-nectar.intunewin

    Name

    Nectar EPC 3.1.128

    Publisher

    Telchemy Inc

    Install command

    install-nectar.bat

    Uninstall command

    uninstall-nectar.bat

    Install behavior

    System

    Device restart

    No specific action

    Return codes

    Default (0, 1707, 3010, 1641, 1618)

     

    Detection Rule

    Rule type: File
    Path: C:\ProgramData\NectarEPC
    File or folder: installed.tag
    Detection method: File exists
    Associated with 32-bit app: No


    Assignments

    Under Assignments → Required, add:

    • All devices (or a test device group)
    • Notifications: Show all toast notifications
    • Install time: As soon as possible

    You can force a sync or wait the scheduled deployment window.
    Monitor progress from Company Portal or Endpoint Manager → Device Status.


    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.
    ESC

    Eddy AI, facilitating knowledge discovery through conversational intelligence