mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-17 02:10:36 -06:00
Remove All Trailing Whitespace Characters in '.json' Files
This commit is contained in:
parent
c8a448d465
commit
6dc2bf9cb9
@ -134,7 +134,7 @@
|
|||||||
"description": "Azure Data Studio is a data management tool that enables you to work with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux.",
|
"description": "Azure Data Studio is a data management tool that enables you to work with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux.",
|
||||||
"link": "https://docs.microsoft.com/sql/azure-data-studio/what-is-azure-data-studio",
|
"link": "https://docs.microsoft.com/sql/azure-data-studio/what-is-azure-data-studio",
|
||||||
"winget": "Microsoft.AzureDataStudio"
|
"winget": "Microsoft.AzureDataStudio"
|
||||||
},
|
},
|
||||||
"WPFInstallbarrier": {
|
"WPFInstallbarrier": {
|
||||||
"category": "Utilities",
|
"category": "Utilities",
|
||||||
"choco": "barrier",
|
"choco": "barrier",
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"MainBackgroundColor": "#FFFFFF",
|
"MainBackgroundColor": "#FFFFFF",
|
||||||
"LabelBackgroundColor": "#FAFAFA",
|
"LabelBackgroundColor": "#FAFAFA",
|
||||||
"LinkForegroundColor": "#000000",
|
"LinkForegroundColor": "#000000",
|
||||||
"LinkHoverForegroundColor": "#000000",
|
"LinkHoverForegroundColor": "#000000",
|
||||||
"GroupBorderBackgroundColor": "#000000",
|
"GroupBorderBackgroundColor": "#000000",
|
||||||
"ComboBoxForegroundColor": "#000000",
|
"ComboBoxForegroundColor": "#000000",
|
||||||
"ButtonInstallBackgroundColor": "#FFFFFF",
|
"ButtonInstallBackgroundColor": "#FFFFFF",
|
||||||
@ -31,7 +31,7 @@
|
|||||||
"BorderColor": "#000000",
|
"BorderColor": "#000000",
|
||||||
"BorderOpacity": "0.2",
|
"BorderOpacity": "0.2",
|
||||||
"ShadowPulse": "Forever"
|
"ShadowPulse": "Forever"
|
||||||
},
|
},
|
||||||
"Matrix": {
|
"Matrix": {
|
||||||
"ComboBoxBackgroundColor": "#000000",
|
"ComboBoxBackgroundColor": "#000000",
|
||||||
"LabelboxForegroundColor": "#FFEE58",
|
"LabelboxForegroundColor": "#FFEE58",
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
"
|
"
|
||||||
Write-Host \"Turn on Hibernation\"
|
Write-Host \"Turn on Hibernation\"
|
||||||
Start-Process -FilePath powercfg -ArgumentList \"/hibernate on\" -NoNewWindow -Wait
|
Start-Process -FilePath powercfg -ArgumentList \"/hibernate on\" -NoNewWindow -Wait
|
||||||
|
|
||||||
# Set hibernation as the default action
|
# Set hibernation as the default action
|
||||||
Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-ac 60\" -NoNewWindow -Wait
|
Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-ac 60\" -NoNewWindow -Wait
|
||||||
Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-dc 60\" -NoNewWindow -Wait
|
Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-dc 60\" -NoNewWindow -Wait
|
||||||
@ -96,14 +96,14 @@
|
|||||||
"
|
"
|
||||||
Write-Host \"Turn off Hibernation\"
|
Write-Host \"Turn off Hibernation\"
|
||||||
Start-Process -FilePath powercfg -ArgumentList \"/hibernate off\" -NoNewWindow -Wait
|
Start-Process -FilePath powercfg -ArgumentList \"/hibernate off\" -NoNewWindow -Wait
|
||||||
|
|
||||||
# Set standby to detault values
|
# Set standby to detault values
|
||||||
Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-ac 15\" -NoNewWindow -Wait
|
Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-ac 15\" -NoNewWindow -Wait
|
||||||
Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-dc 15\" -NoNewWindow -Wait
|
Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-dc 15\" -NoNewWindow -Wait
|
||||||
Start-Process -FilePath powercfg -ArgumentList \"/change monitor-timeout-ac 15\" -NoNewWindow -Wait
|
Start-Process -FilePath powercfg -ArgumentList \"/change monitor-timeout-ac 15\" -NoNewWindow -Wait
|
||||||
Start-Process -FilePath powercfg -ArgumentList \"/change monitor-timeout-dc 15\" -NoNewWindow -Wait
|
Start-Process -FilePath powercfg -ArgumentList \"/change monitor-timeout-dc 15\" -NoNewWindow -Wait
|
||||||
"
|
"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"WPFTweaksHome": {
|
"WPFTweaksHome": {
|
||||||
"Content": "Disable Homegroup",
|
"Content": "Disable Homegroup",
|
||||||
@ -2241,7 +2241,7 @@
|
|||||||
Write-Host \"Please run this script as an administrator.\"
|
Write-Host \"Please run this script as an administrator.\"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if System Restore is enabled for the main drive
|
# Check if System Restore is enabled for the main drive
|
||||||
try {
|
try {
|
||||||
# Try getting restore points to check if System Restore is enabled
|
# Try getting restore points to check if System Restore is enabled
|
||||||
@ -2249,14 +2249,14 @@
|
|||||||
} catch {
|
} catch {
|
||||||
Write-Host \"An error occurred while enabling System Restore: $_\"
|
Write-Host \"An error occurred while enabling System Restore: $_\"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if the SystemRestorePointCreationFrequency value exists
|
# Check if the SystemRestorePointCreationFrequency value exists
|
||||||
$exists = Get-ItemProperty -path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore\" -Name \"SystemRestorePointCreationFrequency\" -ErrorAction SilentlyContinue
|
$exists = Get-ItemProperty -path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore\" -Name \"SystemRestorePointCreationFrequency\" -ErrorAction SilentlyContinue
|
||||||
if($null -eq $exists){
|
if($null -eq $exists){
|
||||||
write-host 'Changing system to allow multiple restore points per day'
|
write-host 'Changing system to allow multiple restore points per day'
|
||||||
Set-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore\" -Name \"SystemRestorePointCreationFrequency\" -Value \"0\" -Type DWord -Force -ErrorAction Stop | Out-Null
|
Set-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore\" -Name \"SystemRestorePointCreationFrequency\" -Value \"0\" -Type DWord -Force -ErrorAction Stop | Out-Null
|
||||||
}
|
}
|
||||||
|
|
||||||
# Attempt to load the required module for Get-ComputerRestorePoint
|
# Attempt to load the required module for Get-ComputerRestorePoint
|
||||||
try {
|
try {
|
||||||
Import-Module Microsoft.PowerShell.Management -ErrorAction Stop
|
Import-Module Microsoft.PowerShell.Management -ErrorAction Stop
|
||||||
@ -2264,7 +2264,7 @@
|
|||||||
Write-Host \"Failed to load the Microsoft.PowerShell.Management module: $_\"
|
Write-Host \"Failed to load the Microsoft.PowerShell.Management module: $_\"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get all the restore points for the current day
|
# Get all the restore points for the current day
|
||||||
try {
|
try {
|
||||||
$existingRestorePoints = Get-ComputerRestorePoint | Where-Object { $_.CreationTime.Date -eq (Get-Date).Date }
|
$existingRestorePoints = Get-ComputerRestorePoint | Where-Object { $_.CreationTime.Date -eq (Get-Date).Date }
|
||||||
@ -2272,11 +2272,11 @@
|
|||||||
Write-Host \"Failed to retrieve restore points: $_\"
|
Write-Host \"Failed to retrieve restore points: $_\"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if there is already a restore point created today
|
# Check if there is already a restore point created today
|
||||||
if ($existingRestorePoints.Count -eq 0) {
|
if ($existingRestorePoints.Count -eq 0) {
|
||||||
$description = \"System Restore Point created by WinUtil\"
|
$description = \"System Restore Point created by WinUtil\"
|
||||||
|
|
||||||
Checkpoint-Computer -Description $description -RestorePointType \"MODIFY_SETTINGS\"
|
Checkpoint-Computer -Description $description -RestorePointType \"MODIFY_SETTINGS\"
|
||||||
Write-Host -ForegroundColor Green \"System Restore Point Created Successfully\"
|
Write-Host -ForegroundColor Green \"System Restore Point Created Successfully\"
|
||||||
}
|
}
|
||||||
@ -2370,7 +2370,7 @@
|
|||||||
"Order": "a025_",
|
"Order": "a025_",
|
||||||
"registry": [
|
"registry": [
|
||||||
{
|
{
|
||||||
|
|
||||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsCopilot",
|
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsCopilot",
|
||||||
"Name": "TurnOffWindowsCopilot",
|
"Name": "TurnOffWindowsCopilot",
|
||||||
"Type": "DWord",
|
"Type": "DWord",
|
||||||
@ -2395,7 +2395,7 @@
|
|||||||
"InvokeScript": [
|
"InvokeScript": [
|
||||||
"
|
"
|
||||||
Write-Host \"Remove Copilot\"
|
Write-Host \"Remove Copilot\"
|
||||||
dism /online /remove-package /package-name:Microsoft.Windows.Copilot
|
dism /online /remove-package /package-name:Microsoft.Windows.Copilot
|
||||||
"
|
"
|
||||||
],
|
],
|
||||||
"UndoScript": [
|
"UndoScript": [
|
||||||
@ -2414,11 +2414,11 @@
|
|||||||
"InvokeScript": [
|
"InvokeScript": [
|
||||||
"
|
"
|
||||||
Write-Host \"Kill OneDrive process\"
|
Write-Host \"Kill OneDrive process\"
|
||||||
$serviceName = \"LMS\"
|
$serviceName = \"LMS\"
|
||||||
Write-Host \"Stopping and disabling service: $serviceName\"
|
Write-Host \"Stopping and disabling service: $serviceName\"
|
||||||
Stop-Service -Name $serviceName -Force -ErrorAction SilentlyContinue;
|
Stop-Service -Name $serviceName -Force -ErrorAction SilentlyContinue;
|
||||||
Set-Service -Name $serviceName -StartupType Disabled -ErrorAction SilentlyContinue;
|
Set-Service -Name $serviceName -StartupType Disabled -ErrorAction SilentlyContinue;
|
||||||
|
|
||||||
Write-Host \"Removing service: $serviceName\";
|
Write-Host \"Removing service: $serviceName\";
|
||||||
sc.exe delete $serviceName;
|
sc.exe delete $serviceName;
|
||||||
|
|
||||||
@ -2433,7 +2433,7 @@
|
|||||||
} else {
|
} else {
|
||||||
Write-Host \"All found LMS driver packages have been removed.\";
|
Write-Host \"All found LMS driver packages have been removed.\";
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host \"Searching and deleting LMS executable files\";
|
Write-Host \"Searching and deleting LMS executable files\";
|
||||||
$programFilesDirs = @(\"C:\\Program Files\", \"C:\\Program Files (x86)\");
|
$programFilesDirs = @(\"C:\\Program Files\", \"C:\\Program Files (x86)\");
|
||||||
$lmsFiles = @();
|
$lmsFiles = @();
|
||||||
@ -2451,7 +2451,7 @@
|
|||||||
Write-Host \"No LMS.exe files found in Program Files directories.\";
|
Write-Host \"No LMS.exe files found in Program Files directories.\";
|
||||||
} else {
|
} else {
|
||||||
Write-Host \"All found LMS.exe files have been deleted.\";
|
Write-Host \"All found LMS.exe files have been deleted.\";
|
||||||
}
|
}
|
||||||
Write-Host 'Intel LMS vPro service has been disabled, removed, and blocked.';
|
Write-Host 'Intel LMS vPro service has been disabled, removed, and blocked.';
|
||||||
"
|
"
|
||||||
],
|
],
|
||||||
@ -2462,7 +2462,7 @@
|
|||||||
|
|
||||||
"
|
"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"WPFTweaksRemoveOnedrive": {
|
"WPFTweaksRemoveOnedrive": {
|
||||||
"Content": "Remove OneDrive",
|
"Content": "Remove OneDrive",
|
||||||
"Description": "Copies OneDrive files to Default Home Folders and Uninstalls it.",
|
"Description": "Copies OneDrive files to Default Home Folders and Uninstalls it.",
|
||||||
@ -2574,25 +2574,25 @@
|
|||||||
"Description": "Manages Adobe Services, Adobe Desktop Service, and Acrobat Updates",
|
"Description": "Manages Adobe Services, Adobe Desktop Service, and Acrobat Updates",
|
||||||
"category": "z__Advanced Tweaks - CAUTION",
|
"category": "z__Advanced Tweaks - CAUTION",
|
||||||
"panel": "1",
|
"panel": "1",
|
||||||
"Order": "a021_",
|
"Order": "a021_",
|
||||||
"InvokeScript": [
|
"InvokeScript": [
|
||||||
"
|
"
|
||||||
function CCStopper {
|
function CCStopper {
|
||||||
$path = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe\"
|
$path = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe\"
|
||||||
|
|
||||||
# Test if the path exists before proceeding
|
# Test if the path exists before proceeding
|
||||||
if (Test-Path $path) {
|
if (Test-Path $path) {
|
||||||
Takeown /f $path
|
Takeown /f $path
|
||||||
$acl = Get-Acl $path
|
$acl = Get-Acl $path
|
||||||
$acl.SetOwner([System.Security.Principal.NTAccount]\"Administrators\")
|
$acl.SetOwner([System.Security.Principal.NTAccount]\"Administrators\")
|
||||||
$acl | Set-Acl $path
|
$acl | Set-Acl $path
|
||||||
|
|
||||||
Rename-Item -Path $path -NewName \"Adobe Desktop Service.exe.old\" -Force
|
Rename-Item -Path $path -NewName \"Adobe Desktop Service.exe.old\" -Force
|
||||||
} else {
|
} else {
|
||||||
Write-Host \"Adobe Desktop Service is not in the default location.\"
|
Write-Host \"Adobe Desktop Service is not in the default location.\"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function AcrobatUpdates {
|
function AcrobatUpdates {
|
||||||
# Editing Acrobat Updates. The last folder before the key is dynamic, therefore using a script.
|
# Editing Acrobat Updates. The last folder before the key is dynamic, therefore using a script.
|
||||||
@ -2602,12 +2602,12 @@
|
|||||||
# 3 = Automatically download and install updates (default value)
|
# 3 = Automatically download and install updates (default value)
|
||||||
# 4 = Notify the user when an update is available but don't download or install it automatically
|
# 4 = Notify the user when an update is available but don't download or install it automatically
|
||||||
# = It notifies the user using Windows Notifications. It runs on startup without having to have a Service/Acrobat/Reader running, therefore 0 is the next best thing.
|
# = It notifies the user using Windows Notifications. It runs on startup without having to have a Service/Acrobat/Reader running, therefore 0 is the next best thing.
|
||||||
|
|
||||||
$rootPath = \"HKLM:\\SOFTWARE\\WOW6432Node\\Adobe\\Adobe ARM\\Legacy\\Acrobat\"
|
$rootPath = \"HKLM:\\SOFTWARE\\WOW6432Node\\Adobe\\Adobe ARM\\Legacy\\Acrobat\"
|
||||||
|
|
||||||
# Get all subkeys under the specified root path
|
# Get all subkeys under the specified root path
|
||||||
$subKeys = Get-ChildItem -Path $rootPath | Where-Object { $_.PSChildName -like \"{*}\" }
|
$subKeys = Get-ChildItem -Path $rootPath | Where-Object { $_.PSChildName -like \"{*}\" }
|
||||||
|
|
||||||
# Loop through each subkey
|
# Loop through each subkey
|
||||||
foreach ($subKey in $subKeys) {
|
foreach ($subKey in $subKeys) {
|
||||||
# Get the full registry path
|
# Get the full registry path
|
||||||
@ -2630,7 +2630,7 @@
|
|||||||
function RestoreCCService {
|
function RestoreCCService {
|
||||||
$originalPath = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe.old\"
|
$originalPath = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe.old\"
|
||||||
$newPath = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe\"
|
$newPath = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe\"
|
||||||
|
|
||||||
if (Test-Path -Path $originalPath) {
|
if (Test-Path -Path $originalPath) {
|
||||||
Rename-Item -Path $originalPath -NewName \"Adobe Desktop Service.exe\" -Force
|
Rename-Item -Path $originalPath -NewName \"Adobe Desktop Service.exe\" -Force
|
||||||
Write-Host \"Adobe Desktop Service has been restored.\"
|
Write-Host \"Adobe Desktop Service has been restored.\"
|
||||||
@ -2642,12 +2642,12 @@
|
|||||||
function AcrobatUpdates {
|
function AcrobatUpdates {
|
||||||
# Default Value:
|
# Default Value:
|
||||||
# 3 = Automatically download and install updates
|
# 3 = Automatically download and install updates
|
||||||
|
|
||||||
$rootPath = \"HKLM:\\SOFTWARE\\WOW6432Node\\Adobe\\Adobe ARM\\Legacy\\Acrobat\"
|
$rootPath = \"HKLM:\\SOFTWARE\\WOW6432Node\\Adobe\\Adobe ARM\\Legacy\\Acrobat\"
|
||||||
|
|
||||||
# Get all subkeys under the specified root path
|
# Get all subkeys under the specified root path
|
||||||
$subKeys = Get-ChildItem -Path $rootPath | Where-Object { $_.PSChildName -like \"{*}\" }
|
$subKeys = Get-ChildItem -Path $rootPath | Where-Object { $_.PSChildName -like \"{*}\" }
|
||||||
|
|
||||||
# Loop through each subkey
|
# Loop through each subkey
|
||||||
foreach ($subKey in $subKeys) {
|
foreach ($subKey in $subKeys) {
|
||||||
# Get the full registry path
|
# Get the full registry path
|
||||||
@ -2722,14 +2722,14 @@
|
|||||||
"Description": "Reduce user interruptions by selectively blocking connections to Adobe's activation and telemetry servers. ",
|
"Description": "Reduce user interruptions by selectively blocking connections to Adobe's activation and telemetry servers. ",
|
||||||
"category": "z__Advanced Tweaks - CAUTION",
|
"category": "z__Advanced Tweaks - CAUTION",
|
||||||
"panel": "1",
|
"panel": "1",
|
||||||
"Order": "a021_",
|
"Order": "a021_",
|
||||||
"InvokeScript": [
|
"InvokeScript": [
|
||||||
"
|
"
|
||||||
# Define the URL of the remote HOSTS file and the local paths
|
# Define the URL of the remote HOSTS file and the local paths
|
||||||
$remoteHostsUrl = \"https://raw.githubusercontent.com/Ruddernation-Designs/Adobe-URL-Block-List/master/hosts\"
|
$remoteHostsUrl = \"https://raw.githubusercontent.com/Ruddernation-Designs/Adobe-URL-Block-List/master/hosts\"
|
||||||
$localHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\hosts\"
|
$localHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\hosts\"
|
||||||
$tempHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\temp_hosts\"
|
$tempHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\temp_hosts\"
|
||||||
|
|
||||||
# Download the remote HOSTS file to a temporary location
|
# Download the remote HOSTS file to a temporary location
|
||||||
try {
|
try {
|
||||||
Invoke-WebRequest -Uri $remoteHostsUrl -OutFile $tempHostsPath
|
Invoke-WebRequest -Uri $remoteHostsUrl -OutFile $tempHostsPath
|
||||||
@ -2738,11 +2738,11 @@
|
|||||||
catch {
|
catch {
|
||||||
Write-Error \"Failed to download the HOSTS file. Error: $_\"
|
Write-Error \"Failed to download the HOSTS file. Error: $_\"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if the AdobeNetBlock has already been started
|
# Check if the AdobeNetBlock has already been started
|
||||||
try {
|
try {
|
||||||
$localHostsContent = Get-Content $localHostsPath -ErrorAction Stop
|
$localHostsContent = Get-Content $localHostsPath -ErrorAction Stop
|
||||||
|
|
||||||
# Check if AdobeNetBlock markers exist
|
# Check if AdobeNetBlock markers exist
|
||||||
$blockStartExists = $localHostsContent -like \"*#AdobeNetBlock-start*\"
|
$blockStartExists = $localHostsContent -like \"*#AdobeNetBlock-start*\"
|
||||||
if ($blockStartExists) {
|
if ($blockStartExists) {
|
||||||
@ -2753,10 +2753,10 @@
|
|||||||
$newBlockContent = $newBlockContent | Where-Object { $_ -notmatch \"^\\s*#\" -and $_ -ne \"\" } # Exclude empty lines and comments
|
$newBlockContent = $newBlockContent | Where-Object { $_ -notmatch \"^\\s*#\" -and $_ -ne \"\" } # Exclude empty lines and comments
|
||||||
$newBlockHeader = \"#AdobeNetBlock-start\"
|
$newBlockHeader = \"#AdobeNetBlock-start\"
|
||||||
$newBlockFooter = \"#AdobeNetBlock-end\"
|
$newBlockFooter = \"#AdobeNetBlock-end\"
|
||||||
|
|
||||||
# Combine the contents, ensuring new block is properly formatted
|
# Combine the contents, ensuring new block is properly formatted
|
||||||
$combinedContent = $localHostsContent + $newBlockHeader, $newBlockContent, $newBlockFooter | Out-String
|
$combinedContent = $localHostsContent + $newBlockHeader, $newBlockContent, $newBlockFooter | Out-String
|
||||||
|
|
||||||
# Write the combined content back to the original HOSTS file
|
# Write the combined content back to the original HOSTS file
|
||||||
$combinedContent | Set-Content $localHostsPath -Encoding ASCII
|
$combinedContent | Set-Content $localHostsPath -Encoding ASCII
|
||||||
Write-Output \"Successfully added the AdobeNetBlock.\"
|
Write-Output \"Successfully added the AdobeNetBlock.\"
|
||||||
@ -2765,10 +2765,10 @@
|
|||||||
catch {
|
catch {
|
||||||
Write-Error \"Error during processing: $_\"
|
Write-Error \"Error during processing: $_\"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Clean up temporary file
|
# Clean up temporary file
|
||||||
Remove-Item $tempHostsPath -ErrorAction Ignore
|
Remove-Item $tempHostsPath -ErrorAction Ignore
|
||||||
|
|
||||||
# Flush the DNS resolver cache
|
# Flush the DNS resolver cache
|
||||||
try {
|
try {
|
||||||
Invoke-Expression \"ipconfig /flushdns\"
|
Invoke-Expression \"ipconfig /flushdns\"
|
||||||
@ -2783,7 +2783,7 @@
|
|||||||
"
|
"
|
||||||
# Define the local path of the HOSTS file
|
# Define the local path of the HOSTS file
|
||||||
$localHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\hosts\"
|
$localHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\hosts\"
|
||||||
|
|
||||||
# Load the content of the HOSTS file
|
# Load the content of the HOSTS file
|
||||||
try {
|
try {
|
||||||
$hostsContent = Get-Content $localHostsPath -ErrorAction Stop
|
$hostsContent = Get-Content $localHostsPath -ErrorAction Stop
|
||||||
@ -2792,11 +2792,11 @@
|
|||||||
Write-Error \"Failed to load the HOSTS file. Error: $_\"
|
Write-Error \"Failed to load the HOSTS file. Error: $_\"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialize flags and buffer for new content
|
# Initialize flags and buffer for new content
|
||||||
$recording = $true
|
$recording = $true
|
||||||
$newContent = @()
|
$newContent = @()
|
||||||
|
|
||||||
# Iterate over each line of the HOSTS file
|
# Iterate over each line of the HOSTS file
|
||||||
foreach ($line in $hostsContent) {
|
foreach ($line in $hostsContent) {
|
||||||
if ($line -match \"#AdobeNetBlock-start\") {
|
if ($line -match \"#AdobeNetBlock-start\") {
|
||||||
@ -2809,7 +2809,7 @@
|
|||||||
$recording = $true
|
$recording = $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Write the filtered content back to the HOSTS file
|
# Write the filtered content back to the HOSTS file
|
||||||
try {
|
try {
|
||||||
$newContent | Set-Content $localHostsPath -Encoding ASCII
|
$newContent | Set-Content $localHostsPath -Encoding ASCII
|
||||||
@ -2818,7 +2818,7 @@
|
|||||||
catch {
|
catch {
|
||||||
Write-Error \"Failed to write back to the HOSTS file. Error: $_\"
|
Write-Error \"Failed to write back to the HOSTS file. Error: $_\"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Flush the DNS resolver cache
|
# Flush the DNS resolver cache
|
||||||
try {
|
try {
|
||||||
Invoke-Expression \"ipconfig /flushdns\"
|
Invoke-Expression \"ipconfig /flushdns\"
|
||||||
|
Loading…
Reference in New Issue
Block a user