michalek19
asked on
Script to check SEP production and latest virus definitions
Hi
I have short powershell script that checks Symantec Endpoint Protection Antivirus Definition Dates and Production version. After executing this script I am getting output but the output is a little bit messy.
I would like to ask if anyone with PS experience can combine both line of scripts into one and generate clean output into CSV file and send via email.
Script:
Invoke-Command -ScriptBlock {Get-ItemProperty -Path "hklm:\SOFTWARE\Symantec\S ymantec Endpoint Protection\CurrentVersion" -name productversion} -Computername $(Get-Content servers.txt)
Invoke-Command -ScriptBlock {Get-ItemProperty -Path "hklm:\SOFTWARE\Symantec\S ymantec Endpoint Protection\CurrentVersion\ public-ops tate" -name LatestVirusDefsDate} -Computername $(Get-Content servers.txt)
The CSV file out put should contain only
PSComputerName : FTC-WB(Server Name)
PSPath : Microsoft.PowerShell.Core\ Registry:: HKEY_LOCAL _MACHINE\S OFTWARE\Sy mantec\Sym antec Endpoint Protection\CurrentVersion
PRODUCTVERSION : 14.2.1031.0100
PSPath : Microsoft.PowerShell.Core\ Registry:: HKEY_LOCAL _MACHINE\S OFTWARE\Sy mantec\Sym antec Endpoint Protection\CurrentVersion\ public-ops tate
LatestVirusDefsDate : 2019-06-17
PSComputerName : lon-wg(Server Name)
PSPath : Microsoft.PowerShell.Core\ Registry:: HKEY_LOCAL _MACHINE\S OFTWARE\Sy mantec\Sym antec Endpoint Protection\CurrentVersion
PRODUCTVERSION : 14.2.1031.0100
PSPath : Microsoft.PowerShell.Core\ Registry:: HKEY_LOCAL _MACHINE\S OFTWARE\Sy mantec\Sym antec Endpoint Protection\CurrentVersion\ public-ops tate
LatestVirusDefsDate : 2019-06-18
I have short powershell script that checks Symantec Endpoint Protection Antivirus Definition Dates and Production version. After executing this script I am getting output but the output is a little bit messy.
I would like to ask if anyone with PS experience can combine both line of scripts into one and generate clean output into CSV file and send via email.
Script:
Invoke-Command -ScriptBlock {Get-ItemProperty -Path "hklm:\SOFTWARE\Symantec\S
Invoke-Command -ScriptBlock {Get-ItemProperty -Path "hklm:\SOFTWARE\Symantec\S
The CSV file out put should contain only
PSComputerName : FTC-WB(Server Name)
PSPath : Microsoft.PowerShell.Core\
PRODUCTVERSION : 14.2.1031.0100
PSPath : Microsoft.PowerShell.Core\
LatestVirusDefsDate : 2019-06-17
PSComputerName : lon-wg(Server Name)
PSPath : Microsoft.PowerShell.Core\
PRODUCTVERSION : 14.2.1031.0100
PSPath : Microsoft.PowerShell.Core\
LatestVirusDefsDate : 2019-06-18
ASKER
The script is running fine but the out i would like to change a little bit.
I only want to see only this instead of the whole path and the versions
ComputerName ProductVersion LatestVirusDefsDate
FTC-WB 14.2.1031.0100 6/17/2019
LON-WG 14.2.1031.0100 6/18/2019
Please check attachment.
Output-file.png
I only want to see only this instead of the whole path and the versions
ComputerName ProductVersion LatestVirusDefsDate
FTC-WB 14.2.1031.0100 6/17/2019
LON-WG 14.2.1031.0100 6/18/2019
Please check attachment.
Output-file.png
ASKER
i want to add another script to your code to check whether SEP is managed or unmanaged. Can you help me with this, too?
i tried to add this but it doesn't work
$outFile = 'C:\Users\xxxx\Desktop\SEP DEV\symant ec.csv'
Invoke-Command -Computername $(Get-Content servers.txt) -ScriptBlock {
[PSCustomObject]@{
ComputerName = $ENV:ComputerName
ProductVersion = Get-ItemProperty -Path "HKLM:\SOFTWARE\Symantec\S ymantec Endpoint Protection\CurrentVersion" -Name ProductVersion
LatestVirusDefsDate = Get-ItemProperty -Path "HKLM:\SOFTWARE\Symantec\S ymantec Endpoint Protection\CurrentVersion\ public-ops tate" -Name LatestVirusDefsDate
UseManagementServer = Get-ItemProperty -Path "HKLM:\SOFTWARE\Symantec\S ymantec Endpoint Protection\LiveUpdate\" -UseManagementServer
}
} | Select-Object -Property ComputerName, ProductVersion, LatestVirusDefsDate, UseManagementServer | Export-Csv -NoTypeInformation -Path $outFile
i tried to add this but it doesn't work
$outFile = 'C:\Users\xxxx\Desktop\SEP
Invoke-Command -Computername $(Get-Content servers.txt) -ScriptBlock {
[PSCustomObject]@{
ComputerName = $ENV:ComputerName
ProductVersion = Get-ItemProperty -Path "HKLM:\SOFTWARE\Symantec\S
LatestVirusDefsDate = Get-ItemProperty -Path "HKLM:\SOFTWARE\Symantec\S
UseManagementServer = Get-ItemProperty -Path "HKLM:\SOFTWARE\Symantec\S
}
} | Select-Object -Property ComputerName, ProductVersion, LatestVirusDefsDate, UseManagementServer | Export-Csv -NoTypeInformation -Path $outFile
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for your help
Open in new window