Use PowerShell To Find Resource Hogs

Tools IconHere’s a quick tidbit for any and all Windows jockeys out there. Need to figure out what is chewing up all of your system resources? Need to do it quickly and easily? Have no fear, Laz and the PowerShell are here. Some of you may know this already, so let those who don’t have some air!

OK, bring up the PowerShell (*note, this is different from the DOS “like” Command Prompt and can usually be installed through Windows Update). Once the PowerShell is open, you can use the ‘ps’ command to get a list of the currently running pr0cesses, but believe you me there are a lot of them and they scroll by all unformatted and hard to read and stuff. All in all you get a bunch of info that is hard to understand!

“So, what are we doing here?” you ask. Well, this is where just like with the ‘ps’ command (and the PowerShell in and of itself too), Windows takes some inspiration from UNIX and not only adds some nifty commands to help wrangle all that information that goes scrolling by, but also the idea of “piping” commands or a more simpler analogy, a way to link commands together. Making them talk to each other, work together and share information like never before. You pipe commands together with the ‘|’ character, and it allows you to run a command and take that output and send it to the next command. You will see this in the final command we will use, take a look:

ps | sort -desc cpu | select -f 20 | ft -a;

So, let’s take a look at what this command or set of commands really, does. First off the ps command gets the current list of processes running on the machine along with certain information about each and every one of them like the ‘Process ID’, the ‘ProcessName’ and the amount of ‘CPU’ time it’s using to name just a few. We then take all of that ‘ps’ data and “pipe” or feed it into the ‘sort’ command, telling sort to … well, sort that information by the ‘CPU’ column in “Descending” order. We then take all that sorted data and use the ‘select’ command to only grab or select the top ’20’ items in the list. Last but not least, we use the ‘ft’ command to “format” the list that we have now, which has been cut down to just the top 20 processes sorted by how much of your CPU they are using starting with the most at the top of the list and then listing the top 20 going down from there.

Ultimately, you run this command just like you see it above and you will get a list of the top processes that looks like this:

PS C:\temp> ps | sort -desc cpu | select -f 20 | ft -a;

Handles NPM(K)   PM(K)   WS(K) VM(M)   CPU(s)   Id ProcessName
------- ------   -----   ----- -----   ------   -- -----------
    197     14    6700   11456    92 1,008.66 2744 AODAssist
    422     15    6272   11572    53   886.27 1112 svchost
   2398   1032  115224   10804   420   863.37 2020 AvastSvc
    827     48  253744  247248   371   641.55 1388 svchost
   1132    106   86252  118472   421   575.07 3596 explorer
    140     69   45028   49456   173   572.51 5012 Everything
    485     47   46612   69228   284   565.83 9608 explorer
   1535     90   33912   49260   433   453.93 1460 svchost
    717     52   29416   27460   124   451.45 1352 svchost
    363     43   41048   11472   176   370.32 4436 svchost
    909     63   94836  129776   726   366.38 6388 dopus
    596     54   24476   26196   248   364.06 5136 avastui
    684     44   22172   23564   241   352.66 1048 svchost
    140     13  119472  113980   183   328.48 6972 vmware-usbarbitrator64
    300     13    9940   14796    64   306.90 6516 WmiPrvSE
    346     31   35176   29280   203   302.42 4688 tlbHost
    225     24 1431016 1339160  1460   263.47 1500 stacsv64
    865     81   27488   36708   149   216.86 1420 svchost
    202     16    7300   15020    96   215.45 1744 WHSTrayApp
    110     10    7144   10368    58   200.74 3252 BitMeterCaptureService

There you go, a nice handy little list of your top offenders! If you keep a PowerShell handy, it can be a very fast way to take a quick look at what’s going on under the hood of your PC. Enjoy!

Midnight ramblings – probly shouldn’t even read this

It’s pretty strange to me that on those rare occasions when I watch TV I see lots of commercials on from Microsoft comparing Bing to Google claiming that Bing is better when really, it’s a matter of personal preference and taste. I mean, people search the Internet for various and different things and sometimes even the same things but that doesn’t mean that they are seeking the same thing, and even if they are seeking the same thing, they may not want the same results. That’s one of the beauties of the ‘net, it’s ALL subjective! Bing is no better than Google, no more than Google is better than Bing. It’s up to the user, not some fake dork looking geek yelling “Bing it ooooooon” through a megaphone. Give me a break.

