Script for automating a large assortment of AME related actions
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

250 lines
11 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
  1. # Central AME Script (amecs)
  2. Script for automating a large assortment of AME related actions.
  3. ![Central AME Script Screenshot](screenshot.png)
  4. ## Usage
  5. You can download the script by going to the [latest release](https://git.ameliorated.info/Joe/amecs/releases/latest) and selecting `amecs.zip` from the **Downloads** section. Once downloaded, simply extract `amecs.zip` and run `amecs.cmd`.
  6. Alternatively, you could clone the repository:
  7. git clone https://git.ameliorated.info/Joe/amecs.git
  8. Once cloned, simply run `amecs.cmd`.
  9. ## Primary Functions
  10. There are many actions in AME that require commands, the following functions essentially work as an interactive user interface for those.
  11. #### Username/Password
  12. This function allows for changing the user's username or password.
  13. At its core, the following command is used for changing the username:
  14. wmic useraccount where "name='<User's Username>'" rename '<New Username>'
  15. Similarly, the following command is used for changing the password:
  16. net user "<User's Username>" "<New Password>"
  17. #### Lockscreen Image
  18. This function allows for changing the lockscreen image.
  19. It works by taking ownership of the existing profile image files, and replacing them with the new image supplied by the user.
  20. This is a modified version of [LoganDark's lockscreen-img script](https://git.ameliorated.info/LoganDark/lockscreen-img).
  21. #### Profile Image
  22. This function allows for changing the user's profile image (PFP).
  23. It does this by taking ownership of the existing profile image files, and replacing them with the new image supplied by the user. Several necessary registry changes are made as well.
  24. This is a modified version of [LoganDark's profile-img script](https://git.ameliorated.info/LoganDark/profile-img).
  25. #### User Elevation
  26. This function allows for elevating or de-elevating the user to or from administrator. Elevating the user disables the password requirement when trying to run an executable as administrator. However, this has large security implications, thus why it is not the default setting.
  27. At its core, it uses the following command:
  28. net localgroup administrators "<User's Username>" /add
  29. Or the following for de-elevating the user:
  30. net localgroup administrators "<User's Username>" /delete
  31. #### Display Language
  32. This function allows for changing the user's display language.
  33. Firstly, it prompts the user to download a portion of a \~5.5GB language pack ISO file. Unfortunately, Microsoft no longer publicly distributes individual language pack files, so this is necessary.
  34. Once the ISO is downloaded, it extracts the ISO file, and installs the language pack for the selected display language using the following commands:
  35. 7z e -y -o"<Script Path>\LangPacks" "<User's Desktop>\LangPacks.ISO" x64\langpacks\*.cab
  36. lpksetup /i <Language/region ID> /p "<User's Desktop>\LangPacks\Microsoft-Windows-Client-Language-Pack_x64_<Language/region ID>.cab"
  37. After the language pack is installed, the display language can finally be set. At its core, this is done by using the following commands:
  38. PowerShell -NoP -C "Set-WinSystemLocale <Language/region ID>"
  39. PowerShell -NoP -C "Set-WinUserLanguageList <Language/region ID>"
  40. The Language/region ID for a given language can be found [here](https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/available-language-packs-for-windows?view=windows-11#language-packs).
  41. The script heavily enchances these simple commands. For instance, it keeps the existing keyboard input method (language), and let's the user decide whether or not to make the new language the default keyboard input method.
  42. #### Keyboard Language
  43. These functions allow for adding or removing a keyboard language.
  44. At its core, this is done by using the following command:
  45. PowerShell -NoP -C "$NewLangs=Get-WinUserLanguageList; $NewLangs[0].InputMethodTips.Add('<Language/region ID>:<Keyboard Identifier>'); Set-WinUserLanguageList $NewLangs -Force"
  46. If the user chose to make their selection the new default input method, the following command will also be run:
  47. PowerShell -NoP -C "Set-WinDefaultInputMethodOverride -InputTip "<Language/region ID>:<Keyboard Identifier>""
  48. The Language/region ID and Keyboard identifier for a given language can be found [here](https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/available-language-packs-for-windows?view=windows-11#language-packs) and [here](https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-language-pack-default-values?view=windows-11) respectively.
  49. To remove a keyboard language, it fetches the existing language list, filters out the selected language, and sets the modified language list.
  50. #### Username Login Requirement
  51. This function allows for disabling or enabling the username login requirement.
  52. At its core, it uses the following command:
  53. reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v dontdisplaylastusername /f
  54. Or the following for enabling the requirement:
  55. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v dontdisplaylastusername /t REG_DWORD /d 1 /f
  56. #### AutoLogon
  57. This function allows for enabling or disabling the automatic login of the current user.
  58. It does this by extracting an `AutoLogon.exe` file embedded within the script, and subsequently using it to enable AutoLogon.
  59. The mentioned `AutoLogon.exe` program is a modified version of [rzander's AutoLogon program](https://github.com/rzander/AutoLogon).
  60. ## Extra Functions
  61. This section contains beta, legacy, or less used functions. Legacy functions are only useful for versions of AME predating the [REDACTED].
  62. #### Windows Subsystem for Linux (WSL)
  63. These functions allow for various WSL related actions.
  64. ##### Enable/Disable WSL
  65. This function allows for enabling or disabling WSL functionality.
  66. At its core, this is done by using the following command:
  67. DISM /Online /Enable-Feature /FeatureName:Microsoft-Windows-Subsystem-Linux -NoRestart
  68. Or the following for disabling the requirement:
  69. DISM /Online /Disable-Feature /FeatureName:Microsoft-Windows-Subsystem-Linux -NoRestart
  70. ##### Install WSL Distro
  71. This function allows for installing a WSL distribution.
  72. Firstly, it fetches the distro download link from this git repository (`links.txt`), and downloads the distro from said link\*. Once the distro is downloaded, the script extracts and places the distro in `<User's Local AppData Folder>\AME-WSL`, and subsequently installs the distro by running the distro's `.exe` file contained within.
  73. After the distro has been installed, the script sends several commands to the distro that apply the username and password(s) supplied by the user.
  74. \*If the distro link includes apps.microsoft.com, [store.rg-adguard.net](https://store.rg-adguard.net/) is used to fetch the download link.
  75. ##### Remove WSL Distro
  76. This function allows for removing a WSL distribution.
  77. At its core, it does this by unregistering the distro using the following command:
  78. WSL --unregister <WSL Distro>
  79. And subsequently removing the distro's installation files located in `<User's Local AppData Folder>\AME-WSL`.
  80. #### Hibernation
  81. This function allows for enabling or disabling the hibernation option in Windows.
  82. At its core, the following commands are used:
  83. powercfg /HIBERNATE /TYPE FULL
  84. Or the following for disabling hibernation:
  85. powercfg /HIBERNATE OFF
  86. #### Notification Center
  87. This function allows for enabling or disabling the Notification Center in the bottom right of the taskbar.
  88. At its core, it uses the following command:
  89. reg add "HKU\<User's SID>\Software\Policies\Microsoft\Windows\Explorer" /v DisableNotificationCenter /t REG_DWORD /d 0 /f
  90. Or the following for disabling the Notification Center:
  91. reg add "HKU\<User's SID>\Software\Policies\Microsoft\Windows\Explorer" /v DisableNotificationCenter /t REG_DWORD /d 1 /f
  92. #### Desktop Notifications
  93. This function allows for enabling or disabling desktop toast notifications.
  94. At its core, it uses the following command:
  95. reg add "HKU\<User's SID>\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications" /v ToastEnabled /t REG_DWORD /d 1 /f
  96. Or the following for disabling desktop notifications:
  97. reg add "HKU\<User's SID>\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications" /v ToastEnabled /t REG_DWORD /d 0 /f
  98. #### Windows Script Host (Legacy)
  99. This function allows for enabling or disabling Windows Script Host (WSH). WSH is necessary for some programs.
  100. At its core, the following commands are used:
  101. reg add "HKU\<User's SID>\SOFTWARE\Microsoft\Windows Script Host\Settings" /v Enabled /t REG_DWORD /d 1 /f
  102. reg add "HKLM\SOFTWARE\Microsoft\Windows Script Host\Settings" /v Enabled /t REG_DWORD /d 1 /f
  103. Or the following for disabling WSH:
  104. reg add "HKU\<User's SID>\SOFTWARE\Microsoft\Windows Script Host\Settings" /v Enabled /t REG_DWORD /d 0 /f
  105. reg add "HKLM\SOFTWARE\Microsoft\Windows Script Host\Settings" /v Enabled /t REG_DWORD /d 0 /f
  106. #### Visual Basic Script (Legacy)
  107. This function allows for enabling or disabling Visual Basic Script (VBS). VBS is necessary for some programs.
  108. At its core, the following command is used:
  109. assoc .vbs=VBSFile
  110. Or the following for disabling VBS:
  111. assoc .vbs=
  112. #### NCSI Active Probing (Legacy)
  113. This function allows for enabling or disabling NCSI Active Probing. Some applications require this to be enabled.
  114. At its core, it uses the following command:
  115. reg add "HKLM\SYSTEM\CurrentControlSet\Services\NlaSvc\Parameters\Internet" /v EnableActiveProbing /t REG_DWORD /d 1 /f
  116. Or the following for disabling NCSI Active Probing:
  117. reg add "HKLM\SYSTEM\CurrentControlSet\Services\NlaSvc\Parameters\Internet" /v EnableActiveProbing /t REG_DWORD /d 0 /f
  118. #### New User
  119. This function allows for creating partially functional and pre-configured users in Windows AME.
  120. To do this, it uses a standard user creation command, followed by many registry edits to make the new user usable.
  121. #### NVIDIA Control Panel
  122. This function allows for installing or uninstalling NVIDIA Control Panel. This is useful since NVIDIA Control Panel no longer properly installs during a driver installation* due to it using an APPX deployment (Not supported in AME).
  123. Firstly, it fetches the store link from this git repository (`links.txt`), and fetches the download link from [store.rg-adguard.net](https://store.rg-adguard.net/). Afterwards, it downloads NVIDIA Control Panel from said link\*. Once NVIDIA Control Panel is downloaded, the script extracts and places it in `<System Drive>\Program Files\NVIDIA Control Panel`, and subsequently creates a start menu shortcut for it.
  124. For removal, it simply removes the `<System Drive>\Program Files\NVIDIA Control Panel` directory, as well as the start menu shortcut.
  125. Note: Even though NVIDIA Control Panel installation failes during a driver installation, it still creates the necessary NVIDIA Control Panel files in `<System Drive>\Program Files\WindowsApps`. If this is the case, the script will attempt to use those files instead of downloading them.
  126. \*Standard drivers do not have this issue, however those have been discontinued by NVIDIA.
  127. ## Known Issues
  128. Some keyboard languages may not work, and a few are improperly tagged.