Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Redirect console output in real time

$
0
0

I'm working with the delprof2 executable (https://helgeklein.com/free-tools/delprof2-user-profile-deletion-tool/, deletes user profiles) and incorporating it into a PS script. Everything works as expected, no problems, I've just run into a 'nice-to-have' that intrigues me.

When using the delprof2 /u option and having it delete profiles, it writes to the console a list of all the profiles it is ignoring, and then it writes:

Text
Deleting profile '\\computername\c$\users\username' ...
Pauses while it completes the action, and then writes to the console again:

Text
 ... done.
And if it has multiple profiles to delete, repeat the above two steps as necessary.

What I'd like to do is to be able to suppress the first few lines (saving the data for the final returned object) and output the above two lines as they occur in real time. What I've tried is...

Viewing all articles
Browse latest Browse all 15370

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>