Index: /trunk/src/VBox/Main/include/MachineImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/MachineImpl.h	(revision 42488)
+++ /trunk/src/VBox/Main/include/MachineImpl.h	(revision 42489)
@@ -95,5 +95,8 @@
     enum StateDependency
     {
-        AnyStateDep = 0, MutableStateDep, MutableOrSavedStateDep
+        AnyStateDep = 0,
+        MutableStateDep,
+        MutableOrSavedStateDep,
+        OfflineStateDep
     };
 
Index: /trunk/src/VBox/Main/src-server/MachineImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/MachineImpl.cpp	(revision 42488)
+++ /trunk/src/VBox/Main/src-server/MachineImpl.cpp	(revision 42489)
@@ -1029,5 +1029,8 @@
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    // this can be done in principle in any state as it doesn't affect the VM
+    // significantly, but play safe by not messing around while complex
+    // activities are going on
+    HRESULT rc = checkStateDependency(MutableOrSavedStateDep);
     if (FAILED(rc)) return rc;
 
@@ -1087,5 +1090,6 @@
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    rc = checkStateDependency(MutableStateDep);
+    // changing machine groups is possible while the VM is offline
+    rc = checkStateDependency(OfflineStateDep);
     if (FAILED(rc)) return rc;
 
@@ -4709,5 +4713,5 @@
     /* when there was auto-conversion, we want to save the file even if
      * the VM is saved */
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = checkStateDependency(MutableOrSavedStateDep);
     if (FAILED(rc)) return rc;
 
@@ -7657,4 +7661,8 @@
  *  properties when it is in the saved state.
  *
+ *  When @a aDepType is OfflineStateDep, this method returns S_OK if the
+ *  state is one of the 4 offline states (PoweredOff, Saved, Teleported,
+ *  Aborted).
+ *
  *  @param aDepType     Dependency type to check.
  *
@@ -7706,4 +7714,20 @@
                 return setError(VBOX_E_INVALID_VM_STATE,
                                 tr("The machine is not mutable (state is %s)"),
+                                Global::stringifyMachineState(mData->mMachineState));
+            break;
+        }
+        case OfflineStateDep:
+        {
+            if (   mData->mRegistered
+                && (   !isSessionMachine()
+                    || (   mData->mMachineState != MachineState_PoweredOff
+                        && mData->mMachineState != MachineState_Saved
+                        && mData->mMachineState != MachineState_Aborted
+                        && mData->mMachineState != MachineState_Teleported
+                       )
+                   )
+               )
+                return setError(VBOX_E_INVALID_VM_STATE,
+                                tr("The machine is not offline (state is %s)"),
                                 Global::stringifyMachineState(mData->mMachineState));
             break;
