Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Server

Windows Server 2008 R2 : Understanding the PowerShell Basics (part 1)

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
3/15/2011 9:50:47 PM
Accessing PowerShell

After logging in to your Windows interactive session, there are several methods to access and use PowerShell. The first method is from the Start menu, as shown in the following steps:

1.
Click Start, All Programs, Accessories, Windows PowerShell.

2.
Choose either Windows PowerShell (x86) or Windows PowerShell.

To use the second method, follow these steps:

1.
Click Start.

2.
Type PowerShell in the Search Programs and Files text box and press Enter.

Both these methods open the PowerShell console, whereas the third method launches PowerShell from a cmd command prompt:

1.
Click Start, Run.

2.
Type cmd and click OK to open a cmd command prompt.

3.
At the command prompt, type powershell and press Enter.

Command-Line Interface (CLI)

The syntax for using PowerShell from the CLI is similar to the syntax for other CLI shells. The fundamental component of a PowerShell command is, of course, the name of the command to be executed. In addition, the command can be made more specific by using parameters and arguments for parameters. Therefore, a PowerShell command can have the following formats:

  • [command name]

  • [command name] -[parameter]

  • [command name] -[parameter] -[parameter] [argument1]

  • [command name] -[parameter] -[parameter] [argument1],[argument2]

When using PowerShell, a parameter is a variable that can be accepted by a command, script, or function. An argument is a value assigned to a parameter. Although these terms are often used interchangeably, remembering these definitions is helpful when discussing their use in PowerShell.

Navigating the CLI

As with all CLI-based shells, an understanding is needed in how to effectively navigate and use the PowerShell CLI. Table 1 lists the editing operations associated with various keys when using the PowerShell console.

Table 1. PowerShell Console Editing Features
KeysEditing Operation
Left and right arrowsMove the cursor left and right through the current command line.
Up and down arrowsMoves up and down through the list of recently typed commands.
PgUpDisplays the first command in the command history.
PgDnDisplays the last command in the command history.
HomeMoves the cursor to the beginning of the command line.
EndMoves the cursor to the end of the command line.
InsertSwitches between insert and overstrike text-entry modes.
DeleteDeletes the character at the current cursor position.
BackspaceDeletes the character immediately preceding the current cursor position.
F3Displays the previous command.
F4Deletes up to the specified number of characters from the current cursor.
F5Moves backward through the command history.
F7Displays a list of recently typed commands in a pop-up window in the command shell. Use the up and down arrows to select a previously typed command, and then press Enter to execute the selected command.
F8Moves backward through the command history with commands that match the text that has been entered at the command prompt.
F9Prompts for a command number and executes the specified command from the command history (command numbers refer to the F7 command list).
TabAuto-completes command-line sequences. Use the Shift+Tab sequence to move backward through a list of potential matches.

Luckily, most of the features in Table 1 are native to the cmd command prompt, which makes PowerShell adoption easier for administrators already familiar with the Windows command line. The only major difference is that the Tab key auto-completion is enhanced in PowerShell beyond what’s available with the cmd command prompt.

As with the cmd command prompt, PowerShell performs auto-completion for file and directory names. So, if you enter a partial file or directory name and press Tab, PowerShell returns the first matching file or directory name in the current directory. Pressing Tab again returns a second possible match and enables you to cycle through the list of results. Like the cmd command prompt, PowerShell’s Tab key auto-completion can also auto-complete with wildcards. The difference between Tab key auto-completion in cmd and PowerShell is that PowerShell can auto-complete commands. For example, you can enter a partial command name and press the Tab key, and PowerShell steps through a list of possible command matches.

PowerShell can also auto-complete parameter names associated with a particular command. Simply enter a command and partial parameter name and press the Tab key, and PowerShell cycles through the parameters for the command that has been specified. This method also works for variables associated with a command. In addition, PowerShell performs auto-completion for methods and properties of variables and objects.

Other -----------------
- Windows Server 2008 R2 : Using Windows PowerShell (part 5) - Using Remoting & Using the New-Object Cmdlet
- Windows Server 2008 R2 : Using Windows PowerShell (part 4) - Using Snap-Ins & Using Modules
- Windows Server 2008 R2 : Using Windows PowerShell (part 3) - Managing Processes
- Windows Server 2008 R2 : Using Windows PowerShell (part 2) - Gathering Event Log Information
- Windows Server 2008 R2 : Using Windows PowerShell (part 1) - Exploring PowerShell
- Windows Server 2008 R2 : Automating Tasks Using PowerShell Scripting - Introduction to PowerShell
- Windows Server 2008 R2 : Automating Tasks Using PowerShell Scripting - Understanding Shells
- Windows Server 2003 : Using DNS Monitoring Tools (part 2) - Monitoring DNS Performance with System Monitor
- Windows Server 2003 : Using DNS Monitoring Tools (part 1) - Using Replication Monitor
- Windows Server 2003 : Using DNS Troubleshooting Tools (part 3) - DNS Debug Log
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server