Skip to content

Instantly share code, notes, and snippets.

View Ayrnio's full-sized avatar

Ayrn Ayrnio

View GitHub Profile
@Ayrnio
Ayrnio / AutoDiscover (Add Entry)
Last active August 1, 2018 05:37
Hosts File/Registry Modification Scripts for AutoDiscover (Add Entry)
#Script to mod local autodiscover lookup in Outlook via https://ayrne.io
# Give local cache and hosts file DNS entries priority
$regPath = "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\ServiceProvider"
New-ItemProperty -Path $regPath -Name HostsPriority -propertyType DWORD -Value 3 -force | Out-Null
New-ItemProperty -Path $regPath -Name LocalPriority -propertyType DWORD -Value 4 -force | Out-Null
New-ItemProperty -Path $regPath -Name DnsPriority -propertyType DWORD -Value 5 -force | Out-Null
New-ItemProperty -Path $regPath -Name NetbtPriority -propertyType DWORD -Value 6 -force | Out-Null
# Set domain name
$domainName = Read-Host -Prompt "Enter The Domain Name"
# Create Hosts file entry