private CimSessionProxy CreateSessionProxy(CimSession session, GetCimClassCommand cmdlet) { CimSessionProxy cimSessionProxyGetCimClass = new CimSessionProxyGetCimClass(session); base.SubscribeEventAndAddProxytoCache(cimSessionProxyGetCimClass); this.SetSessionProxyProperties(ref cimSessionProxyGetCimClass, cmdlet); return cimSessionProxyGetCimClass; }
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); }
private CimSessionProxy CreateSessionProxy(CimSession session, GetCimClassCommand cmdlet) { CimSessionProxy cimSessionProxyGetCimClass = new CimSessionProxyGetCimClass(session); base.SubscribeEventAndAddProxytoCache(cimSessionProxyGetCimClass); this.SetSessionProxyProperties(ref cimSessionProxyGetCimClass, cmdlet); return(cimSessionProxyGetCimClass); }
/// <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); }
/// <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); }
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; }
/// <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; }
/// <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; }