Cristian Muscalu
Cristian Muscalu

Reputation: 9925

Add trusted site to IE local intranet

I'm trying to make a VBScript that will add exceptions to IE local intranet settings like in the picture. I'm assuming this is possible from what I've read.

enter image description here

I tried several solutions including the following one, and it feels I'm going nowhere! The script will be running on Windows 7 Pro machines, if that is of any help.

AddTrustedSite "//192.168.0.10"

Function AddTrustedSite(strDomainName)
    Set WshShell = Wscript.CreateObject("Wscript.Shell")
    strRegKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\"
    WshShell.RegWrite strRegKey & strDomainName & "\", "", "REG_SZ"
    WshShell.RegWrite strRegKey & strDomainName & "\*", "2", "REG_DWORD"
End Function

Upvotes: 0

Views: 2082

Answers (1)

Cristian Muscalu
Cristian Muscalu

Reputation: 9925

This works for a regular network.
But when using it on a PC under domain, it says wrong username or password. I will post the extra details for domain when i find it.

 AddTrustedSite "Range1"

Function AddTrustedSite(strDomainName)
    Set WshShell = Wscript.CreateObject("Wscript.Shell")
    strRegKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\"
    WshShell.RegWrite strRegKey & strDomainName & "\", "", "REG_SZ"
    WshShell.RegWrite strRegKey & strDomainName & "\:Range", "192.168.0.10", "REG_SZ"
    WshShell.RegWrite strRegKey & strDomainName & "\file", "1", "REG_DWORD"
End Function

Upvotes: 1

Related Questions