Skip to content

Instantly share code, notes, and snippets.

@mwallner
Created February 11, 2020 16:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mwallner/0dd17eb915c1f392ea3d572dc3bc10ac to your computer and use it in GitHub Desktop.
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"
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