Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

24
Creating a tail log with Powershell
Post Body

Hi r/powershell,

I have a script that periodically gets some things, and I want to keep the processed objects in memory and also on disk. But I only want to keep the last x objects, not all of them. Currently I'm doing it like this:

$TailLog = @()

While ($true) {

    $TailLog  = Get-Thing
    $TailLog  = $TailLog | Select-Object -Last 100

    $TailLog | Export-Csv -Path .\taillog.csv

}

Is there a better way to achieve this? This potentially can run once a second, so I was wondering if there is a more efficient / faster / resource friendly way.

Author
Account Strength
90%
Account Age
15 years
Verified Email
Yes
Verified Flair
No
Total Karma
4,545
Link Karma
3,347
Comment Karma
1,198
Profile updated: 1 week ago
Posts updated: 10 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
6 years ago