Using Powershell toolkit to add website to trusted sites

I’m looking to add a website to the trusted sites via the powershell toolkit. I did find the URL Batch powershell script that has some parameters. If I wanted to call on the script to run would I start with Start-Process or go Exectue-Process? I currently tried this setup and it fails

Execute-Process -Path “$dirFiles\AddingTrustedSites.ps1” -Parameters “-TrustedSites website.com -HTTPS”

Honestly the best way to do this is going to be to copy-paste the source script (or dot source it) as a function and call it directly.

Make sure you credit the source at the top of your script when/if you go this route.

Why not use the Invoke-HKCURegistrySettingsForAllUsers? That way you can set it for all existing user and the Default User so that new users will also get it added?

[scriptblock]$HKCURegistrySettings = {
Set-RegistryKey -Key ‘HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\website.com*’ -Name ‘https’ -Value 2 -Type DWord -SID $UserProfile.SID
}

Invoke-HKCURegistrySettingsForAllUsers -RegistrySettings $HKCURegistrySettings

2 Likes