Arshin said:
Hi dear all.
I am looking for a script for enable & disable Network-Card on
local-machine. Anybody can help ?
TNX.
In case you're using a DHCP enabled NIC you could try the method
"ReleaseDHCPLease()" from class Win32_NetworkAdapterConfiguration.
The following WQL selects the appropriate NIC:
select * from Win32_NetworkAdapterConfiguration where IPEnabled = true
and ServiceName <> 'VMnetAdapter'
The corresponding WMI CIM Studio helptext:
"The ReleaseDHCPLease method releases the IP address bound to a specific
DHCP enabled network adapter. WARNING: If DHCP is enabled on this local
computer system, the option disables TCP/IP on this specific network
adapter. Unless you have an alternate path to the target system; that
is, another TCP/IP bound network adapter, all TCP/IP communications will
be lost. The method returns an integer value that can be interpretted as
follows:
0 - Successful completion, no reboot required
1 - Successful completion, reboot required
64 - Method not supported on this platform
.....
....
...
"
Regards Richard