private void InitializeConnectMsolService() { // Create credential object. PSCredential credential = new PSCredential(UserCredential.UserName, UserCredential.Password); //Create RunspaceInvoke _connectMsolService = new ConnectMsolService() { Credential = credential }; }
public void Dispose() { //Close the Runspace and cleanup _runspace.Close(); _runspaceInvoke = null; _runspace = null; _isConnect = false; _initialSessionState = null; _connectMsolService = null; }