Section B.1. Standard Cmdlets


B.1. Standard Cmdlets

The sections that follow have been separated into groups based on the subject of the cmdlet. Remember that get-help supports wildcard syntax, so it is easy to find commands related to a specific cmdlet. For example, to find commands related to get-object, type get-help *-object.

B.1.1. System

Cmdlet

Description

get-command

Returns a list of available commands

invoke-command

Invokes the command specified by the given string (as if it were typed at the prompt)

get-host

Returns information about the MSH host

get-culture

Returns information about the regional settings of the host (as defined in the Regional Settings of the Control Panel)

get-help

Provides built-in help functionality

get-uiculture

Returns information about the regional settings of the host as defined by the selected language on a multi-language operating system


B.1.2. Objects

Cmdlet

Description

foreach-object

Applies script blocks to each object in the pipeline

where-object

Filters the input from the pipeline, allowing operation on only certain objects

get-member

Enumerates properties, methods, type info, and property sets of the objects given to it

new-object

Instantiates a new .NET or COM object

select-object

Selects objects based on parameters set in the cmdlet command string

group-object

Collects objects together based on a common property value

sort-object

Arranges objects in sequence based on a property value


B.1.3. History

Cmdlet

Description

get-history

Returns a list of session history

invoke-history

Invokes an entry from the session history

add-history

Adds an entry to the session history


B.1.4. Cmdlet Providers

Cmdlet

Description

new-drive

Creates a new drive associated with a cmdlet provider

get-provider

Returns a list of all registered cmdlet providers and the drives associated with each provider


B.1.4.1. Drives

Cmdlet

Description

remove-drive

Removes a drive association from a cmdlet provider

get-drive

Returns a list of all drives registered with cmdlet providers


B.1.4.2. Paths and locations

Cmdlet

Description

combine-path

Combines path elements into a single path

convert-path

Converts the path to the item given from an MSH path to a provider path

parse-path

Given an MSH path(s), streams a string with the qualifier, parent path, or leaf item

test-path

Returns true if the path exists, otherwise returns false

resolve-path

Resolves the wildcards in a path

get-location

Displays the current location

set-location

Sets the current working location to a specified location

push-location

Pushes a location to the stack

pop-location

Changes the current working location to the location specified by the last entry pushed onto the stack


B.1.4.3. Properties

Cmdlet

Description

get-property

Retrieves the properties of an object

move-property

Moves a property from one location to another

copy-property

Copies a property between locations or namespaces

clear-property

Removes the property value from a property

new-property

Sets a new property of an item at a location

remove-property

Removes a property and its value from the location

rename-property

Renames a property at its location

set-property

Sets a property at the specified location to a specified value


B.1.4.4. Items

Cmdlet

Description

get-item

Returns an object that represents an item in a namespace

new-item

Creates a new item in a namespace

set-item

Sets the value of a pathname within a provider to the specified value

remove-item

Deletes an item from a provider

move-item

Transfers an item from one location to another, removing the original

rename-item

Changes the name of an existing item

copy-item

Copies an item from one location to another, leaving the original intact

clear-item

Removes the content of an item

invoke-item

Invokes an executable or opens a file

get-childitem

Retrieves the child items of the specified location(s) in a drive

get-acl

Gets the access control list (ACL) associated with a file or item

set-acl

Sets the security ACL for an item or items


B.1.4.5. Content

Cmdlet

Description

add-content

Appends content to a file or creates a file if one does not exist

clear-content

Removes content from a file while leaving the file intact

get-content

Returns the content of a file as a sequence of lines

set-content

Replaces the content of a file with new content


B.1.5. Operating System Components

Cmdlet

Description

get-eventlog

Returns a list of event log entries from a specified event log

get-wmiobject

Returns data from WMI

get-process

Returns a list of running system processes

stop-process

Terminates a running process

get-service

Returns a list of registered system services

stop-service

Terminates a running system service

start-service

Starts a stopped system service

suspend-service

Pauses a running system service

resume-service

Reactivates a paused system service

restart-service

Stops then restarts a system service

set-service

Configures the properties of a registered system service

new-service

Registers a new system service


B.1.6. Output Formatters

Cmdlet

Description

format-list

Formats objects as a list of their properties displayed vertically

format-table

Formats objects as a tabulated list (one line per object)

format-wide

Formats objects as a tabulated list (several objects per line)

out-null

Drops all output

out-default

Sends output to the host; not called from the command line

out-host

Sends output to the host

out-file

Sends output to a file

out-printer

Sends output to a printer

out-string

Sends output to a string

import-csv

Generates a sequence of objects from a comma-separated variable file

export-csv

Writes a sequence of objects to a file in comma-separated form


B.1.7. Aliases

Cmdlet

Description

set-alias

Maps an alias to a command

get-alias

Returns a list of all defined aliases

new-alias

Creates a new alias

export-alias

Outputs the system alias table in CSV format

import-alias

Updates the system alias table from a CSV file


B.1.8. Miscellaneous

Cmdlet

Description

get-date

Returns the current date and time

set-date

Updates the system date and time

match-string

Searches through a string or file(s) for a pattern

measure-object

Calculates arithmetical statistics on specific properties of pipeline objects

new-timespan

Calculates the time difference between two specified DateTime objects

start-sleep

Pauses processing for a specified number of seconds or milliseconds


B.1.9. Variables

Cmdlet

Description

get-variable

Returns the value of a variable

new-variable

Creates a new variable with a specified name and value

set-variable

Updates or creates a new variable with a specified name and value; useful at the end of a pipeline for storing objects into a variable for later use

remove-variable

Removes a variable definition from the variable list

clear-variable

Removes the value of a variable but leaves its definition in place ( i.e., sets its value to null)


B.1.10. Input/Output

Cmdlet

Description

write-host

Writes an object to the hosting environment (usually the console)

write-progress

Writes to the host's progress display channel

write-object

Writes an object to the pipeline

write-debug

Writes an object into the debug pipeline

write-verbose

Writes an object to the host's verbose display channel; output may or may not be shown depending on the host settings

write-error

Writes an object to the error pipeline

read-host

Reads data from the hosting environment (usually the console)


B.1.11. Security

Cmdlet

Description

get-pfxcertificate

Returns an X509Certificate from a file

get-credential

Generates a credential by asking an interactive user to provide a password

get-authenticodesignature

Returns the Authenticode signature from a file

set-authenticodesignature

Updates the Authenticode signature on a file

new-securestring

Creates a string that can be used to safely store and work with sensitive information (e.g., passwords)

export-securestring

Converts a secure string into an encrypted representation in a regular string

import-securestring

Converts an encrypted string back into a secure string


B.1.12. Debugging

Cmdlet

Description

set-mshdebug

Enables/disables debugging and execution trace support

trace-expression

Enables tracing for a specified expression or command





Monad Jumpstart
Monad Jumpstart
ISBN: N/A
EAN: N/A
Year: 2005
Pages: 117

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net