コード例 #1
0
        public void TestDefaults()
        {
            var mgmtCn = new ManagementConnection();

            Assert.IsNull(mgmtCn.ComputerName);
            Assert.IsFalse(mgmtCn.DisableBadCredentialCache);
            Assert.IsFalse(mgmtCn.DisableCimPersistence);
            Assert.IsFalse(mgmtCn.DisableCredentialAutoRegister);
            Assert.AreEqual(ManagementConnectionType.Wmi | ManagementConnectionType.PowerShellRemoting, mgmtCn.DisabledConnectionTypes);
            Assert.IsFalse(mgmtCn.EnableCredentialFailover);
            Assert.IsFalse(mgmtCn.OverrideExplicitCredential);
            Assert.IsFalse(mgmtCn.UseWindowsCredentials);
            Assert.IsFalse(mgmtCn.WindowsCredentialsAreBad);
            Assert.IsNull(mgmtCn.ToString());
        }
コード例 #2
0
        public void TestRestoreDefaultConfiguration()
        {
            var mgmtCn = new ManagementConnection();

            mgmtCn.DisableBadCredentialCache     = true;
            mgmtCn.DisableCredentialAutoRegister = true;
            mgmtCn.OverrideExplicitCredential    = true;
            mgmtCn.DisableCimPersistence         = true;
            mgmtCn.EnableCredentialFailover      = true;
            mgmtCn.RestoreDefaultConfiguration();

            Assert.IsFalse(mgmtCn.DisableBadCredentialCache);
            Assert.IsFalse(mgmtCn.DisableCimPersistence);
            Assert.IsFalse(mgmtCn.DisableCredentialAutoRegister);
            Assert.IsFalse(mgmtCn.EnableCredentialFailover);
            Assert.IsFalse(mgmtCn.OverrideExplicitCredential);
        }
コード例 #3
0
        internal void CopyTo(ManagementConnection Connection)
        {
            Connection.ComputerName = ComputerName;

            Connection.CimRM                  = CimRM;
            Connection.LastCimRM              = LastCimRM;
            Connection.CimDCOM                = CimDCOM;
            Connection.LastCimDCOM            = LastCimDCOM;
            Connection.Wmi                    = Wmi;
            Connection.LastWmi                = LastWmi;
            Connection.PowerShellRemoting     = PowerShellRemoting;
            Connection.LastPowerShellRemoting = LastPowerShellRemoting;

            Connection.Credentials = Credentials;
            Connection.OverrideExplicitCredential = OverrideExplicitCredential;
            Connection.KnownBadCredentials        = KnownBadCredentials;
            Connection.WindowsCredentialsAreBad   = WindowsCredentialsAreBad;
        }