Exemplo n.º 1
0
		private CimSessionProxy CreateSessionProxy(CimSession session, GetCimClassCommand cmdlet)
		{
			CimSessionProxy cimSessionProxyGetCimClass = new CimSessionProxyGetCimClass(session);
			base.SubscribeEventAndAddProxytoCache(cimSessionProxyGetCimClass);
			this.SetSessionProxyProperties(ref cimSessionProxyGetCimClass, cmdlet);
			return cimSessionProxyGetCimClass;
		}
Exemplo n.º 2
0
        private CimSessionProxy CreateSessionProxy(string computerName, GetCimClassCommand cmdlet)
        {
            CimSessionProxy cimSessionProxyGetCimClass = null;

            if (!string.IsNullOrEmpty(computerName) && !computerName.Equals("localhost", StringComparison.OrdinalIgnoreCase))
            {
                /* Set on the fly credentials */
                System.Management.Automation.PSCredential credential = GetOnTheFlyCredentials(cmdlet);
                if (credential == null)
                {
                    cimSessionProxyGetCimClass = new CimSessionProxyGetCimClass(computerName);
                }
                else
                {
                    CimSessionOptions options = new WSManSessionOptions();
                    options.AddDestinationCredentials(cmdlet.CreateCimCredentials(credential, PasswordAuthenticationMechanism.Default, "Get-CimClass", "Authentication"));
                    cimSessionProxyGetCimClass = new CimSessionProxyGetCimClass(computerName, options);
                }
            }
            else
            {
                cimSessionProxyGetCimClass = new CimSessionProxyGetCimClass(computerName);
            }
            base.SubscribeEventAndAddProxytoCache(cimSessionProxyGetCimClass);
            this.SetSessionProxyProperties(ref cimSessionProxyGetCimClass, cmdlet);
            return(cimSessionProxyGetCimClass);
        }
Exemplo n.º 3
0
        private CimSessionProxy CreateSessionProxy(CimSession session, GetCimClassCommand cmdlet)
        {
            CimSessionProxy cimSessionProxyGetCimClass = new CimSessionProxyGetCimClass(session);

            base.SubscribeEventAndAddProxytoCache(cimSessionProxyGetCimClass);
            this.SetSessionProxyProperties(ref cimSessionProxyGetCimClass, cmdlet);
            return(cimSessionProxyGetCimClass);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Create <see cref="CimSessionProxy"/> and set properties.
        /// </summary>
        /// <param name="session"></param>
        /// <param name="cmdlet"></param>
        /// <returns></returns>
        private CimSessionProxy CreateSessionProxy(
            CimSession session,
            GetCimClassCommand cmdlet)
        {
            CimSessionProxy proxy = new CimSessionProxyGetCimClass(session);

            this.SubscribeEventAndAddProxytoCache(proxy);
            SetSessionProxyProperties(ref proxy, cmdlet);
            return(proxy);
        }
Exemplo n.º 5
0
        /// <summary>
        /// <para>
        /// Create <see cref="CimSessionProxy"/> and set properties
        /// </para>
        /// </summary>
        /// <param name="computerName"></param>
        /// <param name="cmdlet"></param>
        /// <returns></returns>
        private CimSessionProxy CreateSessionProxy(
            string computerName,
            GetCimClassCommand cmdlet)
        {
            CimSessionProxy proxy = new CimSessionProxyGetCimClass(computerName);

            this.SubscribeEventAndAddProxytoCache(proxy);
            SetSessionProxyProperties(ref proxy, cmdlet);
            return(proxy);
        }
Exemplo n.º 6
0
		private CimSessionProxy CreateSessionProxy(string computerName, GetCimClassCommand cmdlet)
		{
			CimSessionProxy cimSessionProxyGetCimClass = null;
			if (!string.IsNullOrEmpty (computerName) && !computerName.Equals ("localhost", StringComparison.OrdinalIgnoreCase)) {
				/* Set on the fly credentials */
				System.Management.Automation.PSCredential credential = GetOnTheFlyCredentials(cmdlet);
				if (credential == null) 
					cimSessionProxyGetCimClass = new CimSessionProxyGetCimClass(computerName);
				else {
					CimSessionOptions options = new WSManSessionOptions ();
					options.AddDestinationCredentials (cmdlet.CreateCimCredentials (credential, PasswordAuthenticationMechanism.Default, "Get-CimClass", "Authentication"));
					cimSessionProxyGetCimClass = new CimSessionProxyGetCimClass (computerName, options);
				}
			}
			else {
				cimSessionProxyGetCimClass = new CimSessionProxyGetCimClass(computerName);
			}
			base.SubscribeEventAndAddProxytoCache(cimSessionProxyGetCimClass);
			this.SetSessionProxyProperties(ref cimSessionProxyGetCimClass, cmdlet);
			return cimSessionProxyGetCimClass;
		}
Exemplo n.º 7
0
 /// <summary>
 /// Create <see cref="CimSessionProxy"/> and set properties
 /// </summary>
 /// <param name="session"></param>
 /// <param name="cmdlet"></param>
 /// <returns></returns>
 private CimSessionProxy CreateSessionProxy(
     CimSession session,
     GetCimClassCommand cmdlet)
 {
     CimSessionProxy proxy = new CimSessionProxyGetCimClass(session);
     this.SubscribeEventAndAddProxytoCache(proxy);
     SetSessionProxyProperties(ref proxy, cmdlet);
     return proxy;
 }
Exemplo n.º 8
0
 /// <summary>
 /// <para>
 /// Create <see cref="CimSessionProxy"/> and set properties
 /// </para>
 /// </summary>
 /// <param name="computerName"></param>
 /// <param name="cmdlet"></param>
 /// <returns></returns>
 private CimSessionProxy CreateSessionProxy(
     string computerName,
     GetCimClassCommand cmdlet)
 {
     CimSessionProxy proxy = new CimSessionProxyGetCimClass(computerName);
     this.SubscribeEventAndAddProxytoCache(proxy);
     SetSessionProxyProperties(ref proxy, cmdlet);
     return proxy;
 }