Пример #1
0
        public IHvService TargetHost()
        {
            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            hvServiceByWmi     = HvServiceFactory.CreateHvServiceByWmi(address, serviceLogger, serviceCallContext);

            try
            {
                hvServiceByWmi.Logon(username, password);
                return(hvServiceByWmi);
            }
            catch (Exception ex)
            {
                this._Logger.Information(ex, "Exception thrown during login:  ");
                hvServiceByWmi.Dispose();
                throw;
            }
        }
Пример #2
0
        public IHvService SourceHost()
        {
            HostUriBuilder helperHostUriBuilder = this._Context.CredentialHelper.ReverseHelperHostUriBuilder;
            string         username             = CUtils.CombinUsernameAndDomain(helperHostUriBuilder.Credentials.UserName, helperHostUriBuilder.Credentials.Domain);
            string         password             = helperHostUriBuilder.Credentials.Password;
            IHvService     hvServiceByWmi       = HvServiceFactory.CreateHvServiceByWmi(this.CurrentSourceHostName(), this._ServiceLogger, this._ServiceCallContext);

            try
            {
                hvServiceByWmi.Logon(username, password);
                return(hvServiceByWmi);
            }
            catch (Exception ex)
            {
                this._Logger.Information(ex, "Exception thrown during login:  ");
                hvServiceByWmi.Dispose();
                throw;
            }
        }
Пример #3
0
        public IHvService LocalHost()
        {
            string                address            = "localhost";
            string                username           = "";
            string                password           = "";
            IHvServiceLogger      serviceLogger      = this._ServiceLogger;
            IHvServiceCallContext serviceCallContext = this._ServiceCallContext;
            IHvService            hvServiceByWmi     = HvServiceFactory.CreateHvServiceByWmi(address, serviceLogger, serviceCallContext);

            try
            {
                hvServiceByWmi.Logon(username, password);
                return(hvServiceByWmi);
            }
            catch (Exception ex)
            {
                this._Logger.Information(ex, "Exception thrown during login:  ");
                hvServiceByWmi.Dispose();
                throw;
            }
        }