Last active
June 18, 2021 15:10
-
-
Save NeMO84/95e93346e81dbb2b75dd677922addbda to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sorry, this does not work for me. sample output for 1 machine (i renamed your script to vbr):