Advertisement
Eliel_Sec

Powershell_Desativar_Placa_Wireless_lab_A

Mar 7th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ##Desativar placa Wireless Labin A
  2.  
  3. $credencial = Get-Credential Administrador
  4. $computers  = Get-Content C:\Users\Lenovo\Desktop\labin_a_pcs.txt
  5. $online = @()
  6. $offline = @()
  7.  
  8. Foreach($pc in $computers) {
  9.     if (Test-Connection -BufferSize 32 -Count 1 -ComputerName $pc -Quiet) {
  10.  
  11.          if (Test-WSMan -ComputerName $pc ) {  $online += $pc }
  12.          
  13.          else  { $offline += $pc }
  14.  
  15. }
  16.  
  17. else { $offline += $pc }
  18.  
  19. }
  20.  
  21. Write-Output "O comando sera executado nos seguintes computadores: " $online
  22. Write-Output "Total de computadores ligados: " $online.Count
  23.  
  24. Invoke-Command -ComputerName $online { $sem_fio = Get-WmiObject -Class win32_networkadapter -Filter "Name LIKE '%802.11n%'" ; if($?){$sem_fio.Disable()} } -Credential $credencial
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement