public bool DisableAutoPlay() { try { RegistrySettings.ModifyHKLMRegistryValue(@"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoDriveTypeAutorun", "", 177, RegistryValueKind.DWord, true); RegistrySettings.ModifyHKCURegistryValue(@"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoDriveTypeAutorun", "", 177, RegistryValueKind.DWord, true); return(true); } catch (Win32Exception ex) { Logging.LogErrorMessage("Error Disabling AutoPlay"); Logging.LogErrorMessage(ex.Message); } return(false); }
public bool DisableShowSuggestions() { //http://www.winhelponline.com/blog/how-to-disable-start-menu-ads-or-suggestions-in-windows-10/ //https://answers.microsoft.com/en-us/windows/forum/windows_10-start/how-can-powershell-be-used-to-automate-turning-off/c10ca270-2ce9-44f3-9cba-712eb9ba6942 if (!RegistrySettings.ModifyHKCURegistryValue(@"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SystemPaneSuggestionsEnabled", "", 0, RegistryValueKind.DWord, true)) { } if (!RegistrySettings.ModifyHKCURegistryValue(@"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager\", "SoftLandingEnabled", "", 0, RegistryValueKind.DWord, true)) { } if (!RegistrySettings.ModifyHKCURegistryValue(@"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager\", "RotatingLockScreenEnabled", "", 0, RegistryValueKind.DWord, true)) { } return(true); }
public bool DisableUAC() { //UAC Group Policy Settings and Registry Key Settings //https://technet.microsoft.com/en-us/library/dd835564(v=ws.10).aspx#BKMK_BuiltInAdmin //https://4sysops.com/archives/why-the-built-in-administrator-account-cant-open-edge-and-a-lesson-in-uac/ try { RegistrySettings.ModifyHKLMRegistryValue(Resources.RegistrySettingCurrentVersionPoliciesSystem, "FilterAdministratorToken", "", 0, RegistryValueKind.DWord, true); return(RegistrySettings.ModifyHKLMRegistryValue(Resources.RegistrySettingCurrentVersionPoliciesSystem, "EnableLUA", "", 0, RegistryValueKind.DWord, true)); } catch (Exception exc) { Logging.LogErrorMessage("Error Disabling User Account Control"); Logging.LogErrorMessage(exc.Message); } return(false); }
public bool DisableSynchronizeTimeFromInternet() { return(RegistrySettings.ModifyHKLMRegistryValue(Resources.DisableSynchronizeTimeFromInternet, "Type", "NoSync", 0, RegistryValueKind.String, true)); }
public bool EnableSaveTaskbarThumbnailPreviews() { return(RegistrySettings.ModifyHKCURegistryValue(@"Software\Microsoft\Windows\DWM", "AlwaysHibernateThumbnails", "", 1, RegistryValueKind.DWord, true)); }
private bool SetDropShadow() { return(RegistrySettings.ModifyHKCURegistryValue(@"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ListviewShadow", "", 0, RegistryValueKind.DWord, true)); }
public bool DisableSecureTime() { return(RegistrySettings.ModifyHKLMRegistryValue(@"SYSTEM\CurrentControlSet\Services\w32time\Config", "UtilizeSslTimeData", "", 0, RegistryValueKind.DWord, true)); }
private bool SetTaskbarAnimation() { return(RegistrySettings.ModifyHKCURegistryValue(@"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarAnimations", "", 0, RegistryValueKind.DWord, true)); }
public bool DisableAeroPeek() { return(RegistrySettings.ModifyHKCURegistryValue(@"Software\Microsoft\Windows\DWM", "EnableAeroPeek", "", 0, RegistryValueKind.DWord, true)); }
private bool SetAnimateWindowsWhenMinMax() { return(RegistrySettings.ModifyHKCURegistryValue(@"Control Panel\Desktop\WindowMetrics", "MinAnimate", "", 0, RegistryValueKind.DWord, true)); }
//private bool SetUserPreferencesMask() //{ // //List of bits for the User Preferences Mask - http://technet.microsoft.com/en-us/library/cc957204.aspx // return RegistrySettings.ModifyHKCURegistryBinaryValue(@"Control Panel\Desktop", "UserPreferencesMask", new byte[] { 0x90, 0x22, 0x07, 0x00, 0x10, 0x00, 0x00, 0x00 }); //} private bool SetUISettingsToCustom(string regKey) { //Setting this value to 3 will ensure the UI settings are set to "Custom", allowing for changes return(RegistrySettings.ModifyHKCURegistryValue(regKey, "VisualFXSetting", "", 3, RegistryValueKind.DWord, true)); }
public bool DisableActionCenterSidebar() { //http://www.askvg.com/collection-of-windows-10-hidden-secret-registry-tweaks/ RegistrySettings.ModifyHKLMRegistryValue(@"Software\Microsoft\Windows\CurrentVersion\ImmersiveShell", "UseActionCenterExperience", "", 0, RegistryValueKind.DWord, true); return(true); }
public bool IsWindows10OrGreater() { string OSVersion = RegistrySettings.FindHKLMRegistryValueDWord(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CurrentMajorVersionNumber"); if (!String.IsNullOrEmpty(OSVersion)) { if (OSVersion.Equals("10")) { return(true); } } return(false); }
public bool SetLanManagerAuth() { try { return(RegistrySettings.ModifyHKLMRegistryValue(Resources.RegistrySettingControlLSA, "lmcompatibilitylevel", "", 1, RegistryValueKind.DWord, true)); } catch (Exception exc) { Logging.LogErrorMessage("Error setting Lan Manager Authentication"); Logging.LogErrorMessage(exc.Message); } return(false); }
public bool DisableConsentPromptBehaviorUser() { try { return(RegistrySettings.ModifyHKLMRegistryValue(Resources.RegistrySettingCurrentVersionPoliciesSystem, "ConsentPromptBehaviorUser", "", 1, RegistryValueKind.DWord, true)); } catch (Exception exc) { Logging.LogErrorMessage("Error Setting ConsentPromptBehaviorUser Registry Setting to 0"); Logging.LogErrorMessage(exc.Message); } return(false); }
public bool CreateEnableLinkedConnections() { try { return(RegistrySettings.ModifyHKLMRegistryValue(Resources.RegistrySettingCurrentVersionPoliciesSystem, "EnableLinkedConnections", "", 1, RegistryValueKind.DWord, true)); } catch (Exception exc) { Logging.LogErrorMessage("Error Setting CreateEnableLinkedConnections in Registry"); Logging.LogErrorMessage(exc.Message); } return(false); }
public bool EnableRDP() { try { return(RegistrySettings.ModifyHKLMRegistryValue(Resources.RegistrySettingTerminalServer, "fDenyTSConnections", "", 0, RegistryValueKind.DWord, true)); } catch (Exception exc) { Logging.LogErrorMessage("Error enabling Remote Desktop Protocol"); Logging.LogErrorMessage(exc.Message); } return(false); }
public bool SetExeToRunAsAdministrator() { try { return(RegistrySettings.ModifyHKCURegistryValue(Resources.RegistrySettingRunAsAdministrator, @"C:\HLC\NexGen.exe", "RUNASADMIN", 0, RegistryValueKind.String, true)); } catch (Exception exc) { Logging.LogErrorMessage("Error Setting EXE to Run As Administrator"); Logging.LogErrorMessage(exc.Message); } return(false); }
public bool DisablePowerManagementOnNics() { try { int nIndex = 0; for (nIndex = 0; nIndex < 100; nIndex++) { RegistrySettings.ModifyHKLMRegistryValue(@"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\" + nIndex.ToString("D4"), "PnPCapabilities", "", 24, RegistryValueKind.DWord, false); } return(true); //bool bNoError = true; //if (!netAdapters.Any()) //{ // netAdapters = GetNetworkAdapters(); //} //foreach (NetworkInterface adapter in netAdapters) //{ // string _psScript = @"Disable-NetAdapterPowerManagement -Name *"; // string _psScript = Resources.DisablePowerManagementOnNics + @"""" + adapter.Name + @""""; // if (!PerformPowerShell("", "", "", "", "", "", "", _psScript)) // { // Logging.LogErrorMessage("Error Disable Flow Control on Network Adapters"); // bNoError = false; // } //} //return bNoError; } catch (System.Exception ex) { Logging.LogErrorMessage("Exception - Error Disable Flow Control on Network Adapters"); Logging.LogErrorMessage(ex.Message); } return(false); }
public bool SetListMangerPolicies() { try { //SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\010103000F0000F0010000000F0000F0C967A3643C3AD745950DA7859209176EF5B87C875FA20DF21951640E807D7C24 return(RegistrySettings.ModifyHKLMRegistryValue(Resources.RegistrySettingControlLSA, "lmcompatibilitylevel", "", 1, RegistryValueKind.DWord, true)); } catch (Exception exc) { Logging.LogErrorMessage("Error setting List Manager Policies"); Logging.LogErrorMessage(exc.Message); } return(false); }
public bool DisableAppNotifications(bool bWindows10) { //http://superuser.com/questions/1140134/how-do-i-turn-off-get-notifications-from-apps-and-other-senders-in-windows-10 //https://www.tenforums.com/tutorials/4111-notifications-apps-turn-off-windows-10-a.html#option2 //HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\PushNotifications //ToastEnabled DWORD //0 = Turn off //1 = Turn on //string _psScript = Resources.RegistryHKCUPushNotifications; //SystemOptions.PerformPowerShell("", "", "", "", "", "", "", _psScript); //_psScript = Resources.RegistryHKCUToastEnabled; //SystemOptions.PerformPowerShell("", "", "", "", "", "", "", _psScript); //if( bWindows10 ) { if (!RegistrySettings.ModifyHKCURegistryValue(@"SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications", "ToastEnabled", "", 0, RegistryValueKind.DWord, true)) { Logging.LogErrorMessage(@"SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications\ToastEnabled"); } } //else //{ // RegistrySettings.ModifyHKCURegistryValue(@"SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications", // "NoToastApplicationNotification ", // "", // 1, // RegistryValueKind.DWord, true); //} DisableShowSuggestions(); return(true); }
public bool CreateRCSUserAndSetToAutoLogon() { try { DirectoryEntry hostMachineDirectory = new DirectoryEntry("WinNT://localhost"); DirectoryEntries entries = hostMachineDirectory.Children; bool userExists = false; foreach (DirectoryEntry each in entries) { userExists = each.Name.Equals("RCS", StringComparison.CurrentCultureIgnoreCase); if (userExists) { break; } } if (false == userExists) { DirectoryEntry obUser = entries.Add("RCS", "User"); obUser.Properties["FullName"].Add("RCS"); //obUser.Invoke("SetPassword", "abcdefg12345@"); obUser.Invoke("Put", new object[] { "UserFlags", 0x10000 }); obUser.CommitChanges(); RegistrySettings.ModifyHKLMRegistryValue(Resources.RegistrySettingWinLogon, "AutoAdminLogon", "1", 1, RegistryValueKind.String, true); RegistrySettings.ModifyHKLMRegistryValue(Resources.RegistrySettingWinLogon, "DefaultUserName", "RCS", 0, RegistryValueKind.String, true); return(true); } } catch (System.Exception ex) { Logging.LogErrorMessage("Error Creating RCS User"); Logging.LogErrorMessage(ex.Message); } return(false); }
private bool EnableControlPanelIconForUser() { try { RegistrySettings.ModifyHKCURegistryValue(Resources.RegistrySettingClassicStartMenu, "{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}", "", 0, RegistryValueKind.DWord, true); RegistrySettings.ModifyHKCURegistryValue(Resources.RegistrySettingNewStartPanel, "{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}", "", 0, RegistryValueKind.DWord, true); RegistrySettings.ModifyHKLMRegistryValue(Resources.RegistrySettingClassicStartMenu, "{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}", "", 0, RegistryValueKind.DWord, true); RegistrySettings.ModifyHKLMRegistryValue(Resources.RegistrySettingNewStartPanel, "{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}", "", 0, RegistryValueKind.DWord, true); return(true); } catch (Exception ex) { Logging.LogErrorMessage("Error Enabling Network Icons"); Logging.LogErrorMessage(ex.Message); } return(false); }
public bool DisableNotificationCenter() { //HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\Explorer //DisableNotificationCenter DWORD string _psScript = Resources.RegistrySettingWindowsExplorer; SystemOptions.PerformPowerShell("", "", "", "", "", "", "", _psScript); //_psScript = Resources.RegistryHKCUDisableNotificationCenter; //SystemOptions.PerformPowerShell("", "", "", "", "", "", "", _psScript); //1 = Turn off //0 = Turn on RegistrySettings.ModifyHKCURegistryValue(@"SOFTWARE\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", "", 1, RegistryValueKind.DWord, true); return(true); }
public bool EnableAutoLogin(string UserName, string PassWord, string Domain) { try { if (String.IsNullOrEmpty(UserName) || String.IsNullOrEmpty(PassWord)) { Logging.LogErrorMessage("Error Setting AutoLogin for User"); Logging.LogErrorMessage("Username and/or Password fields were blank!"); return(false); } string userName = UserName; string userPW = PassWord; string userDomain = Domain; RegistrySettings.ModifyHKLMRegistryValue(Resources.RegistrySettingWinLogon, "AutoAdminLogon", "1", 1, RegistryValueKind.String, true); RegistrySettings.ModifyHKLMRegistryValue(Resources.RegistrySettingWinLogon, "DefaultUserName", userName, 0, RegistryValueKind.String, true); RegistrySettings.ModifyHKLMRegistryValue(Resources.RegistrySettingWinLogon, "DefaultPassword", userPW, 0, RegistryValueKind.String, true); if (!String.IsNullOrEmpty(userDomain)) { RegistrySettings.ModifyHKLMRegistryValue(Resources.RegistrySettingWinLogon, "DefaultDomainName", userDomain, 0, RegistryValueKind.String, true); } return(true); } catch (Exception exc) { Logging.LogErrorMessage("Error Setting AutoLogin for User"); Logging.LogErrorMessage(exc.Message); } return(false); }
private bool EnableComputerIconFOrUser() { try { RegistrySettings.ModifyHKCURegistryValue(Resources.RegistrySettingClassicStartMenu, "{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "", 0, RegistryValueKind.DWord, true); RegistrySettings.ModifyHKCURegistryValue(Resources.RegistrySettingNewStartPanel, "{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "", 0, RegistryValueKind.DWord, true); RegistrySettings.ModifyHKLMRegistryValue(Resources.RegistrySettingClassicStartMenu, "{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "", 0, RegistryValueKind.DWord, true); RegistrySettings.ModifyHKLMRegistryValue(Resources.RegistrySettingNewStartPanel, "{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "", 0, RegistryValueKind.DWord, true); return(true); } catch (Exception ex) { Logging.LogErrorMessage("Error Enabling Computer Icon"); Logging.LogErrorMessage(ex.Message); } return(false); }
private bool CheckForMinVersionOfPowerShell(bool displayError) { try { string PSVersion = RegistrySettings.FindHKLMRegistrValueString(@"SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine", "PowerShellVersion"); if (String.IsNullOrEmpty(PSVersion)) { PSVersion = RegistrySettings.FindHKLMRegistrValueString(@"SOFTWARE\Microsoft\PowerShell\2\PowerShellEngine", "PowerShellVersion"); } if (String.IsNullOrEmpty(PSVersion)) { PSVersion = RegistrySettings.FindHKLMRegistrValueString(@"SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine", "PowerShellVersion"); } if (String.IsNullOrEmpty(PSVersion)) { return(false); } if (_bWindows10) { float PSVersionValue = Convert.ToSingle(PSVersion); if (PSVersionValue < 5.0) { if (displayError) { MessageBox.Show("PowerShell 5.0 is Required for Windows8.1/Server 2012!\n\nPlease use the Install PowerShell button below", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); _bPowershellWarningDisplayed = true; } return(false); } } else if (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor >= 2) { float PSVersionValue = Convert.ToSingle(PSVersion); //if (PSVersionValue < 4.0) //{ // if (displayError) // { // MessageBox.Show("PowerShell 4.0 is Required for Windows8.1/Server 2012!\n\nPlease use the Install PowerShell button below", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); // } // return false; //} if (PSVersionValue < 5.0) { MessageBox.Show("PowerShell 5.0 is Available for Windows8.1/Server 2012!\n\nPlease use the Install PowerShell button below", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); _bPowershellWarningDisplayed = true; } } else if (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor == 1) { float PSVersionValue = Convert.ToSingle(PSVersion); //if (PSVersionValue < 3.0) //{ // if (displayError) // MessageBox.Show("PowerShell 3.0 is Required for Windows7/Server 2008 R2!\n\nPlease use the Install PowerShell button below", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); // return false; //} if (PSVersionValue < 5.0) { MessageBox.Show("PowerShell 5.0 is Available for Windows7.1/Server 2012!\n\nPlease use the Install PowerShell button below", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); _bPowershellWarningDisplayed = true; } } return(true); } catch (Exception ex) { if (displayError) { MessageBox.Show("Error checking for version of PowerShell!\n\nPlease check the Error Log File for More Details!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } Logging.LogErrorMessage("CheckForMinVersionOfPowerShell"); Logging.LogErrorMessage(ex.Message); } return(false); }