Here is my solution for the following prompt:
Using your previous code, display the username, the number of processes, the total workingset size. Set no username to NONE.
If this is an internship assignment or homework question we try to avoid assisting with those as the first port of call should be your tutor or supervisor.
I am learning PowerShell for my IT job on my own accord. After finishing this practice problem I have a strong feeling that there is a lot of ways that this task could be completed more cleanly and effectively. If this is something you could share info on I would greatly appreciate it.
Wow, that is a beautiful solution. I am glad that I asked. Thank you very much for sharing. Hopefully I can work some of the methods you used in future scripts. Custom PowerShell objects will definitely come in handy. I was wondering how to format the result in a table but could not figure out how to using Write-Object.
It depends pretty much whatfor the output should be. Most of the time it’s enough to just drop what you want to see to the default output stream.
So just for display purposses it does not matter if you do
Write-Output "Very important message ..."
… or …
"Very important message ..."
… or even …
Write-Host "Very important message ..."
This may help you developing your own (a good) style:
And here you have some info about [PSCustomObject]