I’m trying to correct the gateway settings of PCs in a certain subnet and I’m using…
name of connection whose (status of it = (connection status connected)) of network
…which doesn’t appear to work under Windows 2000. XP is fine. Is “connection of network” not supported under Windows 2000?
-Paul
Sample action:
if {name of operating system = “WinXP”}
DOS netsh int ip set address name="{name of connection whose (status of it = (connection status connected)) of network}" source=static gateway=10.1.1.1 gwmetric=0
else
DOS netsh int ip set address name=“Local Area Connection” source=static gateway=10.1.1.1 gwmetric=1
Looks like the inspector documentation needs to be fixed. It’s labeled Win5.0.
I’m not crazy for how I’m doing it now. In the relevance, I’m checking the active IP using the following. (Assume I’m looking at the 10.1.2.0 subnet and the desired gateway is 10.1.2.3)
address of ip interface whose (loopback of it = false) of network as string starts with “10.1.2.” AND gateway of adapter of network != “10.1.2.3”
Then in the action, I need the connection name. I didn’t see any way to tie the active IP to it’s connection. So I blindly assumed the active connection must be the same IP.
Maybe u could use the following relevance script to get connection name in win2k
q:value “name” of key “connection” of keys (name of adapters whose (address of it as string starts with “192.168.1.” AND gateway of it != “192.168.1.1”) of network) of key “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network{4D36E972-E325-11CE-BFC1-08002BE10318}” of registry
Maybe this will help. You can tie the GUID of the adapter to the name of the connection:
q: (names of item 1 of it) of(adapters of network, connections of network) whose (name of item 0 of it = guid of item 1 of it AND status of item 1 of it = (connection status connected)) of network
A: Wireless Network Connection
Not sure if it solves your problems but maybe it can help.
Also note that you can use:
subnet address of ip interfaces of network = “10.1.2.0”
instead of:
address of ip interface whose (loopback of it = false) of network as string starts with “10.1.2.”
Another note is that you will have a problem if there are multiple connections or ip addresses.
Quick comment on the inspector docs. The “Win5.0” refers to the fact that the inspector first became available in the Windows 5.0 client, and does not refer to Windows 2000. Sorry for the confusion.