Created
February 11, 2020 16:39
-
-
Save mwallner/0dd17eb915c1f392ea3d572dc3bc10ac to your computer and use it in GitHub Desktop.
when using a offline VisualStudio layout, you need to ensure the host you're downloading from is "trusted"
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
function Add-TrustedHostDownloadSite { | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory = $true)] | |
[string]$ServerName, | |
[Parameter(Mandatory = $false)] | |
[string]$Domain = "myorg.somedomain" | |
) | |
Push-Location | |
try { | |
$zoneMapDomainsRegKeyPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains" | |
Set-Location $zoneMapDomainsRegKeyPath | |
New-Item $ServerName -ErrorAction SilentlyContinue | |
Set-Location $ServerName | |
New-ItemProperty . -Name file -Value 1 -Type DWORD -ErrorAction SilentlyContinue | |
Set-Location $zoneMapDomainsRegKeyPath | |
New-Item $Domain -ErrorAction SilentlyContinue | |
Set-Location $Domain | |
New-Item $ServerName -ErrorAction SilentlyContinue | |
Set-Location $ServerName | |
New-ItemProperty . -Name file -Value 1 -Type DWORD -ErrorAction SilentlyContinue | |
} | |
finally { | |
Pop-Location | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment