Powershell, Enabling/Disabling Network Card, two methods.

Yet another powershell script from my collection. This time it's a connection of two different methods of changing the state of the network card. I read on few forums that people are looking for a script that could disable or enable the network card, however some of them are using windows xp but the others Vista and higher. The problem is that on Vista and 7 we can use WMI to make this job quickly and clean but on Windows XP it's not that simple, we need to use the com object to do that.
The following script checks the operating system version and decides which method must be used.
If you are using windows xp, you will need to change highlighted variables depends on your os-language.

At the end of this post I've put few lines of code that will help you determine the values for variables.

Check values for your operating system (these depends on the system language):

$shell = New-object -com Shell.Application
(($shell.NameSpace(3).Items() | ? { $_.Path -like '*7007ACC7-3202-11D1-AAD2-00805FC1270E*'}).GetFolder.Items() | ? { $_.Name -eq 'change to your interface Name' }).Verbs() | Select Name


Post a Comment