Skip to content
KBHost
Menu
216.73.216.170
KBHost
FileHost
Home
/
Knowledgebase
/
PowerShell & cmd
/
Snippets
/
Windows
/
Add network share to trusted locations
Add network share to trusted locations
2
0
# Add the network location to Trusted Sites $networkLocation = "file://san001" # Retrieve the current Trusted Sites list $trustedSites = Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges" -ErrorAction SilentlyContinue # Check if the network location is already in the Trusted Sites list $exists = $false foreach ($key in $trustedSites.PSObject.Properties) { if ($key.Value -match $networkLocation) { $exists = $true break } } # If the network location is not in the Trusted Sites list, add it if (-not $exists) { New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range1" -Force New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range1" -Name "http" -Value "$networkLocation" -PropertyType String New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range1" -Name "https" -Value "$networkLocation" -PropertyType String New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range1" -Name "file" -Value "$networkLocation" -PropertyType String New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range1" -Name "ProxyBypass" -Value 0 -PropertyType DWord New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range1" -Name "IntranetName" -Value 1 -PropertyType DWord New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range1" -Name "UNCAsIntranet" -Value 1 -PropertyType DWord } # Modify registry settings to disable the warning $registryPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments" Set-ItemProperty -Path $registryPath -Name "SaveZoneInformation" -Value 1 # You may need to restart the Explorer process for changes to take effect Stop-Process -Name explorer -Force Start-Process explorer
No sleep -
00:00
Password Generator
Most viewed
Connect to Office 365 with PowerShell
Silent update Microsoft Remote Desktop
Add Microsoft Photos app to Server 2019
Enable NFS client in Windows 10
Clear Outlook filter for all folders
Asus ZenWiFi LED color status
Ventoy Windows 11 To Go
Find and delete all snapshots
Most recent
Install or Update reMarkable
TrueNAS Clear failed jobs history
TrueNAS SSH Hetzner Storage Box Rsync
Print Screen from PowerShell
Create local user during Windows Setup
Force Microsoft 365 installation
Enable MailTips in Microsoft 365
Get Home Assistant Logs
We use cookies to ensure the best experience on our website. If you continue to use this site, we assume that you are happy with this.
Ok