//methods
        public void AutlogonSettings(OSVersions os, ConfigClass configClass)
        {
            try
            {
                string regPath      = "";
                string regKey       = "";
                string value        = "";
                string propertyType = "String";

                #region Auto-login set for user
                if (_autologonInUse)
                {
                    if (configClass.ConfSetWindowsUsers.CheckIfUserExist(UsernameAutoLogon, configClass))
                    {
                        #region RegPath
                        if (Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(os, "AutoLogonRegPath") != null)
                        {
                            regPath = Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(os, "AutoLogonRegPath");
                        }
                        else
                        {
                            regPath = Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(OSVersions.AllOS, "AutoLogonRegPath");
                        }
                        #endregion RegPath
                        #region Username
                        if (Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(os, "AutoLogonUsername") != null)
                        {
                            regKey = Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(os, "AutoLogonUsername");
                        }
                        else
                        {
                            regKey = Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(OSVersions.AllOS, "AutoLogonUsername");
                        }
                        value = _usernameAutoLogon; // name
                        configClass.GetScriptHandling.SetRegisterKey(regPath, regKey, value, propertyType);
                        #endregion  Username
                        #region Pasword
                        string password = "";
                        if (_passwordAutoLogon == "PassWordIsEncrypted")
                        {
                            EncryptionPassword enc = new EncryptionPassword(configClass);
                            password = enc.GetKey("AutoLogon");
                        }
                        else
                        {
                            password = _passwordAutoLogon;
                        }

                        if (Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(os, "AutoLogonPassword") != null)
                        {
                            regKey = Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(os, "AutoLogonPassword");
                        }
                        else
                        {
                            regKey = Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(OSVersions.AllOS, "AutoLogonPassword");
                        }
                        value = password; //password
                        configClass.GetScriptHandling.SetRegisterKey(regPath, regKey, value, propertyType);
                        #endregion Pasword
                        #region DomainName
                        if (Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(os, "AutoLogonDomainName") != null)
                        {
                            regKey = Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(os, "AutoLogonDomainName");
                        }
                        else
                        {
                            regKey = Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(OSVersions.AllOS, "AutoLogonDomainName");
                        }
                        value = System.Environment.MachineName;//Domain
                        configClass.GetScriptHandling.SetRegisterKey(regPath, regKey, value, propertyType);
                        #endregion DomainName
                        #region SetAutoLogon
                        if (Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(os, "AutoAdminLogon") != null)
                        {
                            regKey = Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(os, "AutoAdminLogon");
                        }
                        else
                        {
                            regKey = Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(OSVersions.AllOS, "AutoAdminLogon");
                        }
                        value = "1";
                        configClass.GetScriptHandling.SetRegisterKey(regPath, regKey, value, propertyType);
                        #endregion SetAutoLogon
                    }

                    else
                    {
                        configClass.ErrorList.Add(new ConfigErrors(CLASSNAME, "Autologon settings", "Gebruikers account niet beschikbaar"));
                        AutoLogonCheck = false;
                    }
                }
                #endregion Auto-login set for user
                #region Disable Auto login
                else
                {
                    #region RegPath
                    if (Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(os, "AutoLogonRegPath") != null)
                    {
                        regPath = Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(os, "AutoLogonRegPath");
                    }
                    else
                    {
                        regPath = Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(OSVersions.AllOS, "AutoLogonRegPath");
                    }
                    #endregion RegPath
                    #region Pasword
                    if (Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(os, "AutoLogonPassword") != null)
                    {
                        regKey = Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(os, "AutoLogonPassword");
                    }
                    else
                    {
                        regKey = Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(OSVersions.AllOS, "AutoLogonPassword");
                    }
                    configClass.GetScriptHandling.RemoveRegisterKey(regPath, regKey);
                    #endregion Pasword
                    #region SetAutoLogon
                    if (Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(os, "AutoAdminLogon") != null)
                    {
                        regKey = Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(os, "AutoAdminLogon");
                    }
                    else
                    {
                        regKey = Actemium.WiSSWizard.Support.ResourceHelper.GetOSOperations(OSVersions.AllOS, "AutoAdminLogon");
                    }
                    value = "0";
                    configClass.GetScriptHandling.SetRegisterKey(regPath, regKey, value, propertyType);
                    #endregion SetAutoLogon
                }
                #endregion Disable Auto login
            }
            catch (Exception ex)
            {
                Actemium.Diagnostics.Trace.WriteError("({0})", "Autologon settings", CLASSNAME, ex);
                configClass.ErrorList.Add(new ConfigErrors(CLASSNAME, "Autologon settings", ex.Message));
                AutoLogonCheck = false;
            }
        }