It’s about like the Internet Explorer commercials saying that they give you the power to do more, or something about family moments or whatever. I mean, Internet Explorer is pre-installed (or included, or built-in, or whatever, take your pick) on EVERY Windows™®© installation everywhere, and it is still a solid third place contender. For a long time it was second place behind Firefox, but then Chrome surfaced from Google, and now IE has slid to third. Currently, and since about March 2012, the list has Chrome in the lead with 53.2%, Firefox holding on to second with 27.8% and Internet Explorer in third with 12.1% – and that’s while still being the default and only browser on new installs of Windows. If someone wants Chrome or Firefox or anything else they have to use Internet Explorer to go get it! I know, I know, you all already know that. I just don’t know how Microsoft can even think that they have the top end product when it STILL won’t render HTML5 properly.

When we shift the subject to operating systems, the subject becomes even more based on the user and their personal preferences. But then, that’s really yes and no, because most users are pretty much held captive by Windows, and that’s nothing bad or nefarious on Microsoft’s part. It’s just that the majority of computer users out there just don’t know enough to use any other operating system. They know enough about Windows to use it, to get along, and so that’s what they choose. In most cases it’s not even a conscious choice, it’s the only choice, most don’t even know there’s an alternative. Although that’s starting to change a bit since Apple and OSX came to town. Apple took a page from Jean-Louis Gassée’s book with OSX. Jean-Louis Gassée is the man who created the best operating system known to mankind, BeOS. He had the idea that it would be easier to make UNIX user friendly rather than make Windows stable, and created a UNIX based operating system with a beautiful and incredible use interface. Ultimately BeOS didn’t make it, but OSX followed in the same foot steps in my opinion, it’s a UNIX based operating system that is beautiful and easy to use and is becoming more and more popular to date. A year or two ago (I don’t know if it’s still true), Apple was the largest seller/distributor of UNIX based computers in the world. Not bad for a company that almost went under a few years prior!

What does all of my useless rambling mean? Not a darn thing! LOL Except that ultimately, despite what big companies might try to tell us, and what we might believe ourselves, it’s the consume that has the power in the end to drive the industry, and we simply have to vote with our dollar bills. Buy the good stuff and ditch the bad, and for free stuff and open source stuff, it’s pretty much the same, support the good and ignore the bad.

It is my opinion that the Internet is the great playground leveler. Whether it is technology, or entertainment, singing or playing an instrument, dancing or whatever on YouTube, if it’s good … people will like it and view it and share it and it will come to the top. Whereas the bad will fall off into obscurity. The Internet gives even the little guy the chance to be a star at whatever it is that he has chose as his arena fight in. Now, go get some sleep!

Cool Tools: Hard Disk Sentinel

hds_std_230Recently I found a tool for Windows and Linux PCs that provides a long overdue service, and that is hard disk monitoring. Now, I don’t mean monitoring like some tools where it just looks at free space or temperature and that’s it, this tool set looks at everything you can think of. Yes it checks free space and temperature, but also reads, monitors and reports on S.M.A.R.T. data, errors, log information, performance and more. Check out a full list of features here.

One thing that this tool does that I really like is hard disk surface testing and data relocation. I don’t mean simple “can I read this” sector testing like most tools do, HDS does intensive surface testing making sure that the entire disk can be read from and written to properly. It can detect weak sectors, that would be sectors that still work and thus would pass a simple “read only” test, but are weak meaning they are not “good as new” and could be near failure. When it finds these areas, it can then relocate that data to known good areas and attempt to re-initialize those weak sectors. If that fails, they can be marked bad and not used, making sure that no data is placed anywhere that might be at risk of data loss. You can also setup rules to backup data to another place when these weak areas are found, this tool is highly customizable. There is another tool that does this kind of testing amazingly well, and it’s called Spinrite, from Gibson Research. The major disadvantage of using Spinrite though, is that you must book from a disk and run Spinrite from a DOS console. This allows exclusive and total access to the disks, and means that the testing is even more thorough, but your system is not usable while the tests are running. The trade-off of getting to have these tests performed while my system is up and running means a lot to me.

