SHOW:
|
|
- or go back to the newest paste.
| 1 | - | ##Ativar placa Wireless Labin C |
| 1 | + | ##Desativar placa Wireless Labin C |
| 2 | ||
| 3 | ||
| 4 | $credencial = Get-Credential Administrador | |
| 5 | $computers = Get-Content C:\Users\eliel\Desktop\scritps_powershell\labin_c_pcs.txt | |
| 6 | $online = @() | |
| 7 | $offline = @() | |
| 8 | ||
| 9 | ||
| 10 | Foreach($pc in $computers) {
| |
| 11 | if (Test-Connection -BufferSize 32 -Count 1 -ComputerName $pc -Quiet) {
| |
| 12 | ||
| 13 | if (Test-WSMan -ComputerName $pc ) { $online += $pc }
| |
| 14 | ||
| 15 | else { $offline += $pc }
| |
| 16 | ||
| 17 | } | |
| 18 | ||
| 19 | else { $offline += $pc }
| |
| 20 | ||
| 21 | } | |
| 22 | ||
| 23 | ||
| 24 | Write-Output "O comando sera executado nos seguintes computadores: " $online | |
| 25 | Write-Output "Total de computadores ligados: " $online.Count | |
| 26 | ||
| 27 | ||
| 28 | - | Invoke-Command -ComputerName $online { $sem_fio = Get-WmiObject -Class win32_networkadapter -Filter "Name LIKE '%Adaptador de rede 802.11n%'" ; if($?){$sem_fio.Enable()} } -Credential $credencial |
| 28 | + | Invoke-Command -ComputerName $online { $sem_fio = Get-WmiObject -Class win32_networkadapter -Filter "Name LIKE '%Adaptador de rede 802.11n%'" ; if($?){$sem_fio.Disable()} } -Credential $credencial |