By
Lee
Price: $12.99 USD
£7.99 GBP
[ Symbols ], [ A ], [ B ], [ C ], [ D ], [ E ], [ F ], [ G ], [ H ], [ I ], [ J ], [ K ], [ L ], [ M ], [ N ], [ O ], [ P ], [ Q ], [ R ], [ S ], [ T ], [ U ], [ V ], [ W ], [ X ], [ Y ], [ Z ],
Symbols[ Top ]
& (ampersand), invoke/call operator, 60
<...> (angle brackets), in regular expressions, 83
* (asterisk)
*=, multiplication assignment, 35
multiplication operator, 34
in regular expressions, 82
*?, in regular expressions, 82
@ (at sign)
@(...)
array definition, 28
list evaluation control, 21
@{...}, hashtable definition, 32
@"..."@, here strings, 25
\ (backslash), in regular expressions, 88, 89
` (backtick), preceding escape sequences, 25
^ (caret), in regular expressions, 80, 81, 85
: (colon), format specifier, 141
, (comma), format specifier, 131
# (comment character), 21, 88
{...} (curly braces)
@{...}, hashtable definition, 32
in regular expressions, 81, 82, 83
statement block, 43
in variable definition, 22
$ (dollar sign)
$(...), expression subparse control, 20
in regular expressions, 85, 86
$$, in regular expressions, 86
$&, in regular expressions, 86
$`, in regular expressions, 87
$`, in regular expressions, 87
$+, in regular expressions, 87
$_, in regular expressions, 87
in variable definition, 22
(see also automatic variables)
. (dot)
format specifier, 131
method and property access, 7
in regular expressions, 80
script invocation, 61
" (double quote), escape sequence for, 26
"..." (double quotes), expanding strings, 24
= (equals sign)
+=, addition assignment, 35
/=, division assignment, 35
%=, modulus assignment, 35
*=, multiplication assignment, 35
-=, subtraction assignment, 35
! (exclamation point), logical NOT operator, 36
- (hyphen), in regular expressions, 80, 81
- (minus sign)
-=, subtraction assignment, 35
subtraction operator, 34
(...) (parentheses)
@(...)
array definition, 28
list evaluation control, 21
$(...), expression subparse control, 20
precedence control, 20
in regular expressions, 83
% (percent sign)
format specifier, 131
%=, modulus assignment, 35
modulus operator, 35
+ (plus sign)
+=, addition assignment, 35
addition operator, 34
in array ranges, 31
in regular expressions, 82
+?, in regular expressions, 82
# (pound sign), format specifier, 131
? (question mark)
in regular expressions, 82, 83, 87, 88
??, in regular expressions, 83
?:, in regular expressions, 84
?=, in regular expressions, 84
?!, in regular expressions, 84
?<=, in regular expressions, 85
?<!, in regular expressions, 85
?>, in regular expressions, 85
?#, in regular expressions, 88
> (right angle bracket), output redirection, 72
; (semicolon), format specifier, 132
' (single quote), escape sequence for, 26
'...' (single quotes), literal strings, 24
/ (slash)
format specifier, 141
/=, division assignment, 35
division operator, 35
[...] (square brackets)
array access using, 30
in regular expressions, 80, 81
in variable definition, 22
| (vertical bar)
pipeline character, 8
in regular expressions, 87
0 format specifier, 131
0x prefix, 27
A[ Top ]
\A, in regular expressions, 85
\a, in regular expressions, 89
Access.Application object, 124
Active Directory Service Interfaces (ADSI) support, 15
Active Directory, .NET classes for, 109
Add verb, 95
addition assignment operator (+=), 35
addition operator (+), 34
Add-Member cmdlet, 57-59
administrative tasks, support for, 8, 27
ADSI (Active Directory Service Interfaces) support, 15
Adsi type shortcut, 55
Agent.Control object, 124
alarm character, escape sequence for, 26
aliases for cmdlets, 6
AliasProperty type, Add-Member cmdlet, 57
Alt + F7 hotkey, 77
Alt + space, c hotkey, 76
Alt + space, e, f hotkey, 76
Alt + space, e, k hotkey, 76
Alt + space, e, l hotkey, 76
Alt + space, e, p hotkey, 76
alternation constructs, in regular expressions, 87
ampersand (&), invoke/call operator, 60
-and (logical AND operator), 36
angle brackets (<...>), in regular expressions, 83
AppDomain class, 103
arbitrary variables, defining, 22
$args automatic variable, 61, 62, 90
argument array for script input, 61
arithmetic operators, 34-35
Array class, 102
array definition (@(...)), 28
ArrayList class, 102
arrays
accessing elements of, 30
argument array for script input, 61
associative (hashtables), 32
data type of, 29
defining, 28, 31
numbering of elements in, 30
ranges in, accessing, 30, 31
slicing, 31
-as (type conversion operator), 39
assemblies, 56
Assembly class, 56, 103
assignment operators, 35
associative arrays (hashtables), 32
asterisk (*)
*=, multiplication assignment, 35
multiplication operator, 34
in regular expressions, 82
*?, in regular expressions, 82
at sign (@)
@(...)
array definition, 28
list evaluation control, 21
@{...}, hashtable definition, 32
@"..."@, here strings, 25
atomic zero-width assertions, in regular expressions, 85
auto-complete for cmdlets, 6
AutoHotkey program, 77
AutoItX3.Control object, 124
automatic variables, 90-94
B[ Top ]
\B, in regular expressions, 86
\b, in regular expressions, 86, 89
backreference constructs, in regular expressions, 88
backslash (\), in regular expressions, 88, 89
backspace character, escape sequence for, 26
backtick (`), preceding escape sequences, 25
Backup verb, 97
-band (binary AND operator), 37
begin keyword in scripts, 63
begin statement, 63
binary AND operator (-band), 37
binary exclusive OR operator (-bxor), 37
binary NOT operator (-bnot), 38
binary numbers, conversion to and from, 28
binary operators, 36-38
binary OR operator (-bor), 37
BinaryReader class, 104
BinaryWriter class, 104
Bitmap class, 106
Block verb, 100
-bnot (binary NOT operator), 38
Boolean values, comparing, 35
Boolean variables, 23
-bor (binary OR operator), 37
braces (see curly braces)
brackets (see square brackets)
break keyword, 69
break statement, 50
BufferedStream class, 104
-bxor (binary exclusive OR operator), 37
C[ Top ]
-c option, switch statement, 45
-c prefix, for comparison operators, 39
C format specifier, 129
%c format specifier, 142
c format specifier, 129
calendar calculations, 8
cancel, 76
caret (^), in regular expressions, 80, 81, 85
carriage return, escape sequence for, 26
case sensitivity
for comparison operators, 39
in regular expressions, 88
in switch statement, 45
-casesensitive option, switch statement, 45
\cC, in regular expressions, 89
cd command, 4
CEnroll.CEnroll object, 124
certificate store, navigating, 17
CertificateAuthority.Request object, 124
character classes, for regular expressions, 80
character escapes, in regular expressions, 89
Checkpoint verb, 97
CIM_DataFile class, 112
classes
assembly for, 56
character classes, for regular expressions, 80
extending, 57-59
information about, 54
instances of, creating, 56
shortcuts for, 55
WMI classes, 112-123
(see also .NET Framework classes)
Clear verb, 95
cmdlets, 5-6
aliases for, 6
auto-complete feature for, 6
in scripts, 12
naming, with PowerShell verbs, 95-100
positional parameters for, 6
CodeMethod type, Add-Member cmdlet, 58
CodeProperty type, Add-Member cmdlet, 57
collections, classes for, 102
colon (:), format specifier, 141
COM objects, 16, 57, 124-127
COMAdmin.COMAdminCatalog object, 124
comma (,), format specifier, 131
command history, 76
command line, 76
commands
as tokens, 20
DOS, 3
evaluation of, controlling, 20
formatting output for, 69-71
information about, finding, 11
linking (see pipelines)
objects generated by, 7
output of, capturing, 72-73
seeing effects of, before running, 10
Unix, 3
verbose output from, 74
commands, PowerShell (see cmdlets)
comment character (#), 21, 88
comments
in regular expressions, 88
in scripts, 21
comments regarding this book, x
communication, verbs for, 97
-ComObject parameter, New-Object cmdlet, 57
Compare verb, 97
comparison operators, 39-42
composable commands (see pipelines)
conditional statements, 43-47
if statement, 43
switch statement, 44-47
configuration files
for extending types, 59
for output formatting, 71
Confirm parameter, 10
$confirmPreference automatic variable, 90
Connect verb, 97
console
closing, 76
customizing, 75-77
Console class, 102
$consoleFilename automatic variable, 90
contact information for this book, x
-contains operator, 42
Continue ErrorAction preference, 68
continue keyword, 69
continue statement, 51
Continue verbose preference, 74
Control + break hotkey, 76
Control + c hotkey, 76
Control + end hotkey, 76
Control + home hotkey, 76
Control + left arrow hotkey, 76
Control + right arrow hotkey, 76
Convert class, 101
Convert verb, 97
ConvertFrom verb, 97
ConvertTo verb, 97
Copy verb, 95
CSharpCodeProvider class, 103
curly braces ({...})
@{...}, hashtable definition, 32
in regular expressions, 81, 82, 83
statement block, 43
in variable definition, 22
$currentlyExecutingCommand automatic variable, 91
customization
hotkeys, 75-77
of console, 75-77
profiles, 77
prompt, 78
QuickEdit mode, 75
tab completion, 79
window size, 75
customization files
for output formatting, 71
for types, 59
D[ Top ]
D format specifier, 129, 133
d format specifier, 129, 133, 135
\D, in regular expressions, 81
\d, in regular expressions, 81
data type conversions, 28
operator for, 39
to integer, 23
data types
comparing, 42
for formal parameters, 62
of array elements, 29
strongly typed variables, defining, 22
XML, 32
data, verbs for, 97
database, .NET classes for, 109
DataSet class, 109
DataTable class, 109
date calculations, 8
DateTime class, 101
DateTime format strings, 133-142
dd format specifier, 136
ddd format specifier, 136
\ddd, in regular expressions, 89
dddd format specifier, 136
Debug class, 102
Debug verb, 99
debugging, 73
$debugPreference automatic variable, 91
decimal numbers, conversion to and from, 28
DeflateStream class, 105
diagnostics, verbs for, 99
dir command, 4
Directory class, 104
DirectoryEntry class, 55, 109
DirectoryInfo class, 104
DirectorySearcher class, 109
Disable verb, 99
Disconnect verb, 97
Dismount verb, 98
division assignment operator (/=), 35
division operator (/), 35
Dns class, 107
do until statement, 49
do while statement, 49
dollar sign ($)
$(...), expression subparse control, 20
in regular expressions, 85, 86
$$, in regular expressions, 86
$&, in regular expressions, 86
$`, in regular expressions, 87
$`, in regular expressions, 87
$+, in regular expressions, 87
$_, in regular expressions, 87
in variable definition, 22
(see also automatic variables)
DOS commands, 3
dot (.)
format specifier, 131
method and property access, 7
in regular expressions, 80
script invocation, 61
dot-sourcing scripts, 61
double quote ("), escape sequence for, 26
double quotes ("..."), expanding strings, 24
Down arrow hotkey, 76
E[ Top ]
-e option, switch statement, 45
E format specifier, 129
e format specifier, 129
E+0 format specifier, 132
e+0 format specifier, 132
\e, in regular expressions, 89
E-0 format specifier, 132
E0 format specifier, 132
e-0 format specifier, 132
e0 format specifier, 132
-ed (equality operator), 40
else statement, 43
elseif statement, 43
Enable verb, 99
End hotkey, 76
end keyword in scripts, 63
end statement, 63
Enum class, 102
Environment class, 101
equals sign (=)
+=, addition assignment, 35
/=, division assignment, 35
%=, modulus assignment, 35
*=, multiplication assignment, 35
-=, subtraction assignment, 35
equality operator (-ed), 40
$error automatic variable, 91
error codes returned from scripts, 64
error output stream, 67
ErrorAction parameter for cmdlets, 68
$ErrorActionPreference automatic variable, 68
$errorActionPreference automatic variable, 91
errors
nonterminating, 67
terminating, 68
$errorView automatic variable, 91
escape sequences
in regular expressions, 89
in strings, 25
evaluation controls, 20
EventLog class, 102
-exact option, switch statement, 45
Excel.Application object, 124
Excel.Sheet object, 124
exceptions
generated as a terminating error, 68
trapping, 69
exclamation point (!), logical NOT operator, 36
execution policy, 61
$executionContext automatic variable, 91
exit statement, 64
expanding strings, 24
explicit capture, in regular expressions, 88
Export verb, 98
expression subparse control ($(...)), 20
expressions, 20
evaluation of, controlling, 20
in expanding strings, 25
F[ Top ]
-f format operator, 39, 128-132
F format specifier, 129, 133, 137
f format specifier, 129, 133, 136
\f, in regular expressions, 89
F1 hotkey, 76
F2 hotkey, 76
F3 hotkey, 77
F4 hotkey, 77
F5 hotkey, 77
F7 hotkey, 77
F8 hotkey, 77
F9 hotkey, 77
$false automatic variable, 91
FF format specifier, 137
ff format specifier, 136
FFF format specifier, 137
fff format specifier, 136
FFFF format specifier, 137
ffff format specifier, 136
FFFFF format specifier, 138
fffff format specifier, 136
FFFFFF format specifier, 138
ffffff format specifier, 137
FFFFFFF format specifier, 138
fffffff format specifier, 137
File class, 104
FileInfo class, 104
files
command output in, 72
getting and setting content as variables, 22
filesystem, navigating, 17
FileSystemSecurity class, 106
FileSystemWatcher class, 105
flow control statements
break statement, 50
continue statement, 51
in expression subparse, 20
FlowLayoutPanel class, 106
for statement, 47
$foreach automatic variable, 91
foreach statement, 48
Form class, 106
form feed, escape sequence for, 26
formal parameters for script input, 62
format operator (-f), 39
$formatEnumerationLimit automatic variable, 91
Format-List cmdlet, 70
.Format.Ps1Xml file extension, 71
Format-Table cmdlet, 70
formatting command output, 69-71
formatting files, 71
formatting strings (see string formatting)
Format-Wide cmdlet, 71
FtpWebRequest class, 107
functions, 60, 65
location of, in scripts, 66
running, 66, 67
(see also scripts)
G[ Top ]
G format specifier, 129, 134
g format specifier, 129, 133
\G, in regular expressions, 86
%g format specifier, 138
gb (gigabyte) constant, 8, 27
-ge (greater than or equal operator), 40
Get verb, 95
Get-Command cmdlet, 11
Get-Help cmdlet, 11
Get-History cmdlet, 13
Get-Item Variable cmdlet, 23
Get-Member cmdlet, 11, 54
Get-Process cmdlet, 5
Get-TraceSource cmdlet, 74
Get-Variable cmdlet, 23
gg format specifier, 138
gigabyte (gb) constant, 8, 27
gps alias, 6
Grant verb, 100
greater than operator (-gt), 40
greater than or equal operator (-ge), 40
grouping constructs, in regular expressions, 83
-gt (greater than operator), 40
Guid class, 101
GZipStream class, 105
H[ Top ]
%H format specifier, 139
%h format specifier, 138
Hashtable class, 55
hashtable definition (@{...}), 32
Hashtable type shortcut, 55
hashtables, 32
here strings, 21, 25
hexadecimal base, 27
hexadecimal numbers, conversion to and from, 28
HH format specifier, 139
hh format specifier, 139
Hide verb, 95
history buffer, 13
history of commands, 76
HNetCfg.FwMgr object, 125
HNetCfg.HNetShare object, 125
$home automatic variable, 91
Home hotkey, 76
$host automatic variable, 91
hotkeys, 75-77
HTMLFile object, 125
HttpUtility class, 107
HttpWebRequest class, 107
hyphen (-), in regular expressions, 80, 81
I[ Top ]
-i prefix, for comparison operators, 39
I/O (Input/Output), .NET classes for, 104
if statement, 43
Image class, 106
Import verb, 98
InfoPath.Application object, 125
Initialize verb, 98
input (script)
argument array for, 61
formal parameters for, 62
pipeline for, 62
$input automatic variable, 62, 91
Input/Output (I/O), .NET classes for, 104
Inquire ErrorAction preference, 68
Inquire verbose preference, 74
Install verb, 99
instance methods, calling, 52
instance properties, accessing, 53
int data type, conversions to, 23
interactive shell, 2-5
InternetExplorer.Application object, 125
Invoke verb, 99
invoke/call operator (&), 60
ipconfig tool, 5
-is (type operator), 42
-isnot (negated type operator), 42
IXSSO.Query object, 125
IXSSO.Util object, 125
J[ Top ]
jagged arrays, 29
Join verb, 96
K[ Top ]
K format specifier, 139
\k, in regular expressions, 88
kb (kilobyte) constant, 27
kilobyte (kb) constant, 27
L[ Top ]
$LastExitCode automatic variable, 65
$lastExitCode automatic variable, 92
-le (less than or equal operator), 41
Left arrow hotkey, 76
LegitCheckControl.LegitCheck object, 125
less than operator (-lt), 41
less than or equal operator (-le), 41
lifecycles, verbs for, 99
-like operator, 41
Limit verb, 98
list evaluation control (@(...)), 21
lists
evaluating expressions as, 21
(see also arrays)
literal strings, 24
LoadWithPartialName method, Assembly class, 56
Lock verb, 96
$logCommandHealthEvent automatic variable, 92
$logCommandLifecycleEvent automatic variable, 92
$logEngineHealthEvent automatic variable, 92
$logEngineLifecycleEvent automatic variable, 92
logic statements, in expression subparse, 20
logical AND operator (-and), 36
logical exclusive OR operator (-xor), 36
logical NOT operator (-not or !), 36
logical operators, 35
logical OR operator (-or), 36
$logProviderHealthEvent automatic variable, 92
$logProviderLifecycleEvent automatic variable, 92
looping statements, 47-51
do until statement, 49
do while statement, 49
for statement, 47
foreach statement, 48
halting execution of, 50
skipping execution of current statement block, 51
while statement, 49
-lt (less than operator), 41
M[ Top ]
M format specifier, 134, 140
m format specifier, 134, 139
MailAddress class, 107
MailMessage class, 107
MakeCab.MakeCab object, 125
ManagementClass class, 55, 108
ManagementDateTimeConverter class, 108
ManagementEventWatcher class, 109
ManagementObject class, 55, 108
ManagementObjectSearcher class, 55, 108
MAPI.Session object, 125
Marshal class, 103
-match operator, 42
$matches automatic variable, 92
Math class, 101
$maximumAliasCount automatic variable, 92
$maximumDriveCount automatic variable, 92
$maximumErrorCount automatic variable, 92
$maximumFunctionCount automatic variable, 93
$maximumHistoryCount automatic variable, 93
$maximumVariableCount automatic variable, 93
mb (megabyte) constant, 8, 27
Measure verb, 99
megabyte (mb) constant, 8, 27
MemoryStream class, 104
Merge verb, 98
MessageQueue class, 110
Messenger.MessengerApp object, 125
methods
accessing, 7
adding to types, 57-59
instance, calling, 52
listing for types or classes, 54
static, calling, 52
Microsoft.FeedsManager object, 125
Microsoft.ISAdm object, 125
Microsoft.Update.AutoUpdate object, 125
Microsoft.Update.Installer object, 125
Microsoft.Update.Searcher object, 125
Microsoft.Update.Session object, 126
Microsoft.Update.SystemInfo object, 126
minus sign (-)
-=, subtraction assignment, 35
subtraction operator, 34
MM format specifier, 140
mm format specifier, 140
MMC20.Application object, 126
MMM format specifier, 140
MMMM format specifier, 140
modulus assignment operator (%=), 35
modulus operator (%), 35
Mount verb, 98
Move verb, 96
MSScriptControl.ScriptControl object, 126
Msxml2.XSLTemplate object, 126
multidimensional arrays, 29
multiplication assignment operator (*=), 35
multiplication operator (*), 34
$myInvocation automatic variable, 64, 93
N[ Top ]
N format specifier, 129
n format specifier, 129
\n, in regular expressions, 89
-ne (negated equality operator), 40
negated contains operator (-notcontains), 42
negated equality operator (-ne), 40
negated like operator (-notlike), 41
negated match operator (-notmatch), 42
negated type operator (-isnot), 42
$nestedPromptLevel automatic variable, 93
.NET Framework, 52
documentation for, 54
methods, calling, 52
objects (see objects)
properties, accessing, 53
types and classes
creating instances of, 56
extending, 57-59
information about, 54
shortcuts for, 55
.NET Framework classes, 103
Active Directory, 109
collections, 102
database, 109
I/O (Input/Output), 104
image manipulation, 106
message queuing, 110
networking, 106
PowerShell object, 101
registry, 103
security, 105
transactions, 110
user interface, 106
utilities, 101
WMI, 108
XML, 107
NetworkCredential class, 106
networking, .NET classes for, 106
New verb, 96
New-Item Variable cmdlet, 23
newline, escape sequence for, 26
New-Object cmdlet, 56, 57
New-Variable cmdlet, 23
nonterminating errors, 67
-not (logical NOT operator), 36
not equal operator (see negated equality operator)
-notcontains (negated contains operator), 42
notepad tool, 5
NoteProperty type, Add-Member cmdlet, 58
-notlike (negated like operator), 41
-notmatch (negated match operator), 42
$null automatic variable, 93
null character, escape sequence for, 26
numbers, 26-28
assigning to variables, 26
bases for, 27
numeric constants, 27
numeric format strings, 128-132
O[ Top ]
o format specifier, 134
objects, 7
in scripts, 12
methods of, accessing, 7
output generating, 7
properties of, accessing, 7
objects, COM (see COM objects)
octal numbers, conversion to and from, 28
OdbcCommand class, 109
OdbcConnection class, 109
OdbcDataAdapter class, 109
$ofs automatic variable, 93
operators, 34-42
arithmetic, 34-35
binary, 36-38
comparison, 39-42
logical, 35
Operators, binary, 36
-or (logical OR operator), 36
OrderedDictionary class, 102
Out verb, 98
Outlook.Application object, 126
OutlookExpress.MessageList object, 126
output (command)
capturing, 72-73
formatting, 69-71
objects generated by, 7
output (script)
exit statement for, 64
pipeline for, 64
return statement for, 64
output, .NET classes for, 104
$outputEncoding automatic variable, 93
Out-String cmdlet, 72
-OutVariable parameter, 72
P[ Top ]
P format specifier, 130
p format specifier, 130
\P, in regular expressions, 81
\p, in regular expressions, 81
Page Down hotkey, 76
Page Up hotkey, 76
parameters
for cmdlets, 6
for script input, 62
parentheses ((...))
@(...)
array definition, 28
list evaluation control, 21
$(...), expression subparse control, 20
precedence control, 20
in regular expressions, 83
PasswordDeriveBytes class, 106
Path class, 104
percent sign (%)
format specifier, 131
%=, modulus assignment, 35
modulus operator, 35
$pid automatic variable, 93
Ping verb, 99
pipeline character (|), 8
pipelines, 8
as script input, 62
as script output, 64
plus sign (+)
+=, addition assignment, 35
addition operator, 34
in array ranges, 31
in regular expressions, 82
+?, in regular expressions, 82
Pop verb, 96
popd command, 4
positional parameters, 6
pound sign (#)
comment character, 21
format specifier, 131
PowerPoint.Application object, 126
PowerShell, 1
as interactive shell, 2-5
documentation for, 101
.NET class representing, 101
prompt for, 3
starting, 3, 76
technologies supported by, 14-16
PowerShell verbs, 95-100
PowerShell window, closing, 76
PowerShell.exe file, 2
precedence control ((...)), 20
Process class, 102
process keyword in scripts, 63
process statement, 63
$profile automatic variable, 78, 93
profiles, 77
$progressPreference automatic variable, 93
prompts, customizing, 78
properties
accessing, 7
adding to types, 57-59
instance, accessing, 53
listing for types or classes, 54
static, 53
PropertySet type, Add-Member cmdlet, 58
providers, 17
PS > prompt, 3
PsBase, 33
$psHome automatic variable, 93
.psl file extension, 60
PSObject class, 55, 101
PSObject type shortcut, 55
PSReference class, 55
Publish verb, 98
Publisher.Application object, 126
Push verb, 96
pushd command, 4
$pwd automatic variable, 93
pwd command, 4
Q[ Top ]
quantifiers, in regular expressions, 82
question mark (?)
in regular expressions, 82, 83, 87, 88
??, in regular expressions, 83
?:, in regular expressions, 84
?=, in regular expressions, 84
?!, in regular expressions, 84
?<=, in regular expressions, 85
?<!, in regular expressions, 85
?>, in regular expressions, 85
?#, in regular expressions, 88
questions regarding this book, x
QuickEdit mode, 75
R[ Top ]
-r option, switch statement, 45
R format specifier, 130, 134
r format specifier, 130, 134
\r, in regular expressions, 89
Random class, 101
RDS.DataSpace object, 126
Read verb, 97
Receive verb, 97
Ref type shortcut, 55
-regex option, switch statement, 45
Regex class, 55, 102
Regex type shortcut, 55
Registry class, 103
registry, navigating, 17
RegistryKey class, 103
RegistrySecurity class, 106
regular expressions, 80
alternation constructs, 87
atomic zero-width assertions, 85
backreference constructs, 88
case sensitivity in, 88
character classes, 80
character escapes, 89
comments, 88
explicit capture in, 88
grouping constructs, 83
in switch statement, 45
matching, 42
quantifiers, 82
substitution patterns, 86
whitespace in, ignoring, 88
Remove verb, 96
Rename verb, 96
-replace operator, 38
Resolve verb, 99
Restart verb, 100
Restore verb, 98
Resume verb, 100
return statement, 64
return, escape sequence for, 26
reusability (see functions; scripts)
Revoke verb, 100
right angle bracket (>), output redirection, 72
Right arrow hotkey, 76
S[ Top ]
s format specifier, 134, 140
\S, in regular expressions, 81
\s, in regular expressions, 81
Safari, xi
SAPI.SpVoice object, 126
scope of variables, 22, 65
screen buffer
accessing, 76
size, adjusting, 75
script blocks, 67
ScriptBlock class, 55
ScriptBlock type shortcut, 55
Scripting.FileSystemObject object, 126
Scripting.Signer object, 126
Scriptlet.TypeLib object, 126
ScriptMethod type, Add-Member cmdlet, 59
ScriptProperty type, Add-Member cmdlet, 58
ScriptPW.Password object, 126
scripts, 60
argument array as input for, 61
commands in, 12
context of invocation, 64
dot-sourcing, 61
error code output from, 64
exit statement output, 64
formal parameters as input for, 62
naming, with PowerShell verbs, 95-100
objects in, 12
pipeline input for, 62
pipeline output for, 64
return statement output, 64
run at startup (see profiles)
running, 60
statement blocks in, 63
writing, 60
writing using history buffer, 13
(see also functions)
Search verb, 96
SecureString class, 105
security, .NET classes for, 105
security, verbs for, 100
Select verb, 96
semicolon (;), format specifier, 132
Send verb, 97
SerialPort class, 107
Set verb, 96
Set-ExecutionPolicy cmdlet, 61
Set-PsDebug cmdlet, 73
SHA1 class, 106
SharePoint.OpenDocuments object, 127
shell (see PowerShell)
Shell.Application object, 127
Shell.LocalMachine object, 127
Shell.User object, 127
$shellId automatic variable, 93
shortcuts for types, 55
Show verb, 96
SilentlyContinue ErrorAction preference, 68
SilentlyContinue verbose preference, 74
single quote, ('), escape sequence for, 26
single quotes ('...'), literal strings, 24
slash (/)
/=, division assignment, 35
division operator, 35
format specifier, 141
SmtpClient class, 107
SoundPlayer class, 102
Split verb, 96
SqlCommand class, 109
SqlConnection class, 109
SqlDataAdapter class, 109
SQLDMO.SQLServer object, 127
square brackets ([...])
array access using, 30
in variable definition, 22
in regular expressions, 80, 81
ss format specifier, 140
$stackTrace automatic variable, 94
Start verb, 100
startup scripts (see profiles)
statement blocks, 43, 63
static methods, calling, 52
static properties, 53
Stop ErrorAction preference, 68
Stop verb, 100
Stop verbose preference, 74
Stopwatch class, 102
storage calculations, 8, 27
Stream class, 104
StreamReader class, 104
StreamWriter class, 105
String class, 102
string formatting
date and time, 133-142
numeric, 128-132
StringBuilder class, 102
StringReader class, 105
strings, 24-26
escape sequences in, 25
expanding strings, 24
here strings, 25
literal strings, 24
replacing text in, 38
StringWriter class, 105
strongly typed arrays, defining, 29
strongly typed variables, defining, 22
subexpressions, in expanding strings, 25
subprograms (see expression subparse control)
substitution patterns, in regular expressions, 86
subtraction assignment operator (-=), 35
subtraction operator (-), 34
Suspend verb, 100
switch statement, 44-47
Switch type shortcut, 55
SwitchParameter class, 55
System.Math class, 35
T[ Top ]
T format specifier, 134
t format specifier, 134, 140
\t, in regular expressions, 89
tab completion, 79
tab, escape sequence for, 26
TabExpansion function, 79
TcpClient class, 107
terminating errors, 68
Test verb, 99
text selection, QuickEdit mode for, 75
'text' format specifier, 132, 141
"text" format specifier, 132, 141
TextReader class, 104
TextWriter class, 104
$this automatic variable, 94
Thread class, 103
throw keyword, 68
tokens, 20
trace sources, 74
Trace verb, 99
Trace-Command cmdlet, 74
tracing, 73
Transaction class, 110
$transcript automatic variable, 94
trap statement, 69
TripleDESCryptoService-Provider class, 105
$true automatic variable, 94
Truncate method, Math class, 23
tt format specifier, 140
Type class, 103
type conversion operator (-as), 39
type operator (-is), 42
type shortcuts, 55
TypeName class, 55
TypeName type shortcut, 55
types, 54
assembly for, 56
extending, 57-59
information about, 54
instances of, creating, 56
shortcuts for, 55
types, data (see data types)
types.ps1xml file, 59
U[ Top ]
U format specifier, 135
u format specifier, 135
\udddd, in regular expressions, 89
Unblock verb, 100
Uninstall verb, 100
Unix commands, 3
Unlock verb, 96
Unpublish verb, 98
Up arrow hotkey, 76
Update verb, 98
Update-FormatData cmdlet, 71
Update-TypeData cmdlet, 59
Uri class, 106
Use verb, 96
user interface, .NET classes for, 106
V[ Top ]
\v, in regular expressions, 89
Variable Provider, 23
variables
accessing, 23
assigning numeric values to, 26
automatic variables, 90-94
command output in, 72
defining, 22
scope of, 22, 65
verbose output from commands, 74
$verboseHelpErrors automatic variable, 94
$verbosePreference automatic variable, 74, 94
verbs, PowerShell, 95-100
vertical bar (|)
pipeline character, 8
in regular expressions, 87
vertical tab, escape sequence for, 26
Vim.Application object, 127
W[ Top ]
-w option, switch statement, 46
\W, in regular expressions, 81
\w, in regular expressions, 81
Wait verb, 100
$warningPreference automatic variable, 94
web site resources
AutoHotkey program, 77
for this book, x
PowerShell documentation, 101
Safari, xi
WMI documentation, 111
WebClient class, 107
WellKnownSidType class, 105
WhatIf parameter, 10
$whatifPreference automatic variable, 94
while statement, 49
whitespace, ignoring, in regular expressions, 88
WIA.CommonDialog object, 127
-wildcard option, switch statement, 46
wildcards
in Get-Command cmdlet, 11
in parameters, 6
in switch statement, 46
Win32_BaseBoard class, 112
Win32_BIOS class, 112
Win32_BootConfiguration class, 112
Win32_CacheMemory class, 116
Win32_CDROMDrive class, 112
Win32_ComputerSystem class, 112
Win32_ComputerSystemProduct class, 112
Win32_DCOMApplication class, 112
Win32_Desktop class, 112
Win32_DesktopMonitor class, 113
Win32_DeviceMemoryAddress class, 113
Win32_Directory class, 114
Win32_DiskDrive class, 113
Win32_DiskPartition class, 118
Win32_DiskQuota class, 113
Win32_DMAChannel class, 113
Win32_Environment class, 114
Win32_Group class, 114
Win32_IDEController class, 114
Win32_IRQResource class, 114
Win32_LoadOrderGroup class, 116
Win32_LogicalDisk class, 116
Win32_LogicalMemoryConfigu-ration class, 116
Win32_LogonSession class, 116
Win32_NetworkAdapter class, 117
Win32_NetworkAdapterConfigu-ration class, 117
WIN32_NetworkClient class, 117
Win32_NetworkConnection class, 117
Win32_NetworkLoginProfile class, 117
Win32_NetworkProtocol class, 117
Win32_NTDomain class, 117
Win32_NTEventlogFile class, 118
Win32_NTLogEvent class, 117
Win32_OnBoardDevice class, 118
Win32_OperatingSystem class, 118
Win32_OSRecoveryConfiguration class, 119
Win32_PageFileSetting class, 118
Win32_PageFileUsage class, 118
Win32_PerfRawData_PerfNet_Server class, 120
Win32_PhysicalMemoryArray class, 116
Win32_PortConnector class, 119
Win32_PortResource class, 118
Win32_Printer class, 119
Win32_PrinterConfiguration class, 119
Win32_PrintJob class, 119
Win32_Process class, 119
Win32_Processor class, 112
Win32_Product class, 119
Win32_QuickFixEngineering class, 119
Win32_QuotaSetting class, 119
Win32_Registry class, 119
Win32_ScheduledJob class, 115
Win32_SCSIController class, 120
Win32_Service class, 120
Win32_Share class, 120
Win32_SoftwareElement class, 120
Win32_SoftwareFeature class, 121
WIN32_SoundDevice class, 121
Win32_StartupCommand class, 121
Win32_SystemAccount class, 121
Win32_SystemDriver class, 121
Win32_SystemEnclosure class, 121
Win32_SystemSlot class, 121
Win32_TapeDrive class, 122
Win32_TemperatureProbe class, 122
Win32_TimeZone class, 122
Win32_UninterruptiblePower-Supply class, 122
Win32_UserAccount class, 122
Win32_VoltageProbe class, 122
Win32_VolumeQuotaSetting class, 123
Win32_WMISetting class, 123
window size, adjusting, 75
window, closing, 76
Windows key + r hotkey, 76
Windows Management Instrumentation (see WMI)
Windows PowerShell (see PowerShell)
WindowsBuiltInRole class, 105
WindowsIdentity class, 105
WindowsPrincipal class, 105
WMI (Windows Management Instrumentation)
class categories, 111
classes, 112-123
documentation, 111
.NET classes for, 108
support for, 15
Wmi type shortcut, 55
WmiClass type shortcut, 55
WmiSearcher type shortcut, 55
WMPlayer.OCX object, 127
Word.Application object, 127
Word.Document object, 127
Write verb, 97
Write-Error cmdlet, 68
Write-Verbose cmdlet, 74
WScript.Network object, 127
WScript.Shell object, 127
WSHController object, 127
X[ Top ]
X format specifier, 130
x format specifier, 130
\xdd, in regular expressions, 89
XML as data type, 32
XML support, 14
Xml type shortcut, 55
XmlDocument class, 33, 55, 107
XmlElement class, 33
XmlTextWriter class, 107
-xor (logical exclusive OR operator, 36
Y[ Top ]
Y format specifier, 135
y format specifier, 135, 141
yy format specifier, 141
yyy format specifier, 141
yyyy format specifier, 141
yyyyy format specifier, 141
Z[ Top ]
z format specifier, 141
\Z, in regular expressions, 86
\z, in regular expressions, 86
zz format specifier, 141
zzz format specifier, 141
Return to Windows PowerShell Pocket Reference