Running EMCLI in a Windows VDI Environment Link to heading

As part of a recent project, I needed to use Oracle Enterprise Manager’s emcli (Enterprise Manager Command Line Interface) tool from within a Windows-based virtual desktop infrastructure (VDI). While Oracle provides documentation for emcli, running it in a Windows shell—especially in a corporate VDI environment with OneDrive integration—introduces some quirks.

This post walks through the exact setup I used, including installing a compatible JRE, dealing with long Windows paths, and securely authenticating with OEM.


✅ Step 1: Install a Compatible Java Runtime Link to heading

EMCLI requires a Java Runtime Environment (JRE) version 1.8.0_431 or later. I downloaded and installed version 1.8.0_451 directly to my Desktop for ease of access.

Desktop\jre1.8.0_451

You don’t need to set up system-wide Java—just place it in a folder you control.


✅ Step 2: Download EMCLI from OEM Link to heading

In Oracle Enterprise Manager:

Navigate to: Setup → Command Line Interface

Download the emcli JAR bundle and extract it to a convenient local folder (e.g., Desktop\emcli).


✅ Step 3: Set JAVA_HOME Using Windows Short Paths Link to heading

If your user profile is stored in OneDrive (as is common in corporate VDIs), you may run into issues with pathnames that include spaces or ampersands (&), which confuse the Windows Command Shell. The workaround is to use short path (8.3 format) directory names.

To find the short path:

DIR /X

Once found, set the JAVA_HOME and update the PATH:

set JAVA_HOME="C:\Users\toby\ONEDRI~1\Desktop\jre1.8.0_451\bin"
set PATH=%JAVA_HOME%;%PATH%

💡 Note: Do not include the trailing backslash in JAVA_HOME.


✅ Step 4: Navigate to EMCLI Directory Link to heading

From the command prompt, navigate to your emcli install location using the short path:

cd C:\Users\toby\ONEDRI~1\Desktop\emcli

✅ Step 5: Basic EMCLI Commands Link to heading

Once inside the directory, you can begin using emcli. Here are some helpful starting commands:

View Help Link to heading

emcli help setup

🔐 Authentication and Setup Link to heading

Before using emcli, it needs to be configured to point to your OEM server:

emcli setup -url="https://oem.companyx.com/em" -username=toby -password=your_password

Once setup is complete, you can log in using:

emcli login -username=toby -password=your_password

For better security, avoid passing credentials as command-line arguments. Instead, simply run:

emcli login

This will prompt you securely for your username and password.


🧠 Optional: Use Autologin (With Caution) Link to heading

Autologin stores your credentials locally so that you don’t need to re-authenticate each time:

emcli setup -autologin

Use this only in non-production or test environments, as it introduces some security risk. You can log out at any time using:

emcli logout

🧰 Useful EMCLI Commands Link to heading

List All Exadata Resources Link to heading

emcli list -resource="%exadata%"

List Exadata Grid Targets (Formatted Output to File) Link to heading

emcli list -resource="Targets" ^
  -bind="target_type='oracle_exadata_grid'" ^
  -search="TARGET_TYPE='oracle_exadata_grid'" ^
  -columns="TARGET_NAME,TARGET_TYPE,DISPLAY_NAME,HOST_NAME" ^
  -format="name:pretty" ^
  -colsize="TARGET_NAME:35,TARGET_TYPE:20,DISPLAY_NAME:35,HOST_NAME:35" ^
  > exadata_grid.txt

List All Databases on a Node Link to heading

emcli list -resource="Targets" ^
  -bind="TargetType='oracle_database'" ^
  -search="HOST_NAME='dbs1mdcexa01n02adm.companyx.com'" ^
  -columns="TARGET_TYPE,DISPLAY_NAME,HOST_NAME" ^
  -colsize="TARGET_TYPE:20,DISPLAY_NAME:40,HOST_NAME:35" ^
  > dbs1mdcexa01n02adm_databases.txt

List OEM Management Servers (OMS) Link to heading

emcli list -resource=Targets ^
  -columns="TARGET_NAME:40,TARGET_TYPE" ^
  -search="TARGET_TYPE like '%oms%'"

🧾 Final Thoughts Link to heading

Running emcli on Windows—especially within a VDI environment—requires some care, but it’s entirely possible with the right Java version, path handling, and security practices.