Skip to main content

A Task-Based Guide to Windows PowerShell Cmdlets

Cmdlets are the heart-and-soul of Windows PowerShell, Microsoft's latest command shell/scripting language. This series provides a task-based introduction to Windows PowerShell cmdlets: Rather than focusing on the individual cmdlets themselves, the emphasis is on the tasks you can carry out using those cmdlets. These tasks include everything from reading and writing text files to managing event logs to sorting and filtering data.

As is so often the case with Windows PowerShell, the code snippets found in these articles can either be included within a Windows PowerShell script or typed directly into the Windows PowerShell console.

Dates and Times

These tasks include such things as retrieving the current date and time, and performing date arithmetic.

Files and Folders

These tasks include such things as creating, renaming, copying, and deleting files and folders.

Copy Files or Folders
Create a New File or Folder
Delete a File or Folder (Or Other Objects)
Move a File or Folder
Rename a File or Folder
Replicate (and Extend) the DIR Command
Retrieve a Specific Item
Verify the Existence of a File or Folder

Help and Information

These tasks include such things as listing Windows PowerShell version information and using the Get-Member cmdlet to retrieve property and method information for an object.

Get Help
List All the Windows PowerShell Cmdlets
List Windows PowerShell Version Information
List the Properties and Methods of a Command or Object
List Your Installed Windows PowerShell Providers

Saving and Importing Data

These tasks include such things as reading and writing to text files as well as saving data in HTML or XML format.

Append Data to a Text File
Check for the Existence of a String Value
Display and Save Data With One Command
Erase the Contents of a File
Output as HTML
Read a Text File
Read in a Comma-Separated Values File
Read in an XML File
Save Data as a Comma-Separated Values File
Save Data as an XML File
Save Data Directly to a Text File
Save Data to a Text File

Scripting Techniques

These techniques include such things as sorting data, filtering data, and prompting a user to enter information.

Arrange Data Into Groups
Calculate Basic Statistics
Compare Two Objects or Text Files
Display Data as a List
Display Data in Multiple Columns
Filter Returned Data
List the Unique Members of a Collection
List the Values in a Registry Key
Loop Through a Collection of Objects
Pause a Windows PowerShell Script
Print Returned Data
Prompt a User to Enter Information
Select Only Specified Properties of an Object
Sort Returned Data
View Data One Screen at a Time
Write a Warning Message to the Console Window
Write Messages to the Console Window

Security and Security Descriptors

These tasks include such things as configuring the Windows PowerShell script execution policy and retrieving the digital signature or security descriptor from a file or folder.

System Administration Tasks

These tasks include such things as starting and stopping services, retrieving data using WMI, and managing event logs and event log events.

Windows PowerShell Aliases

These tasks include such things as retrieving and remapping existing aliases as well as creating new aliases.

Windows PowerShell Sessions

These tasks include such things as retrieving the Windows PowerShell history and re-invoking a command contained within that history.  

Scripts and Applications

These tasks include such things as running scripts and/or applications as well as measuring how long it takes a Windows PowerShell task to complete.

Microsoft führt eine Onlineumfrage durch, um Ihre Meinung zur -Website zu erfahren. Wenn Sie sich zur Teilnahme entscheiden, wird Ihnen die Onlineumfrage angezeigt, sobald Sie die -Website verlassen.

Möchten Sie teilnehmen?