Ejemplo n.º 2
0
        public void AddUsers(ConfigClass configClass, EncryptionPassword enc)
        {
            string name = "";

            try
            {
                string        fullname              = "";
                string        description           = "";
                List <string> group                 = new List <string>();
                int           changePwNextLogon     = -1;
                int           passwordCantBeChanged = -1;
                int           passwordNeverExpires  = -1;
                int           accountDisabled       = -1;
                string        password              = "";

                foreach (NewUser newUser in _newUsers)
                {
                    name = newUser.Name;
                    if (newUser.Fullname.Length != 0)
                    {
                        fullname = newUser.Fullname;
                    }
                    if (newUser.Description.Length != 0)
                    {
                        description = newUser.Description;
                    }
                    if (newUser.UserGroupList.Count != 0)
                    {
                        group = newUser.UserGroupList;
                    }

                    if (newUser.ChangePwNextLogon == "Yes")
                    {
                        changePwNextLogon = 1;
                    }
                    else if (newUser.ChangePwNextLogon == "No")
                    {
                        changePwNextLogon = 0;
                    }

                    if (newUser.PasswordCantBeChanged == "Yes")
                    {
                        passwordCantBeChanged = 1;
                    }
                    else if (newUser.PasswordCantBeChanged == "No")
                    {
                        passwordCantBeChanged = 0;
                    }

                    if (newUser.PasswordNeverExpires == "Yes")
                    {
                        passwordNeverExpires = 1;
                    }
                    else if (newUser.PasswordNeverExpires == "No")
                    {
                        passwordNeverExpires = 0;
                    }

                    if (newUser.AccountDisabled == "Yes")
                    {
                        accountDisabled = 1;
                    }
                    else if (newUser.AccountDisabled == "No")
                    {
                        accountDisabled = 0;
                    }
                    if (newUser.Password.Length != 0)
                    {
                        if (newUser.Password == "PassWordIsEncrypted")
                        {
                            password = enc.GetKey(name);
                        }
                        else
                        {
                            password = newUser.Password;
                        }
                    }

                    configClass.GetScriptHandling.CreateUser(name, fullname, description, group, changePwNextLogon, passwordCantBeChanged, passwordNeverExpires, accountDisabled, password);
                    foreach (string groupString in group)
                    {
                        configClass.GetScriptHandling.AddUserToGroup(newUser.Name, groupString);
                    }
                }
            }
            catch (Exception ex)
            {
                Trace.WriteError(ex.Message, "NewUser", CLASSNAME);
                configClass.ErrorList.Add(new ConfigErrors(CLASSNAME, "Create user " + name, ex.Message));
            }
        }
