Skip to content

Commit 70a70a1

Browse files
authored
4.0.23/06.03.2020
## Updated - Comments; - Written "Pin to Start the shortcuts" section; - Now using [syspin.exe](http://www.technosys.net/products/utils/pintotaskbar) to pin shortcuts - Hash (SHA256): 6967E7A3C2251812DD6B3FA0265FB7B61AADC568F562A98C50C345908C6E827 - Shorcuts pinned by default: - Control Panel; - Devices and Printers; - Command Prompt. - Minor changes. ## Обновлено - Комментарии; - Переписан раздел "Закрепить на начальном экране ярлыки"; - Теперь для закрепления ярлыков используется [syspin.exe](http://www.technosys.net/products/utils/pintotaskbar) - Хэш (SHA256): 6967E7A3C2251812DD6B3FA0265FB7B61AADC568F562A98C50C345908C6E827 - По умолчанию закрепляются ярылки: - Панель управления; - Устройства и принтеры; - Командная строка. - Незначительные изменения.
1 parent 44c2c54 commit 70a70a1

File tree

1 file changed

+145
-91
lines changed

1 file changed

+145
-91
lines changed

Win 10.ps1

Lines changed: 145 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,6 @@ New-ItemProperty -Path "HKCU:\Control Panel\International\User Profile" -Name Ht
235235
# Turn on tip, trick, and suggestions as you use Windows
236236
# Показывать советы, подсказки и рекомендации при использованию Windows
237237
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SubscribedContent-338389Enabled -PropertyType DWord -Value 1 -Force
238-
# Do not show app suggestions on Start menu
239-
# Не показывать рекомендации в меню "Пуск"
240-
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SubscribedContent-338388Enabled -PropertyType DWord -Value 0 -Force
241238
# Do not show suggested content in the Settings
242239
# Не показывать рекомендуемое содержание в "Параметрах"
243240
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SubscribedContent-338393Enabled -PropertyType DWord -Value 0 -Force
@@ -302,8 +299,8 @@ if (-not (Test-Path -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explor
302299
New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager -Force
303300
}
304301
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager -Name EnthusiastMode -PropertyType DWord -Value 1 -Force
305-
# Turn on ribbon in File Explorer
306-
# Включить отображение ленты проводника в развернутом виде
302+
# Show the Ribbon expanded in File Explorer
303+
# Отображать ленту проводника в развернутом виде
307304
if (-not (Test-Path -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Ribbon))
308305
{
309306
New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Ribbon -Force
@@ -1380,6 +1377,13 @@ New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\
13801377
# Отключить удаление кэша миниатюр
13811378
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Thumbnail Cache" -Name Autorun -PropertyType DWord -Value 0 -Force
13821379
New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Thumbnail Cache" -Name Autorun -PropertyType DWord -Value 0 -Force
1380+
# Turn on network discovery and file and printers sharing
1381+
# Включить сетевое обнаружение и общий доступ к файлам и принтерам
1382+
if ((Get-NetConnectionProfile).NetworkCategory -ne "DomainAuthenticated")
1383+
{
1384+
Get-NetFirewallRule -Group "@FirewallAPI.dll,-32752", "@FirewallAPI.dll,-28502" | Set-NetFirewallRule -Profile Private -Enabled True
1385+
Set-NetConnectionProfile -NetworkCategory Private
1386+
}
13831387
#endregion System
13841388

13851389
#region Start menu
@@ -1395,19 +1399,88 @@ New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name
13951399
[byte[]]$bytes = Get-Content -Path "$env:APPDATA\Microsoft\Windows\Start menu\Programs\System Tools\Command Prompt.lnk" -Encoding Byte -Raw
13961400
$bytes[0x15] = $bytes[0x15] -bor 0x20
13971401
Set-Content -Path "$env:APPDATA\Microsoft\Windows\Start menu\Programs\System Tools\Command Prompt.lnk" -Value $bytes -Encoding Byte -Force
1398-
# Add old style shortcut for "Devices and Printers" to the Start menu
1399-
# Добавить ярлык старого формата для "Устройства и принтеры" в меню Пуск
1400-
$target = "control"
1401-
$linkname = (Get-ControlPanelItem | Where-Object -FilterScript {$_.CanonicalName -eq "Microsoft.DevicesAndPrinters"}).Name
1402-
$link = "$env:APPDATA\Microsoft\Windows\Start menu\Programs\System Tools\$linkname.lnk"
1403-
$shell = New-Object -ComObject Wscript.Shell
1404-
$shortcut = $shell.CreateShortcut($link)
1405-
$shortcut.TargetPath = $target
1406-
$shortcut.Arguments = "printers"
1407-
$shortCut.IconLocation = "$env:SystemRoot\system32\DeviceCenter.dll"
1408-
$shortcut.Save()
1409-
# Import Start menu layout from pre-saved .reg file
1410-
# Импорт настроенного макета меню "Пуск" из предварительно сохраненного .reg-файла
1402+
# Show "Explorer" and "Settings" folders on Start menu
1403+
# Отобразить папки "Проводник" и "Параметры" в меню "Пуск"
1404+
$items = @("File Explorer", "Settings")
1405+
$startmenu = Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount\*windows.data.unifiedtile.startglobalproperties\Current"
1406+
$data = $startmenu.Data[0..19] -join ","
1407+
$data += ",203,50,10,$($items.Length)"
1408+
# Explorer
1409+
# Проводник
1410+
$data += ",5,188,201,168,164,1,36,140,172,3,68,137,133,1,102,160,129,186,203,189,215,168,164,130,1,0"
1411+
# Settings
1412+
# Параметры
1413+
$data += ",5,134,145,204,147,5,36,170,163,1,68,195,132,1,102,159,247,157,177,135,203,209,172,212,1,0"
1414+
$data += ",194,60,1,194,70,1,197,90,1,0"
1415+
New-ItemProperty -Path $startmenu.PSPath -Name Data -PropertyType Binary -Value $data.Split(",") -Force
1416+
# Unpin all Start menu tiles
1417+
# Открепить все ярлыки от начального экрана
1418+
if ($RU)
1419+
{
1420+
Write-Host "`nЧтобы открепить все ярлыки от начального экрана, введите букву: " -NoNewline
1421+
Write-Host "[Y]es" -ForegroundColor Yellow -NoNewline
1422+
Write-Host "`nЧтобы пропустить, нажмите Enter" -NoNewline
1423+
}
1424+
else
1425+
{
1426+
Write-Host "`nTo unpin all Start menu tiles type: " -NoNewline
1427+
Write-Host "[Y]es" -ForegroundColor Yellow -NoNewline
1428+
Write-Host "`nPress Enter to skip" -NoNewline
1429+
}
1430+
do
1431+
{
1432+
$Unpin = Read-Host -Prompt " "
1433+
if ([string]::IsNullOrEmpty($Unpin))
1434+
{
1435+
break
1436+
}
1437+
else
1438+
{
1439+
switch ($Unpin)
1440+
{
1441+
"Y"
1442+
{
1443+
$TileCollection = Get-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount\*start.tilegrid`$windows.data.curatedtilecollection.tilecollection\Current
1444+
$Value = $TileCollection.Data[0..25] + ([byte[]](202,50,0,226,44,1,1,0,0))
1445+
New-ItemProperty -Path $TileCollection.PSPath -Name Data -PropertyType Binary -Value $Value -Force
1446+
}
1447+
Default
1448+
{
1449+
if ($RU)
1450+
{
1451+
Write-Host "`nНеправильная буква." -ForegroundColor Yellow
1452+
Write-Host "Введите правильную букву: " -NoNewline
1453+
Write-Host "[Y]es" -ForegroundColor Yellow -NoNewline
1454+
Write-Host ", чтобы открепить все ярлыки от начального экрана" -NoNewline
1455+
Write-Host "`nЧтобы пропустить, нажмите Enter" -NoNewline
1456+
}
1457+
else
1458+
{
1459+
Write-Host "`nInvalid letter." -ForegroundColor Yellow
1460+
Write-Host "Type the correct letter: " -NoNewline
1461+
Write-Host "[Y]es" -ForegroundColor Yellow -NoNewline
1462+
Write-Host " to unpin all Start menu tiles" -NoNewline
1463+
Write-Host "`nPress Enter to skip" -NoNewline
1464+
}
1465+
}
1466+
}
1467+
}
1468+
}
1469+
until ($Unpin -eq "Y")
1470+
# Download syspin.exe to the "Downloads" folder
1471+
# Скачать syspin.exe в папку "Загрузки"
1472+
# http://www.technosys.net/products/utils/pintotaskbar
1473+
# Hash (SHA256): 6967E7A3C2251812DD6B3FA0265FB7B61AADC568F562A98C50C345908C6E827
1474+
$OutFile = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
1475+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
1476+
$HT = @{
1477+
Uri = "https://github.com/farag2/Windows-10-Setup-Script/raw/master/Start%20menu%20layout/syspin.exe"
1478+
OutFile = "$OutFile\syspin.exe"
1479+
Verbose = [switch]::Present
1480+
}
1481+
Invoke-WebRequest @HT
1482+
# Закрепить на начальном экране ярлыки
1483+
# Pin to Start the shortcuts
14111484
Add-Type -AssemblyName System.Windows.Forms
14121485
$OpenFileDialog = New-Object -TypeName System.Windows.Forms.OpenFileDialog
14131486
# Initial directory "Downloads"
@@ -1416,11 +1489,11 @@ $DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows
14161489
$OpenFileDialog.InitialDirectory = $DownloadsFolder
14171490
if ($RU)
14181491
{
1419-
$OpenFileDialog.Filter = "Файлы реестра (*.reg)|*.reg|Все файлы (*.*)|*.*"
1492+
$OpenFileDialog.Filter = "*.exe|*.exe|Все файлы (*.*)|*.*"
14201493
}
14211494
else
14221495
{
1423-
$OpenFileDialog.Filter = "Registration Files (*.reg)|*.reg|All Files (*.*)|*.*"
1496+
$OpenFileDialog.Filter = "*.exe|*.exe|All Files (*.*)|*.*"
14241497
}
14251498
# Focus on open file dialog
14261499
# Перевести фокус на диалог открытия файла
@@ -1436,80 +1509,64 @@ $tmp.add_Shown(
14361509
$tmp.ShowDialog()
14371510
if ($OpenFileDialog.FileName)
14381511
{
1439-
Remove-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount -Recurse -Force
1440-
regedit.exe /s $OpenFileDialog.FileName
1441-
}
1442-
else
1443-
{
1444-
if ($RU)
1512+
# Add old style shortcut for "Devices and Printers" to the Start menu
1513+
# Добавить ярлык старого формата для "Устройства и принтеры" в меню Пуск
1514+
$Items = (New-Object -ComObject Shell.Application).NameSpace("shell:::{4234d49b-0245-4df3-b780-3893943456e1}").Items()
1515+
$ControlPanelLocalizedName = ($Items | Where-Object -FilterScript {$_.Path -eq "Microsoft.Windows.ControlPanel"}).Name
1516+
# If Control Panel shortcut was ever pinned
1517+
# Если ярлык панели управления когда-либо закреплялся
1518+
if (Test-Path -Path "$env:APPDATA\Microsoft\Windows\Start menu\Programs\$ControlPanelLocalizedName.lnk")
14451519
{
1446-
Write-Host "`nЧтобы открепить все ярлыки от начального экрана, введите букву: " -NoNewline
1447-
Write-Host "[Y]es" -ForegroundColor Yellow -NoNewline
1448-
Write-Host "`nЧтобы пропустить, нажмите Enter" -NoNewline
1520+
$Args = @"
1521+
"$env:APPDATA\Microsoft\Windows\Start menu\Programs\$ControlPanelLocalizedName.lnk" "51201"
1522+
"@
1523+
Start-Process -FilePath $OpenFileDialog.FileName -WindowStyle Hidden -ArgumentList $Args -Wait
14491524
}
14501525
else
14511526
{
1452-
Write-Host "`nTo unpin all Start menu tiles type: " -NoNewline
1453-
Write-Host "[Y]es" -ForegroundColor Yellow -NoNewline
1454-
Write-Host "`nPress Enter to skip" -NoNewline
1455-
}
1456-
do
1457-
{
1458-
$Unpin = Read-Host -Prompt " "
1459-
if ([string]::IsNullOrEmpty($Unpin))
1460-
{
1461-
break
1462-
}
1463-
else
1464-
{
1465-
switch ($Unpin)
1466-
{
1467-
"Y"
1468-
{
1469-
# Unpin all Start menu tiles
1470-
# Открепить все ярлыки от начального экрана
1471-
$TileCollection = Get-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount\*start.tilegrid`$windows.data.curatedtilecollection.tilecollection\Current
1472-
$Value = $TileCollection.Data[0..25] + ([byte[]](202,50,0,226,44,1,1,0,0))
1473-
New-ItemProperty -Path $TileCollection.PSPath -Name Data -PropertyType Binary -Value $Value -Force
1474-
# Show "Explorer" and "Settings" folders on Start menu
1475-
# Отобразить папки "Проводник" и "Параметры" в меню "Пуск"
1476-
$items = @("File Explorer", "Settings")
1477-
$startmenu = Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount\*windows.data.unifiedtile.startglobalproperties\Current"
1478-
$data = $startmenu.Data[0..19] -join ","
1479-
$data += ",203,50,10,$($items.Length)"
1480-
# Explorer
1481-
# Проводник
1482-
$data += ",5,188,201,168,164,1,36,140,172,3,68,137,133,1,102,160,129,186,203,189,215,168,164,130,1,0"
1483-
# Settings
1484-
# Параметры
1485-
$data += ",5,134,145,204,147,5,36,170,163,1,68,195,132,1,102,159,247,157,177,135,203,209,172,212,1,0"
1486-
$data += ",194,60,1,194,70,1,197,90,1,0"
1487-
New-ItemProperty -Path $startmenu.PSPath -Name Data -PropertyType Binary -Value $data.Split(",") -Force
1488-
}
1489-
Default
1490-
{
1491-
if ($RU)
1492-
{
1493-
Write-Host "`nНеправильная буква." -ForegroundColor Yellow
1494-
Write-Host "Введите правильную букву: " -NoNewline
1495-
Write-Host "[Y]es" -ForegroundColor Yellow -NoNewline
1496-
Write-Host ", чтобы открепить все ярлыки от начального экрана" -NoNewline
1497-
Write-Host "`nЧтобы пропустить, нажмите Enter" -NoNewline
1498-
}
1499-
else
1500-
{
1501-
Write-Host "`nInvalid letter." -ForegroundColor Yellow
1502-
Write-Host "Type the correct letter: " -NoNewline
1503-
Write-Host "[Y]es" -ForegroundColor Yellow -NoNewline
1504-
Write-Host " to unpin all Start menu tiles" -NoNewline
1505-
Write-Host "`nPress Enter to skip" -NoNewline
1506-
}
1507-
}
1508-
}
1509-
}
1527+
$shell = New-Object -ComObject Wscript.Shell
1528+
# Place the shortcut in "$env:SystemRoot\System32\$linkname.lnk"
1529+
# Разместим ярлык в "$env:SystemRoot\System32\$linkname.lnk"
1530+
$shortcut = $shell.CreateShortcut("$env:SystemRoot\System32\$ControlPanelLocalizedName.lnk")
1531+
$shortcut.TargetPath = "$env:SystemRoot\System32\control.exe"
1532+
$shortcut.Save()
1533+
# Pin to Start Control Panel
1534+
# The "Pin" verb is not available on the control.exe file so the shortcut has to be created
1535+
# Закрепить на начальном "Панель управления"
1536+
# Глагол "Закрепить на начальном экране" недоступен для control.exe, поэтому необходимо создать ярлык
1537+
$Args = @"
1538+
"$env:SystemRoot\System32\$ControlPanelLocalizedName.lnk" "51201"
1539+
"@
1540+
Start-Process -FilePath $OpenFileDialog.FileName -WindowStyle Hidden -ArgumentList $Args -Wait
1541+
Remove-Item -Path "$env:SystemRoot\System32\$ControlPanelLocalizedName.lnk" -Force
15101542
}
1511-
until ($Unpin -eq "Y")
1543+
# Add old style shortcut for "Devices and Printers" to the Start menu
1544+
# Добавить ярлык старого формата для "Устройства и принтеры" в меню Пуск
1545+
$DevicesAndPrintersLocalizedName = (Get-ControlPanelItem | Where-Object -FilterScript {$_.CanonicalName -eq "Microsoft.DevicesAndPrinters"}).Name
1546+
$shell = New-Object -ComObject Wscript.Shell
1547+
$shortcut = $shell.CreateShortcut("$env:APPDATA\Microsoft\Windows\Start menu\Programs\System Tools\$DevicesAndPrintersLocalizedName.lnk")
1548+
$shortcut.TargetPath = "control"
1549+
$shortcut.Arguments = "printers"
1550+
$shortCut.IconLocation = "$env:SystemRoot\system32\DeviceCenter.dll"
1551+
$shortcut.Save()
1552+
# Pin to Start Devices and Printers
1553+
# Закрепить на начальном "Устройства и принтеры"
1554+
$Args = @"
1555+
"$env:APPDATA\Microsoft\Windows\Start menu\Programs\System Tools\$DevicesAndPrintersLocalizedName.lnk" "51201"
1556+
"@
1557+
Start-Process -FilePath $OpenFileDialog.FileName -WindowStyle Hidden -ArgumentList $Args -Wait
1558+
# Pin to Start Command Prompt
1559+
# Закрепить на начальном "Командная строка"
1560+
$Args = @"
1561+
"$env:APPDATA\Microsoft\Windows\Start menu\Programs\System Tools\Command Prompt.lnk" "51201"
1562+
"@
1563+
Start-Process -FilePath $OpenFileDialog.FileName -WindowStyle Hidden -ArgumentList $Args -Wait
15121564
}
1565+
Remove-Item -Path "$OutFile\syspin.exe" -Force -ErrorAction Ignore
1566+
1567+
# Do not show app suggestions on Start menu
1568+
# Не показывать рекомендации в меню "Пуск"
1569+
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SubscribedContent-338388Enabled -PropertyType DWord -Value 0 -Force
15131570
# Restart Start menu
15141571
# Перезапустить меню "Пуск"
15151572
Stop-Process -Name StartMenuExperienceHost -Force
@@ -2039,9 +2096,6 @@ New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name
20392096
#endregion Context menu
20402097

20412098
#region End
2042-
# Restart Start menu
2043-
# Перезапустить меню "Пуск"
2044-
Stop-Process -Name StartMenuExperienceHost -Force
20452099
# Refresh desktop icons, environment variables and taskbar without restarting File Explorer
20462100
# Обновить иконки рабочего стола, переменные среды и панель задач без перезапуска "Проводника"
20472101
$UpdateEnvExplorerAPI = @{

0 commit comments

Comments
 (0)