Skip to content

Instantly share code, notes, and snippets.

@metriics
Forked from arcaneshabang/idrac6-vc.txt
Last active August 27, 2022 21:19
Show Gist options
  • Select an option

  • Save metriics/bac41e13bd01049a49e70cd857bf2562 to your computer and use it in GitHub Desktop.

Select an option

Save metriics/bac41e13bd01049a49e70cd857bf2562 to your computer and use it in GitHub Desktop.
IDRAC6 Virtual Console Launcher
#### metriics changes (Aug 27, 2022) ####
The .sh version now checks the working directory for the avctKVM.jar as well as the required libs and will download them from the host if not present. It can do so on both Linux and macOS and _should_ download the correct libs automatically but I've only tested on macOS.
You still need to grab the jre folder but you can get it from your java install, I got mine from my openJDK@8 install through brew from Mac.
Note: A known issue right now is the Virtual Console complaining about a missing library for keyboard and mouse but it works fine without it so I haven't put the time in to try and fix it. You should be able to safely ignore it.
#### ORIGINAL ####
Use this as an example on how to start the virtual console without the need of Java Web Start or accessing it from the web interface.
You can use the user and password that you use for the web interface.
You need an old JRE... I used 1.7.0_80 from the Server JRE package, also I have tested successfully 1.7.0_79 with MacOS.
You don't need to install it, just extract it or copy the files in "jre" folder.
Open the viewer.jnlp file that you get by launching the virtual console from the web interface with a text editor.
Note the urls to the jar files. Download the main jar file avctKVM.jar and the libs for your operating system and architecture.
Extract the dlls (.so Linux, .jnilib MacOS) from the jar libs.
If you don't see the MacOS libs in the file make sure you download it from MacOS.
Edit the bat/sh file according to your needs.
The file structure should look like this:
start-virtual-console.bat (.sh if Linux/MacOS)
avctKVM.jar
jre/<jre home here>
lib/avctKVMIO.dll (.so if Linux, .jnilib if MacOS)
lib/avmWinLib.dll (.so if Linux, .jnilib if MacOS)
@echo off
set /P drachost="Host: "
set /p dracuser="Username: "
set "psCommand=powershell -Command "$pword = read-host 'Enter Password' -AsSecureString ; ^
$BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword); ^
[System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)""
for /f "usebackq delims=" %%p in (`%psCommand%`) do set dracpwd=%%p
.\jre\bin\java -cp avctKVM.jar -Djava.library.path=.\lib com.avocent.idrac.kvm.Main ip=%drachost% kmport=5900 vport=5900 user=%dracuser% passwd=%dracpwd% apcp=1 version=2 vmprivilege=true "helpurl=https://%drachost%:443/help/contents.html"
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
LIB_AVCT="libavctKVMIO.so"
LIB_AVM="libavmlinux.so"
PLATFORM="Linux64"
echo "Checking for prereqs..."
if [ ! -e "./jre/bin/java" ]; then
echo "Missing jre folder, please place it in the same directory as the script. ($SCRIPT_DIR)"
return 1
else
echo "jre found."
echo
fi
# Check if running on macOS
if [ "$(uname -s)" = "Darwin" ]; then
LIB_AVCT="libavctKVMIO.jnilib"
LIB_AVM="libavmMac.jnilib"
PLATFORM="Mac64"
fi
echo -n 'Host: '
read drachost
echo -n 'Username: '
read dracuser
echo -n 'Password: '
read -s dracpwd
echo
# Check for required libraries based on OS
if [ ! -e "./libs" ]; then
mkdir libs
cd libs
echo "Downloading avctKVMIO$PLATFORM.jar"
curl -O -k https://$drachost:443/software/avctKVMIO$PLATFORM.jar
echo "Got avctKVMIO$PLATFORM.jar, extracting $LIB_AVCT"
jar xf avctKVMIO$PLATFORM.jar $LIB_AVCT
echo "Extracted $LIB_AVCT"
echo "Downloading avctVM$PLATFORM.jar"
curl -O -k https://$drachost:443/software/avctVM$PLATFORM.jar
echo "Got avctVM$PLATFORM.jar, extracting $LIB_AVM"
jar xf avctVM$PLATFORM.jar $LIB_AVM
echo "Extracted $LIB_AVM"
cd ..
fi
if [ ! -e "./avctKVM.jar" ]; then
echo "Downloading avctKVM.jar"
curl -O -k https://$drachost:443/software/avctKVM.jar
fi
# Remove temp files
rm -f ./libs/avctKVMIO$PLATFORM.jar
rm -f ./libs/avctVM$PLATFORM.jar
./jre/bin/java -cp avctKVM.jar -Djava.library.path=./lib com.avocent.idrac.kvm.Main ip=$drachost kmport=5900 vport=5900 user=$dracuser passwd=$dracpwd apcp=1 version=2 vmprivilege=true "helpurl=https://$drachost:443/help/contents.html"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment