예제 #1
0
        public IHvService TargetHost_Hv2()
        {
            string address  = this.CurrentTargetHostName();
            string username = "";
            string password = "";
            string str      = "localhost";

            if (address != str)
            {
                HostUriBuilder helperHostUriBuilder = this._Context.CredentialHelper.TargetHelperHostUriBuilder;
                username = CUtils.CombinUsernameAndDomain(helperHostUriBuilder.Credentials.UserName, helperHostUriBuilder.Credentials.Domain);
                password = helperHostUriBuilder.Credentials.Password;
            }
            IHvServiceLogger      serviceLogger      = this._ServiceLogger;
            IHvServiceCallContext serviceCallContext = this._ServiceCallContext;
            IHvService            service2012ByWmi   = HvServiceFactory.CreateHvService2012ByWmi(address, serviceLogger, serviceCallContext);

            try
            {
                service2012ByWmi.Logon(username, password);
                return(service2012ByWmi);
            }
            catch (Exception ex)
            {
                this._Logger.Information(ex, "Exception thrown during login:  ");
                service2012ByWmi.Dispose();
                throw;
            }
        }
예제 #2
0
        public IHvService LocalHost_Hv2()
        {
            string                address            = "localhost";
            string                username           = "";
            string                password           = "";
            IHvServiceLogger      serviceLogger      = this._ServiceLogger;
            IHvServiceCallContext serviceCallContext = this._ServiceCallContext;
            IHvService            service2012ByWmi   = HvServiceFactory.CreateHvService2012ByWmi(address, serviceLogger, serviceCallContext);

            try
            {
                service2012ByWmi.Logon(username, password);
                return(service2012ByWmi);
            }
            catch (Exception ex)
            {
                this._Logger.Information(ex, "Exception thrown during login:  ");
                service2012ByWmi.Dispose();
                throw;
            }
        }
예제 #3
0
 public HyperVHelper(TaskContext context)
 {
     this._Context       = context;
     this._Logger        = this._Context.Logger;
     this._ServiceLogger = (IHvServiceLogger) new HOculi_HvServiceLogger(this._Logger);
 }