Browse Source

Update Win 10.ps1

pull/3/head
farag2 6 years ago
committed by GitHub
parent
commit
1c22e50d08
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      Win 10.ps1

26
Win 10.ps1

@ -334,7 +334,7 @@ Set-NetFirewallProfile -Enabled False -ErrorAction SilentlyContinue
Get-Service -Name DoSvc | Stop-Service -ErrorAction SilentlyContinue Get-Service -Name DoSvc | Stop-Service -ErrorAction SilentlyContinue
IF (!(Test-Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization)) IF (!(Test-Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization))
{ {
New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization -Force New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization -Force
} }
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization -Name DODownloadMode -Value 0 -Force New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization -Name DODownloadMode -Value 0 -Force
# Включить в Планировщике задач запуска очистки обновлений Windows # Включить в Планировщике задач запуска очистки обновлений Windows
@ -402,7 +402,7 @@ $params = @{
Register-ScheduledTask @Params -Force Register-ScheduledTask @Params -Force
# Включить в Планировщике задач очистки папки %TEMP% # Включить в Планировщике задач очистки папки %TEMP%
$action = New-ScheduledTaskAction -Execute "Powershell.exe" -Argument 'Get-ChildItem -Path "$env:TEMP" -Force -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue' $action = New-ScheduledTaskAction -Execute "Powershell.exe" -Argument 'Get-ChildItem -Path "$env:TEMP" -Force -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
$trigger = New-ScheduledTaskTrigger -Daily -DaysInterval 62 -At 9am $trigger = New-ScheduledTaskTrigger -Daily -DaysInterval 62 -At 9am
$settings = New-ScheduledTaskSettingsSet -Compatibility Win8 -StartWhenAvailable $settings = New-ScheduledTaskSettingsSet -Compatibility Win8 -StartWhenAvailable
$principal = New-ScheduledTaskPrincipal -UserID System -RunLevel Highest $principal = New-ScheduledTaskPrincipal -UserID System -RunLevel Highest
$params = @{ $params = @{
@ -681,7 +681,7 @@ $apps = @(
"OpenSSH.Client*") "OpenSSH.Client*")
Foreach ($app in $apps) Foreach ($app in $apps)
{ {
Get-WindowsCapability -Online | Where-Object name -Like $app | Remove-WindowsCapability -Online Get-WindowsCapability -Online | Where-Object name -Like $app | Remove-WindowsCapability -Online
} }
# Создать ярлык для "Устройства и принтеры" # Создать ярлык для "Устройства и принтеры"
$target = "control" $target = "control"
@ -766,9 +766,9 @@ Else
} }
function KnownFolderPath function KnownFolderPath
{ {
Param ( Param (
[Parameter(Mandatory = $true)] [Parameter(Mandatory = $true)]
[ValidateSet('Documents', 'Downloads')] [ValidateSet('Documents', 'Downloads')]
[string]$KnownFolder, [string]$KnownFolder,
[Parameter(Mandatory = $true)] [Parameter(Mandatory = $true)]
@ -784,7 +784,7 @@ function KnownFolderPath
public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, IntPtr token, [MarshalAs(UnmanagedType.LPWStr)] string path); public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, IntPtr token, [MarshalAs(UnmanagedType.LPWStr)] string path);
'@ '@
$Type = Add-Type -MemberDefinition $Signature -Name 'KnownFolders' -Namespace 'SHSetKnownFolderPath' -PassThru $Type = Add-Type -MemberDefinition $Signature -Name 'KnownFolders' -Namespace 'SHSetKnownFolderPath' -PassThru
# return $Type::SHSetKnownFolderPath([ref]$KnownFolders[$KnownFolder], 0, 0, $Path) # return $Type::SHSetKnownFolderPath([ref]$KnownFolders[$KnownFolder], 0, 0, $Path)
ForEach ($guid in $KnownFolders[$KnownFolder]) ForEach ($guid in $KnownFolders[$KnownFolder])
{ {
$Type::SHSetKnownFolderPath([ref]$guid, 0, 0, $Path) $Type::SHSetKnownFolderPath([ref]$guid, 0, 0, $Path)
@ -794,12 +794,12 @@ function KnownFolderPath
$Downloads = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" $Downloads = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
IF ($Downloads -ne "$drive\Загрузки") IF ($Downloads -ne "$drive\Загрузки")
{ {
IF (!(Test-Path $drive\Загрузки)) IF (!(Test-Path $drive\Загрузки))
{ {
New-Item -Path $drive\Загрузки -Type Directory -Force New-Item -Path $drive\Загрузки -Type Directory -Force
} }
KnownFolderPath -KnownFolder Downloads -Path "$drive\Загрузки" KnownFolderPath -KnownFolder Downloads -Path "$drive\Загрузки"
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{7D83EE9B-2244-4E70-B1F5-5393042AF1E4}" -Type ExpandString -Value "$drive\Загрузки" -Force New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{7D83EE9B-2244-4E70-B1F5-5393042AF1E4}" -Type ExpandString -Value "$drive\Загрузки" -Force
} }
$Documents = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal $Documents = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal
IF ($Documents -ne "$drive\Документы") IF ($Documents -ne "$drive\Документы")

Loading…
Cancel
Save