Welcome to Sign in | Join | Help
in
Home Blog Forums

The Lazy Admin

Introduction to PowerShell Part 1

Sponsor

Monad, MSH, Microsoft Shell, PowerShell call it what you want but get ready for a whole new shell! PowerShell will change the way you work! 

PowerShell is built on top of the .NET Framework and replaces the old process of using text to pass data like the current CMD shell. PS is a scriptable language that provides an alternative to the manual changes you make through a GUI. It is more powerful than Perl or WSH, although those two technologies can help with automating a lot of tasks.  Let's look at what PS is and is not and hopefully it will help clear things up a bit.

Powershell

  • is NOT a programming languge like C## et al. 
  • is a scripting language like VBS, WSH, Perl 
  • is NOT a replacement for CMD.EXE - is an administrative tool 
  • is NOT going to replace all your system administration tools 
  • is going to change the way you administrate your network

PowerShell is not included with any OS at this time. It will first ship with Exchange 2007, and most likely will be included in Longhorn Server.

A cmdlet is a new term used to describe a MSH command. MSH commands are comprised of a verb (i.e. Get) and a noun (i.e. Process) seperated by a hyphen. For example:

Get-Process Get-Help C

mdlets, pronounced command-lets, provide one of the fundamental parts of the of PS. Cmdlets can be as simple as the examples just shown to very complex, you can even write your own cmdlets. Getting help is just as easy as it is with the CMD shell.

Get-Help Get-Help Get-Process Get-Process help Get-Process -?

All these commands will give you the available switches and usage for the command specified. To see a list of available cmdlets run

Get-Command

The list is long and just like the CMD shell, you can use "| more" to pause between pages.

Get-Commands | more

Also similar to CMD you can redirect output to a file with > and >>.

Get-Commands > commands.txt

This will create a file called commands.txt and pipe the output to this file.

Get-Commands >> commands.txt

This will pipe the output to the commands.txt and append the data. You can then use Get-Content commands.txt to display the contents of the file within the MSH enviroment.

Finally, you can create aliases so you can use CMD shell commands to run the equivalent PS command within the PS enviroment using Set-Alias CMD

Set-Alias Dir Get-ChildItem or Set-Alias Del Remove-Item

 

 
Published Monday, January 09, 2006 6:35 AM by rodney.buike
Filed under:
Anonymous comments are disabled

This Blog

Powered By

 

Syndication

Sponsors

  
Get a free 5GB e-mail account @isalazyadmin.com

Certifications & Awards




All postings are provided "AS IS" with no warranties, and confer no rights.
Microsoft product screen shot(s) reprinted with permission from Microsoft Corporation.