Giter VIP home page Giter VIP logo

hypervremote's Introduction

HyperVRemote

Nuget for hyperv control from C#

Best used with inversion of control

Get it here: Install-Package HyperVRemote

###Initialisation An example when adding to IoC

private const string MachineName = "__YOUR__COMPUTER_OR__VM__";
private const string TestUserName = @"__YOUR_USERNAME__";
private const string TestPassword = @"__OUR_PASSWORD__";
private const string TestServerName = @"__YOUR_SERVER__";
private const string TestNameSpace = @"root\virtualization\v2";

builder.RegisterType<HyperVConfiguration>().As<IHyperVConfiguration>().WithParameters(new[]
{
  new ResolvedParameter((p,c) =>
  p.Name == "username",
  (p,c) => TestUserName),
  
  new ResolvedParameter((p,c) =>
  p.Name == "userpassword",
  (p,c) => TestPassword),
  
  new ResolvedParameter((p,c) =>
  p.Name == "servername",
  (p,c) => TestServerName),
  
  new ResolvedParameter((p,c) =>
  p.Name == "nameSpace",
  (p,c) => TestNameSpace),
});

builder.RegisterType<HyperVMachine>().As<IHyperVMachine>();
builder.RegisterType<HyperVProvider>().As<IHyperVProvider>();

Or initialising standalone

HyperVConfiguration configuration = new HyperVConfiguration {
  TestUserName,
  TestUserPassword,
  TestServerName,
  TestNameSpace
};
HyperVProvider provider = new HyperVProvider(configuration);

###API Overview

HyperVStatus GetStatus(IHyperVMachine machine);

void Connect();

IEnumerable<IHyperVMachine> GetMachines();

IHyperVMachine GetMachineByName(string name);

string GetName(IHyperVMachine machine);

void Start(IHyperVMachine machine);

void Stop(IHyperVMachine machine);

void Reset(IHyperVMachine machine);

void RestoreLastSnapShot(IHyperVMachine machine);

###Example

var provider = _container.Resolve<IHyperVProvider>();

provider.Connect();

IEnumerable<IHyperVMachine> machines = provider.GetMachines();

foreach (var machine in machines)
{
  Debug.WriteLine("Found machine => " + provider.GetName(machine));
}

IHyperVMachine machine = provider.GetMachineByName("SomeVM");

provider.Reset(machine);

hypervremote's People

Contributors

alexsjones avatar dazinator avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.