TutorialsPowershell Basics Introduction to Windows PowerShell Part 1 Introduction to Windows PowerShell Part 2 Introduction to Windows PowerShell Part 3 PowerShell Script Signing PowerShell Scheduled Tasks PowerShell Networking Tasks Powershell Advanced Tutorials Coming soon... |
The company that has spent countless billions in the quest for the perfect GUI based OS is now, strangely enough, turning its focus back to the command line. Their new shell, PowerShell (formerly known as monad) is a completely new interface, which in true Microsoft fashion borrows heavily from the existing shell's (POSIX, Born, etc..) and languages such as Perl while basing it all on Microsoft's proprietary C# object oriented programming language.
This article will be written over the course of the next few weeks and is intended to be a practical introductory guide to PowerShell for those who would like to get a jumpstart into using PowerShell's many practical and useful capabilities without wading through hundreds of pages of MS documentation. We will jump around a bit and quite possibly skip some of the more obscure methods and syntax that make up PowerShell, so I encourage you to download Microsoft's official documentation here as a supplement to this and any other articles you may read.
Getting Starteddate Dir Dir > abc.txt Type abc.txtYou’ll notice that the date and dir output is not quite what we’re used to but it’s pretty similar.
Get-service Get-process Get-psdriveTo get a quick listing of ALL the new commands or cmdlets as they are now called simply type get-command. If you want help for any of the cmdlets just add a -? to the end of it or try using get-help
ls, dir – Get-Childitem history, ghy – Get-History cat, type – Get-Content rm, rmdir, ri, – Remove-ItemTo get a full listing of all the available aliases use get-alias or get-alias | sort to see the list grouped by cmdlet.
get-process | format-table –auto get-service | format-list ls | sort length ls | sort length – descendingWe’ve only used a single pipe in the examples above however you’ll often want to use multiple pipes, for example to drill down into individual items in your returned data.
5+5 2*(5+5)By default the result of your equation will be displayed to standard output. However you can just as easily store the output in either a file or variable.
$myvar = 2*(5+5) $myvar > myfile.txt Type myfile.txtUsability Tips
cd c:\(tab) cd c:\*files(tab) Get-(tab) $myvar.(tab)Up/down arrow and Pg up/down will let you cycle through your history and F7 will bring up a handy popup window from which you can cycle through and select one of your previously entered commands.