Ejemplo n.º 3
0
        public void ModifyUsers(ConfigClass configClass, EncryptionPassword enc)
        {
            string        name                  = "";
            string        fullname              = "";
            string        description           = "";
            List <string> group                 = new List <string>();
            bool          changePwNextLogon     = false;
            bool          passwordCantBeChanged = false;
            bool          passwordNeverExpires  = false;
            bool          accountDisabled       = false;
            string        password              = "";
            bool          modifyOtherSettings   = false;

            try
            {
                foreach (ModfiedUser modifiedUser in _modifiedUsers)
                {
                    name = modifiedUser.Name;
                    if (modifiedUser.Fullname.Length != 0)
                    {
                        fullname = modifiedUser.Fullname;
                    }
                    if (modifiedUser.Description.Length != 0)
                    {
                        description = modifiedUser.Description;
                    }
                    if (modifiedUser.UserGroupList.Count != 0)
                    {
                        group = modifiedUser.UserGroupList;
                    }
                    if (modifiedUser.ChangePwNextLogon == "Yes")
                    {
                        changePwNextLogon = true;
                    }
                    else if (modifiedUser.ChangePwNextLogon == "No")
                    {
                        changePwNextLogon = false;
                    }

                    if (modifiedUser.PasswordCantBeChanged == "Yes")
                    {
                        passwordCantBeChanged = true;
                    }
                    else if (modifiedUser.PasswordCantBeChanged == "No")
                    {
                        passwordCantBeChanged = false;
                    }

                    if (modifiedUser.PasswordNeverExpires == "Yes")
                    {
                        passwordNeverExpires = true;
                    }
                    else if (modifiedUser.PasswordNeverExpires == "No")
                    {
                        passwordNeverExpires = false;
                    }

                    if (modifiedUser.AccountDisabled == "Yes")
                    {
                        accountDisabled = true;
                    }
                    else if (modifiedUser.AccountDisabled == "No")
                    {
                        accountDisabled = false;
                    }
                    if (modifiedUser.Password.Length != 0)
                    {
                        if (modifiedUser.Password == "PassWordIsEncrypted")
                        {
                            password = enc.GetKey(name);
                        }
                        else
                        {
                            password = modifiedUser.Password;
                        }
                    }
                    if (modifiedUser.ModifyOtherSettings == "Yes")
                    {
                        modifyOtherSettings = true;
                    }
                    else if (modifiedUser.ModifyOtherSettings == "No")
                    {
                        modifyOtherSettings = false;
                    }

                    configClass.GetScriptHandling.ModifyUser(name, fullname, description, changePwNextLogon, passwordCantBeChanged, passwordNeverExpires, accountDisabled, password, modifyOtherSettings);
                    foreach (string groupString in group)
                    {
                        configClass.GetScriptHandling.AddUserToGroup(modifiedUser.Name, groupString);
                    }
                }
            }
            catch (Exception ex)
            {
                Trace.WriteError(ex.Message, "ModifyUser " + name, CLASSNAME);
                configClass.ErrorList.Add(new ConfigErrors(CLASSNAME, "Modifyuser " + name, ex.Message));
            }
        }
Ejemplo n.º 4
0
        public void CheckIfPassWordsAreEncrypted(bool Encrypted)
        {
            if (Encrypted)
            {
                #region newusers
                List <NewUser> changePWnewUser = new List <NewUser>();
                foreach (NewUser user in _newUsers)
                {
                    if (user.Password == "PassWordIsEncrypted")
                    {
                        changePWnewUser.Add(user);
                    }
                }
                foreach (NewUser change in changePWnewUser)
                {
                    _newUsers.Remove(change);
                    NewUser temp = change;
                    temp.Password = _encryptionPassword.GetKey(temp.Name);
                    _newUsers.Add(temp);
                }
                #endregion newusers

                #region modifiedusers
                List <ModfiedUser> changePWmodifiedUser = new List <ModfiedUser>();
                foreach (ModfiedUser user in _modifiedUsers)
                {
                    if (user.Password == "PassWordIsEncrypted")
                    {
                        changePWmodifiedUser.Add(user);
                    }
                }

                foreach (ModfiedUser change in changePWmodifiedUser)
                {
                    if (change.Password != "-1")
                    {
                        _modifiedUsers.Remove(change);
                        ModfiedUser temp = change;
                        temp.Password = _encryptionPassword.GetKey(temp.Name);
                        _modifiedUsers.Add(temp);
                    }
                }
                #endregion modifiedusers
            }
            else
            {
                #region newUsers
                List <NewUser> changePWnewUser = new List <NewUser>();
                foreach (NewUser user in _newUsers)
                {
                    if (user.Password != "PassWordIsEncrypted")
                    {
                        changePWnewUser.Add(user);
                    }
                }
                foreach (NewUser change in changePWnewUser)
                {
                    _newUsers.Remove(change);
                    NewUser temp = change;
                    _encryptionPassword.AddKey(change.Name, change.Password);
                    temp.Password = "******";
                    _newUsers.Add(temp);
                }
                #endregion newUsers

                #region modifiedUsers
                List <ModfiedUser> changePWmodifiedUser = new List <ModfiedUser>();
                foreach (ModfiedUser user in _modifiedUsers)
                {
                    if (user.Password != "-1")
                    {
                        if (user.Password != "PassWordIsEncrypted")
                        {
                            changePWmodifiedUser.Add(user);
                        }
                    }
                }
                foreach (ModfiedUser change in changePWmodifiedUser)
                {
                    _modifiedUsers.Remove(change);
                    ModfiedUser temp = change;
                    _encryptionPassword.AddKey(change.Name, change.Password);
                    temp.Password = "******";
                    _modifiedUsers.Add(temp);
                }
                #endregion modifiedUsers
            }
        }