Windows 7 32 and 64 bit Powershell version 3.0
I am looking for a script that I can remotely disable wireless adapters. here is what I currently have, however I get an error that a null value cannot be called. This is part of a malware response, we disable the Ethernet port but we need a way to disable the wireless and this is what I think we need to do. I just need it to disable wireless only.
$ComputerName = read-host -Prompt "Please Enter the Computer Name to Disable the Wireless Adapter"
$Variable = Get-WmiObject Win32_networkadapter -ComputerName $ComputerName | where {$_.name -like "*wi*"} $Variable.disable() -ErrorAction SilentlyContinue
$variable = Get-WmiObject Win32_networkadapter -ComputerName $ComputerName | where {$_.name -like "*802*"} $Variable.disable() -ErrorAction SilentlyContinue
$variable = Get-WmiObject Win32_networkadapter -ComputerName $ComputerName | where {$_.name -like "*4G*"} $Variable.disable() -ErrorAction SilentlyContinue
IF this script would not work something similar would be great!
Thanks for any help!
Network disable script
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Network disable script
NETSH is the easiest way to do this.
- Get-WmiObject Win32_networkadapter -Filter 'Name LIKE "%wi%" OR Name LIKE "%802%"' |
- ForEach-Object{$_.Disable()}
Re: Network disable script
Thank you for your quick response... I still have an issue calling this command also... I am getting an error that I cannot call a null value and Invalid query.jvierra wrote:NETSH is the easiest way to do this.
Get-WmiObject Win32_networkadapter -Filter 'Name LIKE "%wi%" OR Name LIKE "%802%"' | ForEach-Object{$_.Disable()}
Re: Network disable script
I apologize, I missed the pipe and put the disable on another line. This script is working great! Thank you for looking into this so quickly.