Windows

Two Windows PowerShell tips for the administration ninja

Bill Detwiler demonstrates two Windows PowerShell tips--retrieving a list of installed USB devices and killing processes without opening Task Manager.

PowerShell combines the speed of the command line and flexibility of a scripting language into a remarkably powerful Windows administration tool. In this week's TR Dojo episode, I show you how Windows PowerShell lets you retrieve a list of a system's installed USB devices and kill processes without open Task Manager.

PowerShell pop quiz

Last year, I published the following quiz to test everyone PowerShell knowledge. I've republished the questions below. (If you have already taken the quiz, the questions will appear answered.) Once you've answered the questions, you can find the answers to our PowerShell quiz in this TR Dojo discussion post.

For those of you who prefer text to video, you can click the Transcript link that appears below the video player window or read Rick Vanover's article, "10 cool things you can do with Windows PowerShell," on which this episode is based.

You can also sign up to receive the latest TR Dojo lessons through one or more of the following methods:

About

Bill Detwiler is Managing Editor of TechRepublic and Tech Pro Research and the host of Cracking Open, CNET and TechRepublic's popular online show. Prior to joining TechRepublic in 2000, Bill was an IT manager, database administrator, and desktop supp...

21 comments
jpswade
jpswade

What about taskkill? It can be run from a batch file. TASKKILL [/S system [/U username [/P [password]]]] { [/FI filter] [/PID processid | /IM imagename] } [/F] [/T] Description: This command line tool can be used to end one or more processes. Processes can be killed by the process id or image name. http://technet.microsoft.com/en-us/library/bb491009.aspx

pcassidy
pcassidy

Powershell is very easy to learn and very powerfull. It is also much more than any unix shell as we are dealing with objects and not text here. You can begin to make Powershell easier to use by using the proper names for commands and not the alias's like Get-WMIObject and also you should how to use these commands as someone would in the field like Get-Process -name 'BadThread' | Stop-Process this stops all BadThreads not just the one with a an id and cuts down on the typing. there a great Tutorial found here http://www.powershellpro.com/powershell-tutorial-introduction/ Good Times And Get-Command

leo8888
leo8888

So will the "stop-process" command be as effective as something like MalwareBytes "File Assassin" to kill malware processes that refuse to end?

stay_secure
stay_secure

Isn't antecedent misspelled in the video? - Bob

manuelpinot
manuelpinot

powershell is a bad implemetation of *nix bash and never compair with zbash,

Bill Detwiler
Bill Detwiler

In the above TR Dojo post, I show you how Windows PowerShell can let you retrieve a list of installed USB devices and kill processes without opening Task Manager. Last year, I published a PowerShell pop quiz. I've republished the questions in the above post. Give it a try, and test you PowerShell knowledge. Original post and pop quiz: http://blogs.techrepublic.com.com/itdojo/?p=1206

mdelato
mdelato

Very good question! Can anyone provide insight on this? I'm guessing the two are identical on the end result.

Bill Detwiler
Bill Detwiler

Aggggh! You have no idea how many times I checked those screenshots. I had to create each one individually to make the lines appear properly. Indeed, I transposed the "e" and "n" in the word antecedent. Thanks for pointing out the error. If you send me a private message, I'll send you a little TechRepbulic swag as a thank you.

mhbowman
mhbowman

statement of fact to back your argument. A quick Google search reveals: Similarities exist in that both Bash and PowerShell include commands for navigating directories, managing files, and launching other programs. Bash and PowerShell are both equipped to help manage systems from the command prompt. But Poweshell is built on the .Net framework and passes actual objects and not just strings. This object orientation helps standardize operations and supports handling of complex data structures. Bash cannot compete here; instead, it relies on the abilities of external programs to handle data structures. Bash is useful as a plain but straightforward tool for most daily tasks, but doesn't satisfy any need for for advanced uses and complex data structures. In case you were concerned about any M$ bias this was from an article in linux mag: http://w3.linux-magazine.com/issue/78/Bash_vs._Vista_PowerShell.pdf

macgvr
macgvr

In this video he gives some great tips for using Powershell. In one, however, there is a typo at the end of the command. Antecedent was spelled antecednet. Now the command will run and won't give you an error but the data that should have displayed for antecedent won't be.

bmwwaterman
bmwwaterman

Is there someplace where I can read about all that PowerShell can do? I've noticed that it has been part of the Windows Updates for a while now.

PoppaTab
PoppaTab

Hello, I took the quiz a while back and got a duhhhhhhhh score, but I am trying to learn LOL I always look forward to your posts; ty again.

Gh0stMaker
Gh0stMaker

Nice clarification, technology changes quickly tech pros. If you don't like the tool now, you may love it later.

QASIMARA
QASIMARA

go up nord in subfreezing temps. be mean and try to lick frozen pole. scream for help. wait for star-like blades to strike.

Editor's Picks