Windows Powershell - EN.pdf
(
2256 KB
)
Pobierz
Windows PowerShell
An introduction to scripting
technologies for people with
no real background
knowledge
MICROSOFT SWITZERLAND
20 April 2007
Frank Koch (BERN)
Developer & Platform Evangelism
1
Windows PowerShell
What can you expect from such a short work -
An attempt of an foreword
O b j e c t i v e s i n d r a f t i n g t h i s b o o k
This“WindowsPowerShell”bookwillgiveyouanintroductiontoWindowsPowerShellaswellas
practical examples, in order to give you a quick introduction to this subject even if you have no
significant previous scripting experience. The book is explicitly not aimed at professional scripters;
the extensive Windows PowerShell help and the many Internet forums and additional literature are
designed to give experts everything they need. However, the newbies amongst you will hopefully
find everything you need in this book to enable you to think about scripting in more detail, and
hopefully quickly learn to enjoy being able to operate a computer even without a mouse.
The sources for this book were mainly Microsoft publications relating to Windows PowerShell. This
book presents the information in a new way appropriate for its target audience, initially leaving out
the theory whilst using many examples and mini practical exercises so as to hold your interest.
Once you have worked through this text and decided to make Windows PowerShell a fixed part of
your everyday IT, feel free to read the original documentation for Windows PowerShell, which is
automatically included when you install Windows PowerShell:
First Steps with Windows PowerShell
Basic Principles of Windows PowerShell
To really profit from this book you should have access to a PC where you can simultaneously practice
the exercises. The only prerequisite is a PC with Windows PowerShell 1.0 installed, which is available
free as of Windows XP SP2. For information on downloading and installing PowerShell see the
following websites.
O t h e r s o u r c e s o f i n f o r m a t i o n o n l i n e
The introductory page for Widows PowerShell including download link is
www.microsoft.com/PowerShell
H
ere you will also find other links to very useful webcasts, books
and other help forums.
The best blog pages about Windows PowerShell are found at
http://blogs.msdn.com/PowerShell/
Here you can read information about scripting techniques and practical demos. Absolutely
everything.
In Switzerland you can also find information in German in the ITPro team blog at
http://blogs.technet.com/chITPro-DE
Here you can find links to German Windows PowerShell
webcasts, and downloads for the exercises in the book in the March/April 2007 archive.
2
U s e f u l k e y c o m b i n a t i o n s f o r S w i s s s t a n d a r d k e y b o a r d s
S
YMBOL
K
EY COMBINATION
M
EANING
|
A
TG
G
R
7
(N
OT
:
A
LT
G
R
1
=
¦)
F
ORWARD THE OUTPUT FROM A COMMAND
`
S
HIFT
^,
THEN A SPACE
C
ONTINUE COMMAND ON NEXT LINE
{
A
LT
G
R Ä
B
EGIN A COMMAND SEQUENCE
(
E
.
G
.
AFTER AN
I
F
S
TATEMENT
)
}
A
LT
G
R
$
E
ND A COMMAND SEQUENCE
(
E
.
G
.
FOR AN
IF
S
TATEMENT
[
A
LT
G
R Ü
S
OMETIMES REQUIRED FOR OBJECTS
]
A
LT
G
R
!
S
OMETIMES REQUIRED FOR OBJECTS
TAB
T
AB KEY
C
OMPLETES COMMANDS WHERE NECESSARY
E
XAMPLE
:
GET
-
HE
(TAB)
PRODUCES GET
-
HELP
Windows PowerShell was developed in Redmond and was designed to ideally fit American keyboard
layouts. Some commonly used keys are therefore hard to find on Swiss keyboards. I have put
together a list for you here.
3
Contents
O
BJECTIVES IN DRAFTING THIS BOOK
....................................................................................................2
O
THER SOURCES OF INFORMATION ONLINE
...........................................................................................2
U
SEFUL KEY COMBINATIONS FOR
S
WISS STANDARD KEYBOARDS
................................................................3
F
IRST IMPRESSIONS OF
W
INDOWS
P
OWER
S
HELL
....................................................................................5
A
DDITIONAL USES FOR OUTPUT
:
“
PIPING
”
OBJECTS
.................................................................................7
I
NITIAL EXERCISES WITH
W
INDOWS
P
OWER
S
HELL OBJECTS
......................................................................8
W
ORKING WITH PROCESSES
................................................................................................................8
O
UTPUT IN A
TXT,
CSV
OR
XML
FILE
...................................................................................................9
O
UTPUT IN COLOR
.............................................................................................................................9
C
HECKING CONDITIONS USING THE
IF
CMDLET
......................................................................................11
O
UTPUT IN
HTML ..........................................................................................................................13
W
ORKING WITH FILES
......................................................................................................................15
F
INDING OBJECT INFORMATION USING GET
-
MEMBER
............................................................................16
D
ELETING FILES
...............................................................................................................................17
C
REATING FOLDERS
.........................................................................................................................18
I
F YOU HAVE TIME
........................................................................................................................21
W
INDOWS
P
OWER
S
HELL AS GENERIC OBJECT PROCESSING MACHINE
.......................................................22
WMI
OBJECTS
................................................................................................................................22
W
ORKING WITH
.NET
OBJECTS AND
XML...........................................................................................24
W
ORKING WITH
COM
OBJECTS
.........................................................................................................25
W
ORKING WITH EVENT LOGS
............................................................................................................28
S
OLUTION SCRIPTS TO THE EXERCISES IN THIS BOOK
...............................................................................29
W
INDOWS
P
OWER
S
HELL EXAMPLES
–
FROM SIMPLE TO COMPLEX
..........................................................32
T
HEORETICAL PRINCIPLES FOR
W
INDOWS
P
OWER
S
HELL
........................................................................34
W
INDOWS
P
OWER
S
HELL
–
A
B
RIEF
I
NTRODUCTION
.............................................................................34
A
IMS OF DEVELOPING
W
INDOWS
P
OWER
S
HELL
...................................................................................34
O
N TEXTS
,
PARSERS AND OBJECTS
......................................................................................................34
A
NEW SCRIPTING LANGUAGE
............................................................................................................35
W
INDOWS COMMANDS AND SERVICE PROGRAMS
................................................................................36
A
N INTERACTIVE ENVIRONMENT
........................................................................................................36
S
CRIPT SUPPORT
.............................................................................................................................36
CMD,
WS
CRIPT OR
P
OWER
S
HELL
?
D
O
I
HAVE TO DECIDE
? ...................................................................36
W
INDOWS
P
OWER
S
HELL
1.0............................................................................................................36
S
ECURITY WHEN USING SCRIPTS
.........................................................................................................38
4
Plik z chomika:
zyzioq2014
Inne pliki z tego folderu:
Witold Kędziora - Podręcznik kierowcy B, B+E.pdf
(207320 KB)
ABC Podręcznik Kierowcy Prawo jazdy kat. B.pdf
(116856 KB)
ABC Podręcznik Kierowcy.pdf
(116856 KB)
Podręcznik Kierowcy.pdf
(37200 KB)
Genetyka zachowania- Plomin, DeFries, McClearn, McGuffin.pdf
(48120 KB)
Inne foldery tego chomika:
Audio
Audiobooki
Filmy
Gry
Książki
Zgłoś jeśli
naruszono regulamin