I am looking for help in trying to output something like write-progress to a file
maybe even just overwriting the same line with the updated progress.
I have a long running script, that takes a couple days to finish, it’s a non-interactive script running under a scheduled task.
I would like to be able to check the progress of the script.
it does have a input file with a count of 200K objects
So looking for something like
$total = $items.count
and then increass a vaule with each foreach run with a $number++
and then output done $number of $total
but have it overwrite the same line in a log file as to not have 200K lines of a log file.
I got it by just using out-file
But interrested in other methods.
As usual - there are several options. You could write progress or status messages to the event log for example.
But you don’t have to implement all that by yourself. There are several functions, scripts or frameworks available in the internet - you may search for some of them.
One of the more known ones is
… and it has some options for logging included.
You may find other options at the …
But actually I wonder why …
What does this script do to take that long? There may be ways to speed up your code. Or there may be other ways of achieving what you need - I mean not by a PowerShell script. Would you like to share some more details about that?
Yes, the script is running get-exomailboxfolderpermissons against 200K plus Exchange online mailboxes
and then validating each user.