Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $servername = Get-Content 'C:\Users\rholmes\Desktop\ComputerList2.txt'
- # Check the Latest virus Definition Date
- $myData = Foreach ($server in $servername) {
- $output = [pscustomobject] @{
- Server = $server
- version = "UNKNOWN"
- LatestVirusDefinitionDate = "UNKNOWN"
- LatestVirusDefinitionRevision = "UNKNOWN"
- }
- Try {
- Write-Verbose "Trying to connect to '$server'"
- $Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine',$server)
- $key = $Reg.OpenSubKey("SOFTWARE\Symantec\Symantec Endpoint Protection\CurrentVersion")
- $key2 = $Reg.OpenSubKey("SOFTWARE\Symantec\Symantec Endpoint Protection\CurrentVersion\public-opstate")
- $output.version = $key.getvalue("PRODUCTVERSION")
- $output.LatestVirusDefinitionDate = $key2.getvalue("LatestVirusDefsDate")
- $output.LatestVirusDefinitionRevision = $key2.getvalue("LatestVirusDefsRevision")
- } catch {
- # Exception probably indicates that the registry open failed
- Write-Error "Error - getting detailed from '$Server' failed"
- Write-Error $_
- }
- }
- $myData | Export-Csv $env:TEMP\mydata.csv
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement