Racer Dude said:
So your telling me that there is no work around....
Is there a way to apply a different gp upon logoff? Or have some script
run that would modify a setting?
You can write a script that registers for the event that triggers when a
network connection goes live (ie. Is plugged into the network).
If they don't plug into the network the settings won't apply.
'This is where you specifiy the subnets that the PC must be a member of
before the script is triggered. If they obtain a different address the
script won't do anything.
aSubnetList = Array("10.1.4.0/255.255.255.0", "10.1.4.0/255.255.252.0")
bAllMatches = True
Set Events = GetObject("winmgmts:\\.\root\cimv2").ExecNotificationQuery
("SELECT TargetInstance.Name FROM __InstanceOperationEvent WITHIN 4 WHERE
TargetInstance ISA 'Win32_NetworkAdapterConfiguration'")
Do
Set ConnectEvent = Events.nextevent
If VarType(ConnectEvent.TargetInstance.Ipaddress(0)) = 8 Then
bFoundMatch = SubnetMatch(aSubnetList,
ConnectEvent.TargetInstance.Ipaddress(0), bAllMatches, aListofMatches)
End If
If bFoundMatch Then
'This is where you put the code you want to run when a network
connection is made
'In this example I am mapping a network drive but it could just
run regedit to apply the changes you want set.
Set oShell = Createobject("wscript.shell")
Set oNet = CreateObject("Wscript.Network")
On Error Resume Next
oNet.RemoveNetworkDrive "z:", True, True
oNet.MapNetworkDrive "z:", "\\myserver\myshare"
Err.clear
oNet.RemoveNetworkDrive "z:", True, True
Err.clear
On Error GoTo 0
bFoundMatch = False
End If
Loop
Private Function SubnetMatch(aSubnetsToMatch, IPAddress, bAllMatches,
aMatchList)
For each subnetpair in aSubnetsToMatch
pair = split(subnetpair, "/", 2)
subnetoctets = split(pair(1), ".", 4)
ipaddroctets = split(IPAddress, ".", 4)
If pair(0) = join(Array(ipaddroctets(0) and subnetoctets(0),
ipaddroctets(1) and subnetoctets(1), _
ipaddroctets(2) and subnetoctets(2), ipaddroctets(3) and
subnetoctets(3)),".") Then
SubnetMatch = True
If MatchList = "" Then
MatchList = MatchList & subnetpair
Else
MatchList = MatchList & ", " & subnetpair
End If
If not bAllMatches Then
aMatchList = Array(subnetpair)
Exit For
End If
End If
Next
If SubnetMatch Then
aMatchList = split(matchlist, ",")
End If
End Function