Skip to content

Commit

Permalink
fix logic error for example
Browse files Browse the repository at this point in the history
- WaitForToolsInGuest method wait for login, So first login then call the WaitForToolsInGuest.
- Working with snapshot has broken when virtual Machine is powered off.
  • Loading branch information
javadib committed Nov 30, 2015
1 parent 1f29889 commit 132c315
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions README.md
Expand Up @@ -49,19 +49,18 @@ using (VMWareVirtualHost virtualHost = new VMWareVirtualHost())
{
// power on this virtual machine
virtualMachine.PowerOn();
// wait for VMWare Tools
virtualMachine.WaitForToolsInGuest();
// login to the virtual machine
virtualMachine.LoginInGuest("Administrator", "password");
// wait for VMWare Tools
virtualMachine.WaitForToolsInGuest();
// run notepad
virtualMachine.RunProgramInGuest("notepad.exe", string.Empty);
// create a new snapshot
string name = "New Snapshot";
// take a snapshot at the current state
VMWareSnapshot createdSnapshot = virtualMachine.Snapshots.CreateSnapshot(name, "test snapshot");
createdSnapshot.Dispose();
// power off
virtualMachine.PowerOff();

// find the newly created snapshot
using (VMWareSnapshot foundSnapshot = virtualMachine.Snapshots.GetNamedSnapshot(name))
{
Expand All @@ -70,6 +69,9 @@ using (VMWareVirtualHost virtualHost = new VMWareVirtualHost())
// delete snapshot
foundSnapshot.RemoveSnapshot();
}

// power off
virtualMachine.PowerOff();
}
}
```
Expand Down

0 comments on commit 132c315

Please sign in to comment.