How to Display Hostnames with AV Signature Updates in PowerShell?

0
4
Asked By TechWanderer99 On

I'm a beginner trying to check which of my servers have had their antivirus signatures updated. Currently, I'm able to get a list of update dates by running `get-mpcomputerstatus | select antivirussignaturelastupdated`. However, I'm struggling to include the hostnames in the output; instead, I'm only seeing the computer IDs.

What I'm looking for is a way to use a foreach loop to gather the hostname and the antivirus signature update date, then export that data to a CSV file. How can I join these commands in a foreach loop to get the desired output?

1 Answer

Answered By CodeSplash1 On

You might want to check out using hash tables to combine your data. Instead of selecting just the antivirus signature last updated, you should select the other columns too. Try this command:

`get-mpcomputerstatus | select hostname, ipaddress, antivirussignaturelastupdated` since this will help capture the needed information. Then, to export it to CSV, you can pipe it with `Export-Csv` like this:
`Export-csv "c:tempexport.csv" -append`.

QueryMaster67 -

Thanks! That works as intended, but I noticed that `get-mpcomputerstatus` only provides a computer ID, not a hostname. The output is exactly what I need for the IDs and signature dates, but the report will confuse people who expect recognizable names instead.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.