farag2 / sophia-script-for-windows Goto Github PK
View Code? Open in Web Editor NEW:zap: The most powerful PowerShell module on GitHub for fine-tuning Windows 10 & Windows 11
License: MIT License
:zap: The most powerful PowerShell module on GitHub for fine-tuning Windows 10 & Windows 11
License: MIT License
Just run the latest version of the script (Win.10.1903-1909.4.4.6)
Desktop:
Additional context
The send to option from the context menu is gone. I have had the same exact result after running the script on two different devices after a fresh windows install.
I fixed that on both devices by editing a registry entry which had an extra hyphen in its value for some reason.
So my desktop is now showing the users/Public desktop?? How can I revert this to the old desktop for MY account which is location in users/callu/OneDrive/Desktop
Hello! It would be nice to leave the calculator out of UWP apps. And delete user folders from this computer because they are duplicated in quick access.
You could just explain how to do it so I can add it to the fork. You don't have to add this to a new release.
So I have the code that can hide these folders. But that code for Windows register.
Windows Registry Editor Version 5.00
;Удаление 7 папок пользователя из окна компьютер
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{0ddd015d-b06c-45d5-8c4c-f59713854639}\PropertyBag]
"ThisPCPolicy"="Hide"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{35286a68-3c57-41a1-bbb1-0eae73d76c95}\PropertyBag]
"ThisPCPolicy"="Hide"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{7d83ee9b-2244-4e70-b1f5-5393042af1e4}\PropertyBag]
"ThisPCPolicy"="Hide"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{a0c69a99-21c8-4671-8703-7934162fcf1d}\PropertyBag]
"ThisPCPolicy"="Hide"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{f42ee2d3-909f-4907-8871-4c22fc0bf756}\PropertyBag]
"ThisPCPolicy"="Hide"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}\PropertyBag]
"ThisPCPolicy"="Hide"
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{0ddd015d-b06c-45d5-8c4c-f59713854639}\PropertyBag]
"ThisPCPolicy"="Hide"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{35286a68-3c57-41a1-bbb1-0eae73d76c95}\PropertyBag]
"ThisPCPolicy"="Hide"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{7d83ee9b-2244-4e70-b1f5-5393042af1e4}\PropertyBag]
"ThisPCPolicy"="Hide"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{a0c69a99-21c8-4671-8703-7934162fcf1d}\PropertyBag]
"ThisPCPolicy"="Hide"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{f42ee2d3-909f-4907-8871-4c22fc0bf756}\PropertyBag]
"ThisPCPolicy"="Hide"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}\PropertyBag]
"ThisPCPolicy"="Hide"
[-HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}]
Thanks in advance.
Hi, during script running, I faced this errors.
C:\Users\vissay\Desktop\Windows-10-Setup-Script-4.0.4\Win10.ps1:1645 знак:31
$apps = Read-Host -Prompt " "
~
Непредвиденная лексема ""
IF ($apps -match "" в выражении или операторе.
C:\Users\vissay\Desktop\Windows-10-Setup-Script-4.0.4\Win10.ps1:1646 знак:25
IF ($apps -match ".exe" -and $apps -match "`"")
~~~~~~~~~~~~~~~~~~~~~
Непредвиденная лексема "" -and $apps -match "" в выражении или операторе.
C:\Users\vissay\Desktop\Windows-10-Setup-Script-4.0.4\Win10.ps1:1646 знак:46
IF ($apps -match ".exe" -and $apps -match "`"")
~~~~
Непредвиденная лексема """) { GpuPreference $apps } elseif ([string]::IsNullOrEmpty($apps)) { break } else { IF ($RU) { Write-Host "
nПути РЅРµ взяты" в выражении или операторе.
C:\Users\vissay\Desktop\Windows-10-Setup-Script-4.0.4\Win10.ps1:1687 знак:2
{
~
Отсутствует закрывающий знак "}" в блоке операторов или определении типа.
C:\Users\vissay\Desktop\Windows-10-Setup-Script-4.0.4\Win10.ps1:1685 знак:1
~
Отсутствует ключевое слово while или until в цикле do.
C:\Users\vissay\Desktop\Windows-10-Setup-Script-4.0.4\Win10.ps1:747 знак:1
~
Непредвиденная лексема ")" в выражении или операторе.
C:\Users\vissay\Desktop\Windows-10-Setup-Script-4.0.4\Win10.ps1:1694 знак:85
~
Непредвиденная лексема ")" в выражении или операторе.
Выданы сообщения не обо всех ошибках синтаксического анализа. Исправьте перечисленные в сообщениях ошибки и повторите попытку.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken
После отключения "CDPSvc"(строка 18) перестает запускаться стандартный ночной режим(night light)
Edition: Windows 10 Pro N
Version: 1903
OS build: 18362.295
Чтобы включить:
Get-Service -Name "CDPSvc" | Set-Service -StartupType Automatic
Get-Service -Name "CDPSvc" | Start-Service
ran this script and for the most part, it got rid of all items as described. But left Msft Edge both in the SystemApps folder and in the Start Menu. Please help! Thanks.
Edit: on the 2004 version.
В связи с тем, что скрипт не подписан сертификатом, он просто не отработает. Более того - из батника пришлось убирать -remotesigned.
Если предполагается отключение политик или выполнять другие действия для работы, то следует написать об этом в Readme.
Latest 2004 version turns taksbar blue in dark mode.
I installed Windows 2004 with german keyboard layout and german language settings.
After running the script with default settings, I had english default keyboard layout in the login screen.
Desktop (please complete the following information):
Currently this project has a very minimalist and unclear README.md overview and furthermore the comments inside the project files are in Russian, could we arrange a better documentation in English @farag2?
Thanks.
when starting the script , Kaspersky sees it as a virus and remove it .
I might have missed some part of code, but, Mail and Calendar apps are crashing within seconds after opening.
Need help to revert this feature or function.
встречается пару раз, выхлоп один ;)
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SubscribedContent-338388Enabled -Value 0 -Force
User entered text often doesn't produce the results stated in the prompt. This is at least as bad with current version as from the version 1 week ago.
At 2 or 3 points during script execution the program just stops progressing and no prompt is given. Hitting the space bar nudges the script to continue.
At several points during script execution the prompt will not accept ENTER key until I enter some other key first. Sometimes hitting ENTER multiple times works, but I fear doing that because I don't know if it buffers up the multiple ENTERs to use the for subsequent prompts.
Sometimes prompts won't take any input at all until I refocus on the window (though I did nothing to take focus away from the script execution window).
Sometimes when I re-run it to see if disabled apps have reverted (which happened many times), if I see all of the apps are removed and nothing to do so just close the app-sel UI, the script freezes and there's nothing I can do but close the script window.
Hello. 😊
Please take a look at this screenshot:
I recommend the user should know the friendly name of these apps.
You can find a script called Inventory AppX Packages.ps1 on my repo. It helps you discover the friendly names.
PowerShell : https://codeload.github.com/farag2/Windows-10-Setup-Script/zip/master
Добрый день!
Я новичок в powershell и пытаюсь использовать ваш скрипт в своих целях. У меня вопрос есть вопрос по одному из действий в скрипте. Несколько раз перед выполнением некоторых операций разделитель массива строки $OFS меняется с пробела на символ "|", а после выполнения операции меняется обратно на пробел. В частности в той части скрипта на удаление UWP-приложений. Подскажите, пожалуйста, с какой целью это делается? Ведь без этой замены UWP-приложения также удаляются.
My default layout is Italian, but the lock screen seems to think otherwhise after running the script. I always need to change it to be able to type the correct password, it's pretty annoying.
Before submitting a bug report:
Steps to reproduce
After i run latest Win.10.2004.4.5.3.zip on my latest windows 10 2004 version. Everytime i watch streaming or gaming online my pc freezes and nothing can be done. Even the keyboard is stuck, the whole system is stuck and the only way is the reset button.
I'm pretty sure it's the script because when i go to previous created restore point,computer smooth like ever before running the script.
Also another important thing: Browsing the pages and overall internet is very slow\sluggish as it's not after restore point is done.
How can i solve without using restore point since i want all the bloatwares and telemetry away?
Thanks in advance
Screenshots
If applicable, add screenshots to help explain your problem.
https://i.imgur.com/bvVGlNa.png
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
Before submitting a bug report:
Download latest from release for 2004 version and execute with admin prev.
Desktop (please complete the following information):
Version 2004 (OS build 19041.329)
Additional context
Add any other context about the problem here.
**Not sure about below changes: **
Before submitting a bug report:
Steps to reproduce
As asked, in below link there are issue and resolution.
Desktop (please complete the following information):
Additional context
problem here.
Similar to existing bug report where can only add one high-perf app, you can only add one Controlled folder access.
The Script is showing an error (Line 3165 Could not find a part of the path 'C:\ProgramData\Event Viewer\Views\ProcessCreation.xml) on Fresh Windows 10 Pro 2004 install i think the script is trying to create a file in a folder which doesn't exist.
Имеет смысл, вдруг что-то пойдёт не так.
After adding the first one and getting back to the script, pressing 'A' again does nothing, it just takes you to the next part of the script.
Hey dude sorry, i can't find where to contact you
I just have a question, should i be updating the script on my PC as you have new releases?
Thanks
Неплохо было бы разделить настройки компьютера и пользователя, чтобы настраивать отдельно.
PS Z:> .\win10.ps1
Z:\win10.ps1:726 знак:2
{
~
Отсутствует закрывающий знак "}" в блоке операторов или определении типа.
Z:\win10.ps1:724 знак:1
~
Непредвиденная лексема ")" в выражении или операторе.
Z:\win10.ps1:733 знак:85
~
Непредвиденная лексема ")" в выражении или операторе.
Z:\win10.ps1:890 знак:2
}
~
Непредвиденная лексема "}" в выражении или операторе.
Z:\win10.ps1:891 знак:1
}
~
Непредвиденная лексема "}" в выражении или операторе.
Z:\win10.ps1:950 знак:1
~~~~~~~~
Непредвиденная лексема "айлы" в выражении или операторе.
Z:\win10.ps1:1816 знак:193
"%1
" /NoRestart & pause" ... ~
Амперсанд (&) не разрешен. Оператор & зарезервирован для будущих версий. Добавьте двойные кавычки до и после амперсанда ("&"), чтобы передать его как строку.
Выданы сообщения не обо всех ошибках синтаксического анализа. Исправьте перечисленные в сообщениях ошибки и повторите попытку.
+ CategoryInfo : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : MissingEndCurlyBrace
День добрый,
После применения скрипта (без ошибок).
При перезагрузке, после ввода пароля , черный экран, мин 5-7 (при этом ПК работает и через кон+шифт+еск запускается диспетчер задач и приложения через него).
Потом появляется заставка и меню пуск.
Такая проблема на всех ПК, где применялся скрипт шт 5.
10 -1903.
Sorry for posting this. This is a request for help. I did run the Win.10.2004.4.5.6 script following the Youtube video from Chris Titus. Unlike in the video I chose to create a restore point at the start of the script.
After the script was done. I can't find my Ubuntu 18.04 distro anymore. I recovered to the restore point, but wsl still says there are no distros installed. Unfortunately, I created a pretty big repository that I didn't push to Github. (I know this was stupid! I don't know why I don't created this project.) Do you know if I can undo the distro deletion?
Desktop (please complete the following information):
Here is screenshots with several errors, maybe some of them are OK (especially warning about network connection - virtual machine does not have it, I just installed Windows 10 Pro 1909).
And what i should choose at screenshot №4?
Windows 10.zip
Feature request - make changing Desktop, Documents and other userfolders optional and skippable - I usually doint it by myself, and solution in script not understandable for me at all - Why script moving them to root of harddrive (not folder choosed by user), why user should move his files by own, what happens with current files - I don't see Users folder in C Drive?
I ran the test version of of this tool (20H2). It worked great except for one thing. SnippingTool has now taken control of the PrintScreen key. I have used this key with Greenshot. I selected SnippingTool and note tools (not OneNote) to be uninstalled.
I ran the script again. But I still got the same apps for uninstallation. Second time I selected all users. Din't help.
I have tried to disable SnippingTool with both reg. entry and policy entry. It still captures the Print Screen key.
Any suggestions?
Keep up the good work! 👍🏻
Добрый день! Не могли бы вы оформить перенос библиотек в качестве функции? Просто я заметил, что там код однотипный и функция там так и просится. Плюс ко всему и код станет универсальнее и чище (IMHO). К примеру для себя я переделал так:
Function KnownFolderPath {
Param ( [Parameter(Mandatory = $true)]
[ValidateSet("Desktop", "Documents", "Downloads", "Music", "Pictures", "Videos")]
[string]$KnownFolder,
[Parameter(Mandatory = $true)]
[string]$Path )
$KnownFolders = @{"Desktop" = @("B4BFCC3A-DB2C-424C-B029-7FE99A87C641")
"Documents" = @("FDD39AD0-238F-46AF-ADB4-6C85480369C7", "f42ee2d3-909f-4907-8871-4c22fc0bf756")
"Downloads" = @("374DE290-123F-4565-9164-39C4925E467B", "7d83ee9b-2244-4e70-b1f5-5393042af1e4")
"Music" = @("4BD8D571-6D19-48D3-BE97-422220080E43", "a0c69a99-21c8-4671-8703-7934162fcf1d")
"Pictures" = @("33E28130-4E1E-4676-835A-98395C3BC3BB", "0ddd015d-b06c-45d5-8c4c-f59713854639")
"Videos" = @("18989B1D-99B5-455B-841C-AB7C74E4DDFC", "35286a68-3c57-41a1-bbb1-0eae73d76c95")}
$Signature = @{Namespace = "WinAPI"
Name = "KnownFolders"
Language = "CSharp"
MemberDefinition = @"
[DllImport("shell32.dll")]
public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, IntPtr token, [MarshalAs(UnmanagedType.LPWStr)] string path);
"@}
if (-not ("WinAPI.KnownFolders" -as [type])) {Add-Type @Signature}
$KnownFolders[$KnownFolder] | %{[WinAPI.KnownFolders]::SHSetKnownFolderPath([ref]$_, 0, 0, $Path)}
(Get-Item -Path $Path -Force ).Attributes = "ReadOnly"
}
function Set-UserLibrary {
param (
[Parameter(Mandatory = $true)]
[string]$Path,
[Parameter(Mandatory = $true)]
[string]$LibraryName
)
$LibraryFolder = "$($Path -Replace('/+', '\') -Replace('\\\\+', '\') -Replace('\\*$', ''))\$LibraryName"
if ($Script:Drives.Contains($LibraryFolder.Substring(0,3).ToUpper())) {
$Reg = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name $LibraryINI.$LibraryName[0][0]
if ($Reg -ne $LibraryFolder) {
if (-not (Test-Path -Path $LibraryFolder)) {New-Item -Path $LibraryFolder -ItemType Directory -Force}
KnownFolderPath -KnownFolder $LibraryName -Path $LibraryFolder
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name $LibraryINI.$LibraryName[0][1] -PropertyType ExpandString -Value $LibraryFolder -Force
Set-Content -Path "$LibraryFolder\desktop.ini" -Value $LibraryINI.$LibraryName[1] -Encoding Unicode -Force
(Get-Item -Path "$LibraryFolder\desktop.ini" -Force).Attributes = "Hidden", "System", "Archive"
(Get-Item -Path "$LibraryFolder\desktop.ini" -Force).Refresh()
}
}
}
[hashtable] $LibraryINI = @{
"Desktop" = @("Desktop", "{754AC886-DF64-4CBA-86B5-F7FBF4FBCEF5}"),
@("", "[.ShellClassInfo]", "LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21769",
"IconResource=%SystemRoot%\system32\imageres.dll,-183")
"Documents" = @("Personal", "{F42EE2D3-909F-4907-8871-4C22FC0BF756}"),
@("", "[.ShellClassInfo]", "LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21770",
"IconResource=%SystemRoot%\system32\imageres.dll,-112",
"IconFile=%SystemRoot%\system32\shell32.dll", "IconIndex=-235")
"Downloads" = @("{374DE290-123F-4565-9164-39C4925E467B}", "{7D83EE9B-2244-4E70-B1F5-5393042AF1E4}"),
@("", "[.ShellClassInfo]","LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21798",
"IconResource=%SystemRoot%\system32\imageres.dll,-184")
"Music" = @("My Music", "{A0C69A99-21C8-4671-8703-7934162FCF1D}"),
@("", "[.ShellClassInfo]","LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21790",
"InfoTip=@%SystemRoot%\system32\shell32.dll,-12689",
"IconResource=%SystemRoot%\system32\imageres.dll,-108",
"IconFile=%SystemRoot%\system32\shell32.dll", "IconIndex=-237")
"Pictures" = @("My Pictures", "{0DDD015D-B06C-45D5-8C4C-F59713854639}"),
@("", "[.ShellClassInfo]", "LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21779",
"InfoTip=@%SystemRoot%\system32\shell32.dll,-12688",
"IconResource=%SystemRoot%\system32\imageres.dll,-113",
"IconFile=%SystemRoot%\system32\shell32.dll", "IconIndex=-236")
"Videos" = @("My Video", "{35286A68-3C57-41A1-BBB1-0EAE73D76C95}"),
@("", "[.ShellClassInfo]", "LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21791",
"InfoTip=@%SystemRoot%\system32\shell32.dll,-12690",
"IconResource=%SystemRoot%\system32\imageres.dll,-189",
"IconFile=%SystemRoot%\system32\shell32.dll", "IconIndex=-238")
}
$Drives = (Get-Disk | Where-Object -FilterScript {$_.BusType -ne "USB"} | Get-Partition | Get-Volume).DriveLetter | Sort-Object -Unique | ?{$_.Length -gt 0 } | %{"$($_):\"}
Write-Host "Ваши диски: " -NoNewline
Write-Host "$($Drives -join ', ')" -ForegroundColor Yellow
Write-Host "`nВведите путь, по которому будут перенесены такие библиотеки пользователя, как:" -NoNewline
Write-Host "`n`"Рабочий стол`", `"Документы`", `"Загрузки`", `"Музыка`", `"Изображения`", `"Видео`"." -ForegroundColor Yellow
Write-Host "`nЧтобы пропустить, нажмите Enter."
$LibraryPath = Read-Host -Prompt "Введите путь"
if ($LibraryPath) {
$LibraryINI.Keys | %{Set-UserLibrary -Path $LibraryPath -LibraryName $_}
$edge = (Get-AppxPackage "Microsoft.MicrosoftEdge").PackageFamilyName
New-ItemProperty -Path "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\$edge\MicrosoftEdge\Main" -Name "Default Download Directory" -PropertyType String -Value "$LibraryPath\Downloads" -Force
}
I did run this script three times, fails with such errors.
Errors
Line Error
1607 Cannot find path 'C:\WINDOWS\Temp' because it does not exist.
1603 Cannot find path 'C:\Users\Username\AppData\Local\Temp' because it does not exist.
1600 Cannot find path 'C:\PerfLogs' because it does not exist.
1062 No MSFT_Printer objects found with property 'Name' equal to 'Microsoft Print to PDF'. Verify the value of the
property and retry.
1062 No MSFT_Printer objects found with property 'Name' equal to 'Microsoft XPS Document Writer'. Verify the value of
the property and retry.
1062 No MSFT_Printer objects found with property 'Name' equal to 'Fax'. Verify the value of the property and retry.
1036 Cannot find path 'D:\Desktop\Microsoft Edge.lnk' because it does not exist.
990 Property NullFile does not exist at path HKEY_CLASSES_ROOT.bmp\ShellNew.
989 Property ItemName does not exist at path HKEY_CLASSES_ROOT.bmp\ShellNew.
986 Property ItemName does not exist at path HKEY_CLASSES_ROOT.rtf\ShellNew.
985 Property Data does not exist at path HKEY_CLASSES_ROOT.rtf\ShellNew.
982 Cannot find path 'HKEY_CLASSES_ROOT.zip\CompressedFolder\ShellNew' because it does not exist.
913 Property Extended does not exist at path HKEY_CLASSES_ROOT\exefile\shell\runasuser.
890 Cannot bind parameter 'Name'. Cannot convert value to type System.String.
799 Cannot find path 'J:\Программы\Прочее' because it does not exist.
799 Cannot find path 'D:\Программы\Прочее' because it does not exist.
594 Cannot find path 'C:\Users\Serik\OneDrive' because it does not exist.
593 Property OneDrive does not exist at path HKEY_CURRENT_USER\Environment.
581 Cannot find a process with the name "OneDrive". Verify the process name and call the cmdlet again.
After running the script, WSL2 running Ubuntu 20.04, doesn't seem to be connected to the internet.
Steps to reproduce:
$ sudo apt-get update
$ sudo apt-get install build-essential checkinstall
(Issue starting here)
$ sudo apt-get update
$ sudo apt-get install build-essential checkinstall
(Figure 1: Running $ sudo apt-get update
)
(Figure 2: VScode complaining about the same, bottom right corner )
(Figure 3: Running $ sudo apt-get install build-essential checkinstall
)
Hello. 😊
This script currently packs 150+ functions; anyone willing to apply only a subset of them needs to open the script and comment out the relevant section. The problem is, this person must know enough PowerShell to be able to distinguish sections in the first place. If they miss commenting out the closing }
, the result could be quite unexpected.
One of the principles of writing good code is: Use functions to avoid code repetition.
Currently, there are a lot of sections in the script that look like this:
if (-not (Test-Path $SomeRegistryPath))
{
New-Item -Path $SomeRegistryPath -Force
}
New-ItemProperty -Path $Path -Name $Name -PropertyType DWord -Value $Value -Force
...or simply, this:
New-ItemProperty -Path $Path -Name $Name -PropertyType DWord -Value $Value -Force
It can be encapsulated into a function, like this:
function Set-RegistryDword {
[CmdletBinding()]
param (
[String]$Path,
[string]$Name,
[Int64]$Value
)
if (-not (Test-Path $Path))
{
New-Item -Path $Path -Force
}
New-ItemProperty -Path $Path -Name $Name -PropertyType DWord -Value $Value -Force
}
You can use this function to encapsulate the data and logic separately. Here is how lines 343 through 395 would look like:
function Set-RegistryDword {
[CmdletBinding()]
param (
[String]$Path,
[string]$Name,
[Int64]$Value
)
if (-not (Test-Path $Path))
{
New-Item -Path $Path -Force
}
New-ItemProperty -Path $Path -Name $Name -PropertyType DWord -Value $Value -Force
}
$SettingsToSet = @(
# Do not suggest ways I can finish setting up my device to get the most out of Windows
# Не предлагать способы завершения настройки устройства для максимально эффективного использования Windows
('HKCU:\Software\Microsoft\Windows\CurrentVersion\UserProfileEngagement','ScoobeSystemSettingEnabled',0),
# Do not offer tailored experiences based on the diagnostic data setting
# Не предлагать персонализированные возможности, основанные на выбранном параметре диагностических данных
('HKCU:\Software\Microsoft\Windows\CurrentVersion\Privacy','TailoredExperiencesWithDiagnosticDataEnabled',0),
# Show "This PC" on Desktop
# Отобразить "Этот компьютер" на рабочем столе
('HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel','"{20D04FE0-3AEA-1069-A2D8-08002B30309D}"',0),
# Do not use check boxes to select items
# Не использовать флажки для выбора элементов
('HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced','AutoCheckSelect',0),
# Show hidden files, folders, and drives
# Показывать скрытые файлы, папки и диски
('HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced','Hidden',1),
# Show file name extensions
# Показывать расширения для зарегистрированных типов файлов
('HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced','HideFileExt',0),
# Do not hide folder merge conflicts
# Не скрывать конфликт слияния папок
('HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced','HideMergeConflicts',0),
# Open File Explorer to: "This PC"
# Открывать проводник для: "Этот компьютер"
('HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced','LaunchTo',1),
# Do not show all folders in the navigation pane
# Не отображать все папки в области навигации
('HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced','NavPaneShowAllFolders',0),
# Do not show Cortana button on taskbar
# Не показывать кнопку Кортаны на панели задач
('HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced','ShowCortanaButton',0),
# Do not show sync provider notification within File Explorer
# Не показывать уведомления поставщика синхронизации в проводнике
('HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced','ShowSyncProviderNotifications',0),
# Do not show Task View button on taskbar
# Не показывать кнопку Просмотра задач
('HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced','ShowTaskViewButton',0)
)
if ($SettingsToSet.Count -ne 0) {
foreach ($item in $SettingsToSet) {
Set-RegistryDword -Path $item[0] -Name $item[1] -Value $item[2]
}
}
Two things have happened:
New-ItemProperty
part.There caveats though:
dism
or taskman
. Here's when Technique 2 helps.It possible to break this script into two files: Win 10 2004 Main.ps1
and Win 10 2004 Logic.psm1
.
Win 10 2004 Logic.psd1
would look like this:
# Set the minimal operating system diagnostic data level
# Установить минимальный уровень отправляемых диагностических сведений
function Set-OsDiagLevelFarag {
if ((Get-WindowsEdition -Online).Edition -eq "Enterprise" -or (Get-WindowsEdition -Online).Edition -eq "Education")
{
# "Security"
# "Безопасность"
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection -Name AllowTelemetry -PropertyType DWord -Value 0 -Force
}
else
{
# "Basic"
# "Базовый"
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection -Name AllowTelemetry -PropertyType DWord -Value 1 -Force
}
}
# Turn off Windows Error Reporting
# Отключить отчеты об ошибках Windows
function Disable-WindowsErrorReportingFarag {
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Windows Error Reporting" -Name Disabled -PropertyType DWord -Value 1 -Force
}
#
# ...
# ...
# ...
#
As you can see, this sample code is just the lines 219 through 236 of the script. The only change here is the addition of function {}
definition.
Now, the Win 10 2004 Main.ps1
could look like this:
Import-Module `Win 10 2004 Logic.psm1` -Scope Local # Maybe "Local" isn't appropriate. Let's check PowerShell help later.
Set-OsDiagLevelFarag
Disable-WindowsErrorReportingFarag
#
# ...
# ...
# ...
#
This script just calls functions inside Win 10 2004 Logic.psm1
. Disabling the functions that the user doesn't need is a matter of commenting only one line.
But there is something even better: People can import Win 10 2004 Logic.psm1
and just run one or two of its functions.
Both. Technique 1 is useful for Win 10 2004 Logic.psm1
.
However, both techniques need refining. I bet that if I familiarize myself with the script, I can make better suggestions. I haven't studied the script thoroughly, since I was introduced to it. I have a life of my own, too, you know.
If we could have an options menu similar to the uninstall list, we could customize the UI changes easier.
Related #28
I ran into this issue first when I used the debloater for 1909, but I didn't create a restore point.
Reïnstalling ps4 remote play also didn't work, I couldn't even reïnstall it at first because I had to re-enable media pack features and install and setup windows media player. But after doing that and reïnstalling ps4 remote play I get the error "cannot connect to server".
I updated to windows 2004 and It started working again. Ran the debloater and made sure media pack wasn't disabled and made a restore point. After the debloater ran the same problem occurs "can't connect to server".
So I decided to return to the restore point so I could pin down what service or process was the problem, but I still get the error after restoring.
Right now I can't get the ps4 remote play programm to open. It gets stuck on the error.
My antivirus software (Bitdefender Total Security) gives me a false positive during execution of the Powershell script:
"The file C:\Windows\System32\Tasks\Setup Script\Windows Cleanup is infected with Heur.BZC.WBO.Boxter.501.4B1E4D92. The threat was successfully blocked, your device is safe."
After the Windows task has been aborted, the file "C:\Windows\System32\Tasks\Setup Script\Windows Cleanup" is no longer present (not even quarantined).
Is it possible to save the generated task file otherwise, so that I can request a whitelisting by Bitdefender Support?
Option to exclude some part of changes does not exists.
For example, right now i am trying to get back new WIn10 Start menu view and Miscrosoft solarite game (don't ask me why :) on several wrokstations in a corporate domain.
Powershell folder in documents - okey let's skip
it's only a few minutes after the reboot, so there could be more. 🙉
Hello, I need help. My virtual printer is gone. Can you tell me which key I modified that caused this consequence? Is there a way to revert?
I use the foxitreader's virtual printer and it's gone. I tried to reinstall and the option to install a virtual printer does not appear.
I used the version published shortly after 7/15/2020
http://cdn01.foxitsoftware.com/pub/foxit/manual/reader/en_us/FoxitReader9.3_Manual.pdf
Follow print and the link to the foxitreader manual and the print of my installation attempt.
I am a common user and I found your work the best of all that I have seen in this context. I encourage you to continue this work for as long as you can, it really is an excellent job!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.