Changes to Discovery commands
The following sections show the discovery command changes between BMC Discovery versions.
The following changes are not shown:
- Entirely new discovery platforms
- Changes to comments only
- Commands which have been removed and not replaced
- Changes to echo only statements
Discovery command changes from 23.3 to 24.1
FreeBSD
initialise
The following code:
unalias -a
# Insulate against systems with -u set by default.
set +u
is replaced with:
unalias -a
# egrep is deprecated
alias egrep='grep -E'
# Insulate against systems with -u set by default.
set +u
Mac OS X
initialise
The following code:
# Stop alias commands changing behaviour.
unalias -a
# Insulate against systems with -u set by default.
set +u
is replaced with:
unalias -a
# egrep is deprecated
alias egrep='grep -E'
# Insulate against systems with -u set by default.
set +u
NetBSD
initialise
The following code:
# Stop alias commands changing behaviour.
unalias -a
# Insulate against systems with -u set by default.
set +u
is replaced with:
unalias -a
# egrep is deprecated
alias egrep='grep -E'
# Insulate against systems with -u set by default.
set +u
HPUX
initialise
The following code:
# Stop alias commands changing behaviour.
unalias -a
# Insulate against systems with -u set by default.
set +u
is replaced with:
unalias -a
# egrep is deprecated
alias egrep='grep -E'
# Insulate against systems with -u set by default.
set +u
Solaris
getDeviceInfo
The following code:
if [ $os_ver -ge 11 ]; then
os=`pkg info entire 2>/dev/null | grep "Version:" | awk 'NR > 1 {print $1}' RS='(' FS=')'`
if [ "$os" = "" ]; then
os=`pkg info entire 2>/dev/null | awk '/Branch:/ {print $2}' | nawk -F. '{printf "Oracle Solaris 11.%s.%s.%s.%s", $3, $4, $6, $7;}'`
fi
fi
if [ "$os" = "" -a -r /etc/release ]; then
is replaced with:
os=`pkg info entire 2>/dev/null | grep "Version:" | awk 'NR > 1 {print $1}' RS='(' FS=')'`
if [ "$os" = "" ]; then
os=`pkg info entire 2>/dev/null | awk '/Branch:/ {print $2}' | nawk -F. '{
if( $1 == 0 ) {printf "Oracle Solaris 11.%s.%s.%s.%s", $3, $4, $6, $7;}
if( $1 == 11 ) {printf "Oracle Solaris 11.%s.%s.%s.%s.%s.%s", $2, $3, $4, $5, $6, $7;}}'`
fi
fi
if [ "$os" = "" -a -r /etc/release ]; then
getProcessList
The following code:
if [ $os_ver -ge 11 ]; then
PRIV_PS /usr/bin/ps axww 2>/dev/null
if [ $os_ver -eq 11 ]; then
os_rev=`pkg list entire | cut -d. -f5 | grep [0-9]+`
if [ $os_rev -gt 3 ]; then
RUN_PARGS=0
elif [ $os_rev -eq 3 ]; then
os_sru_major=`pkg list entire | cut -d. -f6 | grep [0-9]+`
os_sru_minor=`pkg list entire | cut -d. -f7 | grep [0-9]+`
if [ $os_sru_major -gt 5 -o $os_sru_major -eq 5 -a $os_sru_minor -ge 6 ]; then
RUN_PARGS=0
fi
is replaced with:
PRIV_PS /usr/bin/ps axww 2>/dev/null
if [ $os_ver -eq 11 ]; then
os_rev=`pkg list entire | cut -d. -f5 | egrep [0-9]+`
if [ $os_rev -gt 3 ]; then
RUN_PARGS=0
elif [ $os_rev -eq 3 ]; then
os_sru_major=`pkg list entire | cut -d. -f6 | egrep [0-9]+`
os_sru_minor=`pkg list entire | cut -d. -f7 | egrep [0-9]+`
if [ $os_sru_major -gt 5 -o $os_sru_major -eq 5 -a $os_sru_minor -ge 6 ]; then
RUN_PARGS=0
fi
VMware ESX
getDeviceInfo
The following code:
os=`cat /etc/novell-release | grep -Ev '^#'`
fi
# SuSE lsb_release does not provide service pack so prefer SuSE-release file
# However, this file is being deprecated so we will fallback to os-release
# (see below)
if [ "$os" = "" -a -r /etc/SuSE-release ]; then
os=`cat /etc/SuSE-release | grep -Ev '^#'`
fi
if [ "$os" = "" -a -r /etc/photon-release ]; then
os=`cat /etc/photon-release`
fi
if [ "$os" = "" -a -r /etc/debian_version ]; then
ver=`cat /etc/debian_version`
os="Debian Linux $ver"
if [ -r /etc/system-release ]; then
igel_os=`grep 'IGEL OS' /etc/system-release`
if [ "$igel_os" != "" ]; then
os=$igel_os
fi
fi
fi
if [ "$os" = "" -a -x /usr/bin/lsb_release ]; then
# We'd like to use -ds but that puts quotes in the output!
is replaced with:
fi
# SuSE lsb_release does not provide service pack for older versions so prefer
# SuSE-release file. However, SuSE-release is being deprecated so we will only
# use it if os-release does not exist (see below).
if [ "$os" = "" ] && [ -r /etc/SuSE-release ] && [ ! -r /etc/os-release ]; then
os=`cat /etc/SuSE-release | grep -Ev '^#'`
fi
if [ "$os" = "" -a -r /etc/photon-release ]; then
os=`cat /etc/photon-release`
fi
if [ "$os" = "" -a -x /usr/bin/lsb_release ]; then
# We'd like to use -ds but that puts quotes in the output!
The following code:
if [ "$igel_os" != "" ]; then
os=$igel_os
fi
fi
fi
fi
is replaced with:
os=$igel_os
fi
elif [ `echo "$os" | grep -o "Debian"` ] && [ -r /etc/debian_version ]; then
ver=`cat /etc/debian_version`
os="Debian Linux $ver"
fi
fi
fi
The following code:
os=`cat /etc/oracle-release`
fi
fi
if [ "$os" = "" -a -r /etc/mandrake-release ]; then
os=`cat /etc/mandrake-release`
fi
if [ "$os" = "" -a -r /etc/os-release ]; then
# Use os-release for SuSE (if SuSE-release wasn't present, above), Container Linux, Google COS
os_id=`grep -E ^ID= /etc/os-release | cut -s -f2 '-d"'`
if [ "$os_id" = "" ]; then
os_id=`grep -E ^ID= /etc/os-release | cut -f2 -d=`
fi
if [ "$os_id" = "sles" -o "$os_id" = "opensuse" -o "$os_id" = "sle_hpc" -o "$os_id" = "coreos" -o "$os_id" = "cos" ]; then
os=`grep -E ^PRETTY_NAME /etc/os-release | cut -f2 '-d"'`
if [ "$os_id" = "cos" ]; then
extra=`grep -E '(VERSION|BUILD_ID)=' /etc/os-release`
is replaced with:
fi
fi
if [ "$os" = "" -a -r /etc/debian_version ]; then
ver=`cat /etc/debian_version`
os="Debian Linux $ver"
if [ -r /etc/system-release ]; then
igel_os=`grep 'IGEL OS' /etc/system-release`
if [ "$igel_os" != "" ]; then
os=$igel_os
fi
fi
fi
if [ "$os" = "" -a -r /etc/mandrake-release ]; then
os=`cat /etc/mandrake-release`
fi
if [ "$os" = "" -a -r /etc/os-release ]; then
# Use os-release for SuSE (if SuSE-release wasn't present, above),
# Container Linux, Google COS, Alpine
os_id=`grep -E ^ID= /etc/os-release | cut -s -f2 '-d"'`
if [ "$os_id" = "" ]; then
os_id=`grep -E ^ID= /etc/os-release | cut -f2 -d=`
fi
if [ "$os_id" = "sles" -o "$os_id" = "opensuse" -o "$os_id" = "sle_hpc" -o "$os_id" = "coreos" -o "$os_id" = "cos" -o "$os_id" = "alpine" ]; then
os=`grep -E ^PRETTY_NAME /etc/os-release | cut -f2 '-d"'`
if [ "$os_id" = "cos" ]; then
extra=`grep -E '(VERSION|BUILD_ID)=' /etc/os-release`
getHostInfo
The following code:
if [ -f /usr/sbin/hwinfo ]; then
PRIV_HWINFO /usr/sbin/hwinfo --bios 2>/dev/null | sed -n '/System Info:/,/Info:/p' | awk '
$1 ~ /Manufacturer:/ { sub(".*Manufacturer: *", ""); gsub("\"", ""); printf("candidate_vendor[]: %s\n", $0); }
$1 ~ /Product:/ { sub(".*Product: *", ""); gsub("\"", ""); printf("candidate_model[]: %s\n", $0); }
$1 ~ /Serial:/ { sub(".*Serial: *", ""); gsub("\"", ""); printf("candidate_serial[]: %s\n", $0); }
is replaced with:
PRIV_HWINFO /usr/sbin/hwinfo --bios 2>/dev/null | sed -n '/System Info:/,/Info:/p' | awk '
$0 ~ /"UNKNOWN"/ {exit;}
$1 ~ /Manufacturer:/ { sub(".*Manufacturer: *", ""); gsub("\"", ""); printf("candidate_vendor[]: %s\n", $0); }
$1 ~ /Product:/ { sub(".*Product: *", ""); gsub("\"", ""); printf("candidate_model[]: %s\n", $0); }
$1 ~ /Serial:/ { sub(".*Serial: *", ""); gsub("\"", ""); printf("candidate_serial[]: %s\n", $0); }
The following code:
if [ -f /usr/sbin/lshw ]; then
# We only want the first items reported to avoid picking up pnp devices
PRIV_LSHW /usr/sbin/lshw -class system -quiet 2>/dev/null | awk '
BEGIN { found_vendor=0; found_product=0; found_serial=0; }
$1 ~ /vendor:/ && !found_vendor { sub(".*vendor: *", ""); gsub("\"", ""); printf("candidate_vendor[]: %s\n", $0); found_vendor=1; }
$1 ~ /product:/ && !found_product { sub(".*product: *", ""); gsub("\"", ""); printf("candidate_model[]: %s\n", $0); found_product=1; }
$1 ~ /serial:/ && !found_serial { sub(".*serial: *", ""); gsub("\"", ""); printf("candidate_serial[]: %s\n", $0); found_serial=1; } '
is replaced with:
# We only want the first items reported to avoid picking up pnp devices
# Without superuser privileges, lshw still reports information about PnP devices
# that might cause issues with model detection.
# Hence, we stop processing if we see the warning: "WARNING:".
PRIV_LSHW /usr/sbin/lshw -class system -quiet 2>&1 | awk '
BEGIN { found_vendor=0; found_product=0; found_serial=0; }
$1 ~ /WARNING:/ {exit;}
$1 ~ /vendor:/ && !found_vendor { sub(".*vendor: *", ""); gsub("\"", ""); printf("candidate_vendor[]: %s\n", $0); found_vendor=1; }
$1 ~ /product:/ && !found_product { sub(".*product: *", ""); gsub("\"", ""); printf("candidate_model[]: %s\n", $0); found_product=1; }
$1 ~ /serial:/ && !found_serial { sub(".*serial: *", ""); gsub("\"", ""); printf("candidate_serial[]: %s\n", $0); found_serial=1; } '
The following code:
else
echo "candidate_model[]: Oracle Compute Instance"
fi
echo "candidate_vendor[]: Oracle"
elif [ "$TW_CLOUD_PLATFORM" = "OPENSTACK" ]; then
echo "openstack_instance_id: $TW_CLOUD_ID"
is replaced with:
echo "candidate_model[]: Oracle Compute Instance"
fi
echo "vendor: Oracle"
elif [ "$TW_CLOUD_PLATFORM" = "OPENSTACK" ]; then
echo "openstack_instance_id: $TW_CLOUD_ID"
initialise
The following code:
# Stop alias commands changing behaviour.
unalias -a
# Insulate against systems with -u set by default.
set +u
is replaced with:
unalias -a
# egrep is deprecated
alias egrep='grep -E'
# Insulate against systems with -u set by default.
set +u
Linux
getDeviceInfo
The following code:
os=`cat /etc/novell-release | grep -Ev '^#'`
fi
# SuSE lsb_release does not provide service pack so prefer SuSE-release file
# However, this file is being deprecated so we will fallback to os-release
# (see below)
if [ "$os" = "" -a -r /etc/SuSE-release ]; then
os=`cat /etc/SuSE-release | grep -Ev '^#'`
fi
if [ "$os" = "" -a -r /etc/photon-release ]; then
os=`cat /etc/photon-release`
fi
if [ "$os" = "" -a -r /etc/debian_version ]; then
ver=`cat /etc/debian_version`
os="Debian Linux $ver"
if [ -r /etc/system-release ]; then
igel_os=`grep 'IGEL OS' /etc/system-release`
if [ "$igel_os" != "" ]; then
os=$igel_os
fi
fi
fi
if [ "$os" = "" -a -x /usr/bin/lsb_release ]; then
# We'd like to use -ds but that puts quotes in the output!
is replaced with:
fi
# SuSE lsb_release does not provide service pack for older versions so prefer
# SuSE-release file. However, SuSE-release is being deprecated so we will only
# use it if os-release does not exist (see below).
if [ "$os" = "" ] && [ -r /etc/SuSE-release ] && [ ! -r /etc/os-release ]; then
os=`cat /etc/SuSE-release | grep -Ev '^#'`
fi
if [ "$os" = "" -a -r /etc/photon-release ]; then
os=`cat /etc/photon-release`
fi
if [ "$os" = "" -a -x /usr/bin/lsb_release ]; then
# We'd like to use -ds but that puts quotes in the output!
The following code:
os=$igel_os
fi
fi
fi
fi
is replaced with:
os=$igel_os
fi
elif [ `echo "$os" | grep -o "Debian"` ] && [ -r /etc/debian_version ]; then
ver=`cat /etc/debian_version`
os="Debian Linux $ver"
fi
fi
fi
The following code:
os=`cat /etc/oracle-release`
fi
fi
if [ "$os" = "" -a -r /etc/mandrake-release ]; then
os=`cat /etc/mandrake-release`
fi
if [ "$os" = "" -a -r /etc/os-release ]; then
# Use os-release for SuSE (if SuSE-release wasn't present, above), Container Linux, Google COS
os_id=`grep -E ^ID= /etc/os-release | cut -s -f2 '-d"'`
if [ "$os_id" = "" ]; then
os_id=`grep -E ^ID= /etc/os-release | cut -f2 -d=`
fi
if [ "$os_id" = "sles" -o "$os_id" = "opensuse" -o "$os_id" = "sle_hpc" -o "$os_id" = "coreos" -o "$os_id" = "cos" ]; then
os=`grep -E ^PRETTY_NAME /etc/os-release | cut -f2 '-d"'`
if [ "$os_id" = "cos" ]; then
extra=`grep -E '(VERSION|BUILD_ID)=' /etc/os-release`
is replaced with:
fi
fi
if [ "$os" = "" -a -r /etc/debian_version ]; then
ver=`cat /etc/debian_version`
os="Debian Linux $ver"
if [ -r /etc/system-release ]; then
igel_os=`grep 'IGEL OS' /etc/system-release`
if [ "$igel_os" != "" ]; then
os=$igel_os
fi
fi
fi
if [ "$os" = "" -a -r /etc/mandrake-release ]; then
os=`cat /etc/mandrake-release`
fi
if [ "$os" = "" -a -r /etc/os-release ]; then
# Use os-release for SuSE (if SuSE-release wasn't present, above),
# Container Linux, Google COS, Alpine
os_id=`grep -E ^ID= /etc/os-release | cut -s -f2 '-d"'`
if [ "$os_id" = "" ]; then
os_id=`grep -E ^ID= /etc/os-release | cut -f2 -d=`
fi
if [ "$os_id" = "sles" -o "$os_id" = "opensuse" -o "$os_id" = "sle_hpc" -o "$os_id" = "coreos" -o "$os_id" = "cos" -o "$os_id" = "alpine" ]; then
os=`grep -E ^PRETTY_NAME /etc/os-release | cut -f2 '-d"'`
if [ "$os_id" = "cos" ]; then
extra=`grep -E '(VERSION|BUILD_ID)=' /etc/os-release`
getHostInfo
The following code:
fi
if [ -f /usr/sbin/hwinfo ]; then
PRIV_HWINFO /usr/sbin/hwinfo --bios 2>/dev/null | sed -n '/System Info:/,/Info:/p' | awk '
$1 ~ /Manufacturer:/ { sub(".*Manufacturer: *", ""); gsub("\"", ""); printf("candidate_vendor[]: %s\n", $0); }
$1 ~ /Product:/ { sub(".*Product: *", ""); gsub("\"", ""); printf("candidate_model[]: %s\n", $0); }
$1 ~ /Serial:/ { sub(".*Serial: *", ""); gsub("\"", ""); printf("candidate_serial[]: %s\n", $0); }
is replaced with:
if [ -f /usr/sbin/hwinfo ]; then
PRIV_HWINFO /usr/sbin/hwinfo --bios 2>/dev/null | sed -n '/System Info:/,/Info:/p' | awk '
$0 ~ /"UNKNOWN"/ {exit;}
$1 ~ /Manufacturer:/ { sub(".*Manufacturer: *", ""); gsub("\"", ""); printf("candidate_vendor[]: %s\n", $0); }
$1 ~ /Product:/ { sub(".*Product: *", ""); gsub("\"", ""); printf("candidate_model[]: %s\n", $0); }
$1 ~ /Serial:/ { sub(".*Serial: *", ""); gsub("\"", ""); printf("candidate_serial[]: %s\n", $0); }
The following code:
fi
if [ -f /usr/sbin/lshw ]; then
# We only want the first items reported to avoid picking up pnp devices
PRIV_LSHW /usr/sbin/lshw -class system -quiet 2>/dev/null | awk '
BEGIN { found_vendor=0; found_product=0; found_serial=0; }
$1 ~ /vendor:/ && !found_vendor { sub(".*vendor: *", ""); gsub("\"", ""); printf("candidate_vendor[]: %s\n", $0); found_vendor=1; }
$1 ~ /product:/ && !found_product { sub(".*product: *", ""); gsub("\"", ""); printf("candidate_model[]: %s\n", $0); found_product=1; }
$1 ~ /serial:/ && !found_serial { sub(".*serial: *", ""); gsub("\"", ""); printf("candidate_serial[]: %s\n", $0); found_serial=1; } '
is replaced with:
if [ -f /usr/sbin/lshw ]; then
# We only want the first items reported to avoid picking up pnp devices
# Without superuser privileges, lshw still reports information about PnP devices
# that might cause issues with model detection.
# Hence, we stop processing if we see the warning: "WARNING:".
PRIV_LSHW /usr/sbin/lshw -class system -quiet 2>&1 | awk '
BEGIN { found_vendor=0; found_product=0; found_serial=0; }
$1 ~ /WARNING:/ {exit;}
$1 ~ /vendor:/ && !found_vendor { sub(".*vendor: *", ""); gsub("\"", ""); printf("candidate_vendor[]: %s\n", $0); found_vendor=1; }
$1 ~ /product:/ && !found_product { sub(".*product: *", ""); gsub("\"", ""); printf("candidate_model[]: %s\n", $0); found_product=1; }
$1 ~ /serial:/ && !found_serial { sub(".*serial: *", ""); gsub("\"", ""); printf("candidate_serial[]: %s\n", $0); found_serial=1; } '
The following code:
echo "candidate_model[]: Oracle Compute Instance"
fi
echo "candidate_vendor[]: Oracle"
elif [ "$TW_CLOUD_PLATFORM" = "OPENSTACK" ]; then
echo "openstack_instance_id: $TW_CLOUD_ID"
is replaced with:
echo "candidate_model[]: Oracle Compute Instance"
fi
echo "vendor: Oracle"
elif [ "$TW_CLOUD_PLATFORM" = "OPENSTACK" ]; then
echo "openstack_instance_id: $TW_CLOUD_ID"
initialise
The following code:
# Stop alias commands changing behaviour.
unalias -a
# Insulate against systems with -u set by default.
set +u
is replaced with:
unalias -a
# egrep is deprecated
alias egrep='grep -E'
# Insulate against systems with -u set by default.
set +u
Windows
getRegistryValue
The following code:
};
if ($value -ne $null) {
if ($value -is [Byte[]]) {
# REG_BINARY
"value: {0}" -f (($value | ForEach-Object toString X2) -join '');
is replaced with:
if ($value -ne $null) {
# type MUST be reported before value
"type: {0}" -f ($value.GetType()).Name;
if ($value -is [Byte[]]) {
# REG_BINARY
"value: {0}" -f (($value | ForEach-Object toString X2) -join '');
The following code:
else {
"value: {0}" -f $value;
}
"type: {0}" -f ($value.GetType()).Name;
} else {
"REGISTRY VALUE NOT FOUND";
}
is replaced with:
"value: {0}" -f $value;
}
} else {
"REGISTRY VALUE NOT FOUND";
}
runWMIQuery
The following code:
"{0}: \\{1}\{2}:{3}.{4}={5}" -f ($_.Name, $env:ComputerName, $namespace, $match.Matches.Groups[1].Value, $match.Matches.Groups[2].Value, $match.Matches.Groups[3].Value)
}
# Handle CimInstance object instance properties to match proxy
elseif ($_.GetType().Name -eq "CimInstance") {
# Convert object to JSON format
"{0}: [{1}] JSON:{2}" -f $_.Name, $_.Value.GetType().Name, ($_.Value.CimInstanceProperties | ConvertTo-JSON -Compress)
}
is replaced with:
}
# Handle CimInstance object instance properties to match proxy
elseif ($_.Value.GetType().Name -eq "CimInstance") {
# Convert object to JSON format
"{0}: [{1}] JSON:{2}" -f $_.Name, $_.Value.GetType().Name, ($_.Value.CimInstanceProperties | ConvertTo-JSON -Compress)
}
AIX
initialise
The following code:
# Stop alias commands changing behaviour.
unalias -a
# Insulate against systems with -u set by default.
set +u
is replaced with:
unalias -a
# egrep is deprecated
alias egrep='grep -E'
# Insulate against systems with -u set by default.
set +u
OpenBSD
initialise
The following code:
# Stop alias commands changing behaviour.
unalias -a
# Insulate against systems with -u set by default.
set +u
is replaced with:
unalias -a
# egrep is deprecated
alias egrep='grep -E'
# Insulate against systems with -u set by default.
set +u