4 Replies Latest reply on Sep 27, 2017 4:16 AM by AyoubSouihel

    vm power state when Snapshot taken

    AyoubSouihel Novice

      Hi community ,

      i am searching for a way to know what is the power state of the VM when a snapshot taken .

      vcenter 6.5

      thanks in advance

        • 1. Re: vm power state when Snapshot taken
          dekoshal Hot Shot
          vExpert

          I think i misunderstood the question. Please follow the suggestion given below by Ilian Iliev.

           

          You can not have two active task on a VM at any given point of time.

          While taking the snapshot either the VM is up or down.

          Nevermind if the VM is down. You can tail on the vmware.log  located in the virtual machine working directory while take snapshot task is in progress.

          Change in power state will be shown in the logs. Power state change might happen because of  BSOD or kernel panic etc.

           

          If you found this or any other answer helpful, please consider the use of the Correct or Helpful to award points.

           

          Best Regards,

          Deepak Koshal

          CNE|CLA|CWMA|VCP4|VCP5|CCAH

          1 person found this helpful
          • 2. Re: vm power state when Snapshot taken
            iiliev Champion
            Community WarriorsVMware Employees

            Hi, and welcome to the community.

             

            Take a look at the scripting action com.vmware.library.vc.vm.snapshot/getAllSnapshotsOfVM. It enumerates all snapshots of a VM. The state of the VM when a particular snapshot was taken is stored in the snapshot tree object, so you can easily fetch it from the variable state.

             

            Something like the following should print all snapshot names for the given VM referenced by the variable vm, together with the state of the VM when each snapshot was taken (the difference from the original scripting action code is only line 11 being added)

             

            var snapshots = new Array();
            if(vm.snapshot){
              var snapshotTrees = vm.snapshot.rootSnapshotList;
              for (i in snapshotTrees){
                getSnapshotsOfVM(snapshotTrees[i]);
              }
            }
            return snapshots;
            
            function getSnapshotsOfVM(tree) {
              System.log("Snapshot name: " + tree.name + "   VM state: " + tree.state);
              snapshots.push(tree.snapshot);
              var trees = tree.childSnapshotList;
              if (trees != null) {
                for (index in trees) {
                  if (trees[index] != null)
                    getSnapshotsOfVM(trees[index]);
                }
              }
            }
            
            1 person found this helpful
            • 3. Re: vm power state when Snapshot taken
              AyoubSouihel Novice

              thank you so much .

               

              also you can use  get-snapsho command .

              1 person found this helpful
              • 4. Re: vm power state when Snapshot taken
                AyoubSouihel Novice

                hi ;

                We found another easy way to get the information , this time it is from RV tools

                 

                 

                Go to vSnapshot ,  column State

                 

                State The power state of the virtual machine when this snapshot was taken.

                 

                 

                You can found out more from RV tools document page 40

                 

                http://robware.net/download/RVTools.pdf