keyongtech


  keyongtech > windows.* > windows.powershell > 03/2009

 #1  
03-20-09, 09:59 AM
Jens
Hi,

I do have a problem with en- and disabeling of nics on Windows Server 2008
64bit. PowerSHell V2 CTP is installed.

The nic is a Broadcom NetXtreme GBit and it can be found on the server under
DeviceID 6:

-----------------------------------------------------------------------------------------------------------------------------------------------

PS I:\> get-wmiobject -class "Win32_NetworkAdapter" | Where-Object
-FilterScript {$_.DeviceID -eq 6}

ServiceName : b57nd60a
MACAddress : 00:21:5A:EB:0B:D0
AdapterType : Ethernet 802.3
DeviceID : 6
Name : Broadcom NetXtreme Gigabit Ethernet
NetworkAddresses :
Speed : 9223372036854775807

-------------------------------------------------------------------------------------------------------------------------------------------

With the command

(get-wmiobject -class "Win32_NetworkAdapter" | Where-Object -FilterScript
{$_.DeviceID -eq 6}).Disable()

I don't manage to disable it. Via Network-Sharing-Center - right click -
Disable it works without problems. When I disabled it via the
Network-Sharing-Center, I can enable it with the command

(get-wmiobject -class "Win32_NetworkAdapter" | Where-Object -FilterScript
{$_.DeviceID -eq 6}).Enable()

Only disableing won't work like this. Any ideas?

Thanks,

Jens
 #2  
03-20-09, 02:17 PM
Marco Shaw [MVP]
> (get-wmiobject -class "Win32_NetworkAdapter" | Where-Object -FilterScript
> {$_.DeviceID -eq 6}).Enable()
>
> Only disableing won't work like this. Any ideas?


I didn't check this in detail, but this link does seem to mention that
you can only use Disable() with WMI if you're using DHCP:
http://msdn.microsoft.com/en-us/library/aa394595.aspx

Marco
 #3  
03-22-09, 10:46 AM
Shay Levy [MVP]
Hello Jens,


I didn't check on server 2008 but I'm able to disable my nic (fixed IP) on
Vista x64 (CTP3):

$nic = gwmi Win32_NetworkAdapter -filter "DeviceID=4"
$nic.disable()

Similar Threads
Enable/Disable Network Adapter

Hi, How can I enable and disable a network adapter in eVC++? SetIFEntry is not good enough. It does not really disables it. Only the TCP. And by using GetInterfaceInfo or...

possible to disable/enable wireless network adapter via command?

Hi, Well I'm not even sure if this is possible. I'm trying to make a shortcut that would let me disable the wireless adapter and another one to enable it again. Is this...

enable/disable network adapter

I am looking for a way to quickly disable and enable network adapters from the command line. I'm pretty sure Netsh can do it but I haven't been able to find exactly how. ...

Get network adapter disable/enable status thru wmi

Hi All, Is it possible to determine thru WMI whether a network interface is either enabled or disabled. Devcon sample in winddk displays this status but i would like to...

regedit to enable/disable network adapter

What registry key can I edit to enable or disable a network adapter? Thanks


All times are GMT. The time now is 09:04 PM. | Privacy Policy