Created
December 27, 2023 04:45
-
-
Save whonion/9143f51859c0a9e4b829ce4fd8fd1966 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$hostsFilePath = "%systemroot%\System32\drivers\etc\hosts" | |
$linesToAdd = @( | |
"127.0.0.1 activate.adobe.com", | |
"127.0.0.1 practivate.adobe.com", | |
"127.0.0.1 lmlicenses.wip4.adobe.com", | |
"127.0.0.1 lm.licenses.adobe.com", | |
"127.0.0.1 na1r.services.adobe.com", | |
"127.0.0.1 hlrcv.stage.adobe.com", | |
"127.0.0.1 genuine.adobe.com", | |
"127.0.0.1 prod.adobegenuine.com" | |
) | |
# Check if the file exists | |
if (Test-Path $hostsFilePath) { | |
# Read the existing content | |
$existingContent = Get-Content $hostsFilePath -Raw | |
# Check if the lines already exist in the file | |
$linesToAdd | ForEach-Object { | |
if ($existingContent -notcontains $_) { | |
# Append the line to the file | |
Add-Content -Path $hostsFilePath -Value $_ | |
Write-Host "Line added to hosts file: $_" | |
} else { | |
Write-Host "Line already exists in hosts file: $_" | |
} | |
} | |
} else { | |
Write-Host "Error: Hosts file not found at $hostsFilePath" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment