Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Powershell script for determining if a machine is running NOD32 or SEV
  2. # Written by Thomas York
  3. # Last modified 11/10/2010
  4.  
  5. # Declarations
  6. $startip = "100"
  7. $endip = "200"
  8. $network = "10.1.1."
  9. $AV = @{}
  10. $hostname = @{}
  11.  
  12. # Declare a new ping object
  13. $ping = new-object System.Net.NetworkInformation.Ping
  14.  
  15. # First, we try to ping all of the machines in the defined network
  16. # If they are up, we will try to browse their filesystem(s) to see what AV they have
  17.  
  18. for ($i=[int]$startip; $i -le $endip; $i++) {# Loop start
  19.     # Ping the host
  20.     $go = $ping.send($network + $i.ToString())
  21.     $result = $go.status
  22.    
  23.     # See if the ping worked
  24.     if ($result -match "Success") {
  25.         $ip = $network + $i.ToString()
  26.        
  27.         # Determine machine name via WMI
  28.         if ($dsk = Get-WmiObject -namespace root\cimv2 -class Win32_ComputerSystem -computername $ip) { # WMI worked
  29.             foreach ($drive in $dsk) { # Loop through WMI results
  30.                 $hostname.Add("$ip", "$drive.Name")
  31.             }
  32.         } else { # WMI Failed
  33.             $hostname.Add("$ip", "UNKNOWN")
  34.         }
  35.        
  36.         # AV checks
  37.         if (Test-Path "\\$network$i\c$\Program Files\ESET") { # Test for NOD32
  38.             write-host "NOD32 " -foregroundcolor green -nonewline
  39.             write-host "found on $hostname[$ip] ($ip)"
  40.             $AV.Add("$ip", "NOD32")
  41.         } else { # No NOD32...
  42.             if ((Test-Path "\\$network$i\c$\Program Files\Symantec AntiVirus") -or (Test-Path "\\$network$i\c$\Program Files\Symantec\Symantec Endpoint Protection") -or (Test-Path "\\$network$i\c$\Program Files\Symantec\LiveUpdate")){ # Test for Symantec
  43.                 write-host "Symantec (or LiveUpdate) " -foregroundcolor red -nonewline
  44.                 write-host "found on $hostnamei[$ip] ($ip)"
  45.                 $AV.Add("$ip", "Symantec")
  46.             } else { # No AV or some other AV
  47.                 write-host "No known AV detected on $hostname[$ip] ($ip)"
  48.                 $AV.Add("$ip", "None")
  49.             }
  50.         }
  51.        
  52.     } else { # Ping fails
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement