Question Locked

Different group policy for laptops when connected to AD domain

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi I am looking for a way for a laptop to determine whether or not the AD is availble, and apply its policy accordingly - specific example is having proxy settings and disabled windows firewall when on the domain, but no proxy and active firewall when not.

Thanks

4 replies

by wizard-09

Create a domain GPO for what you need, then create a local GPO on the laptop for what you need when the user is not on the domain.

Keep us informed as to your progress if you require further assistance.

If you think that any of the posts that have been made by all TR Members, have solved or contributed to solving the problem, please Mark them as Helpful so that others may benefit from the outcome.

by larryd4

We have laptops that operate on the Domain and VPN in, via a home connection or WiFi on the road. The proxy and firewall always got in the way. So I wrote two scripts a proxy off and a proxy on. You can wrap these in to a script that asks the user how they are connected when they log in or you can create seperate files(proxyon.vbs and proxyoff.vbs) and leave them on the desktop for the user to run as needed.. The code to turn firewall on and off is very similar, but I don't have the code for it readily available.

Proxy on
---------------------------
Const HKEY_CURRENT_USER = &H80000001
strComputer = "."

'This script enables the proxy settings for the currently logged in user.
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings"
strEntryName = "ProxyEnable"
dwValue = 1

objReg.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strEntryName, dwValue

wscript.echo "Proxy now on!"

Proxy off
----------------------------------------
Const HKEY_CURRENT_USER = &H80000001
strComputer = "."

'This script disables the proxy settings for the Currently logged in user.

Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings"
strEntryName = "ProxyEnable"
dwValue = 0

objReg.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strEntryName, dwValue

wscript.echo "Proxy now off!"

by larryd4

Set objFirewall = CreateObject("HNetCfg.FwMgr")
Set objPolicy = objFirewall.LocalPolicy.CurrentProfile

objPolicy.FirewallEnabled = FALSE

So that would go in to the proxy off file so when they turn off the proxy it turns off the firewall.

And then same code but change =False to =True, to be added to the proxy on file.

This discussion is closed to new replies.