Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
# Usage: vb-reset-host-version-guestproperty.sh myvmname
VMNAME=$1
VBOXMANAGE="$(which vboxmanage)"
if [ -z "$VMNAME" ]; then
echo "Must provide name of VM."
exit 1
fi
# Find UUID
UUID="$($VBOXMANAGE list vms | grep -w $VMNAME | cut -d' ' -f2 | tr -d '{}')"
if [ -z "$UUID" ]; then
echo "No VM found with the name '$VMNAME'."
exit 1
fi
echo "Found UUID:$UUID"
# Set latest version
CURRENT_VERSION="$($VBOXMANAGE --version)"
GUESTPROPERTY_VERSION="$($VBOXMANAGE guestproperty get $UUID /VirtualBox/GuestAdd/Version | sed s/Value\:\ //g)"
if [ "$CURRENT_VERSION" != "$GUESTPROPERTY_VERSION" ]; then
$VBOXMANAGE guestproperty set $UUID /VirtualBox/GuestAdd/Version "$CURRENT_VERSION"
echo "GuestProperty(/VirtualBox/GuestAdd/Version) updated to '$CURRENT_VERSION' from '$GUESTPROPERTY_VERSION'"
else
echo "Versions match: $CURRENT_VERSION"
fi
@NeMO84

This comment has been minimized.

Copy link
Owner Author

NeMO84 commented Mar 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.