Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Remove Network Bindings with Powershell?

$
0
0

I have been experimenting with a way to get Powershell to remove network bindings on a group of remote computers, instead of having to use NVSPBIND. I have the following:

Get-WmiObject -Query "select * from win32_networkadapter WHERE PhysicalAdapter = 'True'" `
| Select-Object NetConnectionID, GUID `
| Where-Object -Property NetConnectionID -EQ "Test Network" | Select-Object -Property GUID

Which shows the following when run on the local computer (doesn't work when I try to put it in a scriptblock with Invoke-Command to run against remote computers):

GUID                                                                                              
----                                                                                              
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}

Now I would like to be able to select that GUID and disable the "Client for Microsoft Networks" binding on it. In the past I have used NVSPBIND with the /d switch and the GUID. How can I use powershell to accomplish this? I have seen the netadapter cmdlets for Server 2012, but this domain uses Server 2008 R2 / Windows 7 and they do not work. I am using Powershell 3.0. 

I could use NVSPBIND, but I would need to have the script copy it and then remove it as well. The reason I trying to use powershell is that there are different computers with different NIC's (each computer has 2 but not all the same hardware), all with the same "Test Network" network name, but have different GUIDs. I need the script to select the GUID for the "Test Network" NIC and disable a binding.





Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>