Unfortunately, this is not a free tool, although they do have a free trial you can use to test it out, and the pricing is very reasonable. All in all, I highly recommend this tool for any users PC. Now, aside from installing directly onto your PC, the license allows this tool to be installed onto a memory stick or thumb drive instead, allowing the tests to be run on many computers. This is when it is a golden tool for a PC technician’s kit. So, check it out and see what you think. I am very happy with it, and I hope you get some benefit from it too. Don’t forget to check out the rest of the Cool Tools over in the Cool Tools section!

*Note: Please remember that this is not any kind of paid advertisement or review. I am posting this because of exactly what I said in the article, I found this tool and found it to be useful and wanted to share it with my readers. I just want to make sure that you know that I in no way am getting paid for this article, nor do I get paid if you buy the software, etc. This is a 100% honest review from a happy user!

Enhanced by Zemanta

Powerconfig and Windows Hibernation – Part 2

I wanted to post a followup to an earlier post about Windows and disabling the Hibernation feature.  The original power was useful because in many circumstances (like most desktops) you don’t need to or want to hibernate your system.  So, you can save some disk space (upwards of the amount of RAM in your PC) and some performance overhead of managing that hibernation file, by disabling the hibernation function or feature.  You can read that one here.

Next thing I thought about was, what if you do need that hibernation function?  Well, naturally you can do the opposite of that earlier article to enable hibernation if it isn’t already, although usually it is by default.  But also, you can specific how big the hibernation file (hiberfil.sys) is compared to how much memory you have in your machine.  I would imagine if the file is set to less than your memory it must do some compression and maybe leave some non-essential stuff out, but I don’t know for sure and I am not sure if it’s worth digging into too deeply.  However, if you have some binary real estate (disk space) to spare, and you don’t have too much memory in your machine (you guys with 16GB or something need to ditch Windows and run Linux), set it to 100% and rock out.

Just like the enable and disable, you use the powercfg.exe command, and interestingly enough, still use the -H switch.  But instead of just On or Off, you add another switch ‘-Size’ and a number between 50 and 100 to equate to anywhere between 50 and 100 percent of your memory.  According to what I read, you can’t choose less than 50% or, obviously, more than 100%.  So, I set mine to 100% (it was at 75% by default) and am going to see how well it works.  If I see anything that warrants it, I’ll post a follow up as to whether or not it’s a good idea.

OK, the command to set your hiberfil.sys size to 100% would be:

powercfg.exe -H -Size 100

And there you have it, it’s just that easy!  Hope it helps 🙂

Disable Hibernation In Windows

Here is a helpful tidbit for anyone that might need it.  It’s something I used now and then, often enough that I remember the command, but not often enough to remember the exact syntax LOL  At least if I post it here it will be easy to find.  What am I talking about you ask?  Well, enabling and disabling hibernation in Windows.  If you are running a desktop, you most likely don’t need to hibernate your machine.  You can if you want, but I for one don’t want to lose the extra few gigs of disk space taken up by the ‘hiberfile.sys’ hibernation file.  Not to mention the system resource usage and overhead of keeping it updated.

OK, getting down to business, on Windows Vista and Windows 7, you can enable or disable the hibernation function easily by using the ‘powercfg’ command with the ‘-H’ (hibernation) option.  Here are a couple of examples:

powercfg.exe -H off

This turns hibernation off naturally, and:

powercfg.exe -H on

Will turn it on, and just that easily too!

I hope this little trinket of wisdom comes in handy for you.  Enjoy!

Cool Tools – Keep Windows Humming

We’ve got some big ol’ updates for the Cool Tools section.  The folks at Piriform have been cranking out some cool stuff, and they just keep making them better and better.  Best of all they are all free.  They have several tools that help keep Windows happy, a system cleaning and fixing tool, a defrag tool and a system information too.  Check out a brief description of each one below, and be sure to follow the links to the sites for each tool to get all the details.  Be sure to check all of the Cool Tools that we have posted as well as all the good articles in the Library.

Cool tools from Piriform:

  • CCleaner – This is a great tool for finding files that can be safely removed in order free up space on your hard drive.  It also has a great registry cleaner, a tool for managing program startup when your machine starts, an interface to uninstalling software and more.  This is a great system maintenance tool.
  • Defraggler – This tool is one of, if not the best defrag tool for Windows.  This tool is not the fastest, but that’s OK because it’s very thorough.  It takes time to do it right, and do it right it does from my experience.
  • Speccy – I superb system info tool.  No install necessary, just run and collect data.

In all, these free tools rival the commercial alternatives and any tech should add them to his or her kit.  Check ’em out.