Reworked modifyShittyRegValue function to create path (and value) than doesn't exist
This commit is contained in:
parent
278232165e
commit
375b1bb501
1 changed files with 15 additions and 10 deletions
25
cleanW10.ps1
25
cleanW10.ps1
|
@ -71,23 +71,28 @@ function remove_shittyTasks () {
|
||||||
# key : key name
|
# key : key name
|
||||||
# value : The value to write
|
# value : The value to write
|
||||||
function modifyShittyRegValue {
|
function modifyShittyRegValue {
|
||||||
param([string]$path, [string]$key, [string]$value)
|
param([string]$path, [string]$key, [string]$value, [string]$type)
|
||||||
Write-Host -ForegroundColor white -NoNewline "Modify $key reg value to $value :"
|
Write-Host -ForegroundColor white -NoNewline "Modify $key reg value to $value :"
|
||||||
try {
|
if (!(Test-Path $path)){
|
||||||
Get-ItemPropertyValue -Path $path -Name $key
|
Write-Host -ForegroundColor Gray -NoNewline " creating path "
|
||||||
}
|
New-Item -Path $path -Force | Out-Null
|
||||||
catch {
|
|
||||||
Write-Host -ForegroundColor Yellow " not Found "
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try { Set-ItemProperty -Path $path -Name $key -Value $value }
|
try {
|
||||||
|
if ($type) {
|
||||||
|
Set-ItemProperty -Path $path -Name $key -Value $value -Type $type -Force
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Set-ItemProperty -Path $path -Name $key -Value $value -Force
|
||||||
|
}
|
||||||
|
}
|
||||||
catch [System.Security.SecurityException]{
|
catch [System.Security.SecurityException]{
|
||||||
Write-Host -ForegroundColor Red "Access denied"
|
Write-Host -ForegroundColor Red "Access denied"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Host -ForegroundColor Red " Error "
|
Write-Host -ForegroundColor Red " Error "
|
||||||
|
Write-Host $Error[0]
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Write-host -ForegroundColor Green " done "
|
Write-host -ForegroundColor Green " done "
|
||||||
|
@ -160,7 +165,7 @@ write-Output ""
|
||||||
#$shittyFeatures | foreach { disableShitty $_ }
|
#$shittyFeatures | foreach { disableShitty $_ }
|
||||||
#$shittyServices | Foreach { disableShittyService $_ }
|
#$shittyServices | Foreach { disableShittyService $_ }
|
||||||
#$shittyModernApp | Foreach { disableModernShitty $_ }
|
#$shittyModernApp | Foreach { disableModernShitty $_ }
|
||||||
$shittyHosts | Foreach { blockShittyHost $HOST_FILE $HOST_IP $_ }
|
$shittyHosts | Foreach { blockShittyHost $HOST_FILE $HOST_IP $_ }
|
||||||
remove_shittyTasks $shittyTasks
|
remove_shittyTasks $shittyTasks
|
||||||
|
|
||||||
$shittyIP | Foreach {
|
$shittyIP | Foreach {
|
||||||
|
@ -187,6 +192,6 @@ modifyShittyRegValue "HKLM:\SOFTWARE\Microsoft\Windows Defender\Spynet" "SpyNetR
|
||||||
# Windows Defender Sample Submission
|
# Windows Defender Sample Submission
|
||||||
modifyShittyRegValue "HKLM:\SOFTWARE\Microsoft\Windows Defender\Spynet" "SubmitSamplesConsent" "0"
|
modifyShittyRegValue "HKLM:\SOFTWARE\Microsoft\Windows Defender\Spynet" "SubmitSamplesConsent" "0"
|
||||||
|
|
||||||
#Désinstallation des applications "métro" inutiles
|
#Désinstallation des applications "métro" inutiles
|
||||||
#Get-AppxPackage -AllUsers | Remove-AppxPackage
|
#Get-AppxPackage -AllUsers | Remove-AppxPackage
|
||||||
#Get-AppXProvisionedPackage -online | remove-appxprovisionedpackage -online
|
#Get-AppXProvisionedPackage -online | remove-appxprovisionedpackage -online
|
||||||
|
|
Reference in a new issue