• No results found

Automating Microsoft

N/A
N/A
Protected

Academic year: 2021

Share "Automating Microsoft"

Copied!
6
0
0

Loading.... (view fulltext now)

Full text

(1)

Automating

Microsoft®

Windows

Server®

2008 R2

with

Windows

PowerShell®

2.0

Matthew Hester

Sarah Dutkiewicz

WILEY

(2)

TABLE OF

CONTENTS

Introduction xvii

Chapter

1 What Is

PowerShell,

and

Why

Do You Need It? 1

Why

PowerShell? 2

Overview of PowerShell 3 The Power Behind PowerShell 5 What About the

Learning

Curve? 6

What's New in PowerShell2.0? 7 PowerShellinthe

Enterprise

8

PowerShell withaGUI 10

PowerShell Has

Something

forEveryone 13

What'sinIt for IT Professionals? 14

What's in It forDevelopers? 15

Chapter

2

Installing

and

Configuring

PowerShell 2.0 19

Configure

PowerShell2.0onWindows Server 2008 R2 20

Install the ISEonWindows Server 2008 R2 22

Install PowerShell 2.0onWindows Server 2008 R2 Core 24

Install .NET Framework

Support

onWindows Server 2008 R2 Core 26

Install PowerShell 2.0onWindows Server 2008 R2 Core 26

Install PowerShell 2.0onOther

Operating

Systems 29

SetUpthe

Prerequisites

29 Obtain and Install PowerShell 2.0 31

Chapter

3

PowerShell

GrammarLesson 37

Break Down PowerShell: A LessononCmdlets .38 Learn the Verbs 39 Learn the Nouns 40 Put Verbs and NounsTogether: Cmdlets 41 Use Parameters 42

Use Wildcards 45

UnderstandProperties 46

HelpYourself withPowerShell 48

Learn HowtoHelpYourself 48

UseTabAutocomplete 53

LeverageOnline Resources 54 UseEven More Commands with Modules 55

(3)

Get to Know YourModules 58

CreateaCustomPowerShell Shell 60

Chapter

4

Aliases, Functions,

and

the

Pipe,

Oh

My!

65

Use Aliases 66 Use Built-in Aliases 67 Create Your Own Aliases 69 Use Functions 77

Understand Functions 78

Use

Existing

Functions 79

CreateYourOwn Function 80

Work with the

Pipe

Operator 81 UsethePipe OperatortoCombine PowerShell Cmdlets 81

ControlPowerShell Output 82

Chapter

5

Creating Your Own

Scripts

97

Create Your OwnScripts 98

PowerShellScriptingOverview 99

CreateaPowerShell Script 100

Run YourScripts 106

Find Scripts 107

Understand

Security

and PowerShell

Scripts

108

Work with Default Execution

Policy

of

Scripts

109

Understand the

RemoteSigned

PowerShellExecution

Policy

110 Setthe PowerShellExecution

Policy

111

UnderstandDigital Signing 116 Workwith theGUI and theShell 116 Understand Whatthe ISE Is 116

Use the ISE with

Scripts

119

DisplaytheCall StackwithScripts RequiringParameters 123

Chapter

6

Remoting

with

PowerShell

2.0 125

Configure PowerShell

Remoting

126

Learn theRequirements 126

Enable PowerShell

Remoting

128

Disable PowerShell

Remoting

133

Run Commandson Remote

Systems

138

Use Invoke-Command 140 Use PowerShellRemoteSessions 140 UseRemotingintheISE 143

Chapter

7 Server Essentialsin

PowerShell

147

(4)

Work with ServerManagerCmdlets 148

Analyze

Your Server 150 Add

Reliability

toYour Server 156 Install the

Backup

Tools 156 Performa

Backup

with PowerShell 156 Load-BalanceYourNetwork 159

UseOther PowerShell Utilities fortheServer 163 UsetheRegistry with PowerShell 163

UsePowerShell

Troubleshooting

Packs 166

Schedule PowerShell Scripts 169

Chapter

8

Managing

Active

Directory

with PowerShell 173

Work with ActiveDirectory 174

Load the AD PowerShell Module 174

Understand PowerShell ActiveDirectoryBasics 178

Work withUsers,

Groups,

and OUs 182

Understand

Managed

Service Accounts 185

Understand

Managed

ServiceAccounts 185

Create

Managed

Service Accounts 186

Install andUse

Managed

ServiceAccounts 188

Work with the ActiveDirectory RecycleBin 189

Understand Howthe RecycleBin Works 190

Enable the ADRecycleBin 191 Use the AD RecycleBin 193

Chapter

9

Managing Desktops

with PowerShell 197

Access

Group Policy

198

Understand

Group Policy

199

Understand How

Group Policy

Works 200

Manage Group

Policy

2°1

CreateGroup

Policy Objects

204

Use StarterGPOs 206

Work withSettings 208

Understand the Difference BetweenPoliciesand Preferences 209 Work with Domain PasswordPolicies 210 Understand Order of Precedence 212 Control

Group Policy

Order of Precedence 213 Work with RSOP 215

Back

Up

andRestoreGroup

Policy Objects

216

Manage

AppLocker

217 Understand

AppLocker

217

UnderstandAppLocker

Policy

218

(5)

Chapter

10

Managing

IIS Web Server with PowerShell 223

Use PowerShell andIIS 224 Workwith

Configuration

Files 225

BackUpand Recover IISConfiguration 229

DeployWebsites,ApplicationPools,andVirtualDirectories withPowerShell 231

ManageSites with PowerShell 231 WorkwithWebApplication Pools 236 Work with Virtual Directories 240

Chapter

11

PowerShell and

Deployment

Services 243

Work with Windows

Deployment

Services 244

Understand WDS 245

Install WDS 246

Work withWDS inPowerShell 247

UseWDSUTIL 248

Workwiththe Microsoft

Deployment

Toolkit 253

Understand the MDT 253

Deploy

withWindowsImagingFormat 254

InstallMDT 256

Workwith MDT in PowerShell 257 PutItAllTogether 265

Chapter

12 PowerShell

and

Virtualization 267

Install and Access

Hyper-V

268

Install

Hyper-V

269

Access

Hyper-V

inPowerShell 270

Work with

Hyper-V

276

Work with Virtual Networks 276

Configure

Virtual Machines 278

ConnecttoVirtual Machines 283

Work with

Snapshots

285

Appendix

A Solutionsto Exercises 289

SolutionV.

Inventory

YourScripts 290 Solution2:InstallPowerShell 290

Solution3: CreateaPowerShell Profile 290

Solution4: Create Your Own Alias 291

Solution5: CreateaScripttoFind

Startup Programs

292

Solution6: SetUpaRemote PowerShell Session 292

Solution7:CreateaScheduledBackupwith PowerShell 293

Solution 8:PopulateanActive

Directory

TestEnvironment 293

Solution 9: Turn Off the

Display

Control Panelin

Group Policy

withPowerShell 295 Solution 10: CreateaWebsite with PowerShell 296

(6)

Solution11:Createa

Deployment

Share 296 Solution12:CreateaVirtual Machine andTakeaSnapshot 297

Appendix

B

Developing

ata Command

Prompt

299

ChooseBetweentheISEand the CommandPrompt 300

Write Codeat aCommand Prompt 301

WriteScriptsin theISE 302

Work with Objectsin PowerShell 304

UnderstandProperties 305

CreateYourOwn CustomObject 307

Appendix

C

Providing

for

PowerShell 311

Work with Built-in Providers 312 Understand Provider Basics 313

UsePowerShell-SpecificProviders 314

Use Other Built-in Providers 317 Work with Additional Providers —322

Install and Remove Providers 322 CreateYourOwn Provider 323 UnderstandBasicProviderConcepts 323 BuildaCustom Provider 327

Appendix

D Custom

Cmdlets

and

Advanced Functions

339

Choose BetweenanAdvanced Function andaCmdlet 340

ParametersandAttributes 340

Output 346 Runtime LifeCycle 347 CreateanAdvanced Function 348

CreateaCustom Cmdlet 349

Appendix

E

Packaging

PowerShell Extensions 357

Work withExisting

Snap-ins

358 CreateaCustomModule 361 Understand ModuleConcepts 361 BuildYourModule 368

Appendix

F

Building

Your

Own GUI

with PowerShell 379

Choose Between WinForms andWPF 380 CreateaGUI in PowerShell 381

CreateaWinForms

Application

385

CreateaWPF

Application

391

References

Related documents

When it comes to developing the right talent for this sector, we need to predict industry needs, respond to the diversity of demand from companies, and equip talent with the

When a total of 244 patients with prior ischemic stroke were excluded from the analysis (28 smokers, 216 nonsmokers) the observed unadjusted OR remained signi fi- cant for

It describes how to consolidate SQL Server workloads, work with both on-premises and Microsoft Azure cloud-based solutions, and how to plan and implement high availability

This module explains how Windows Server Failover Clustering and SQL Server AlwaysOn Failover Cluster Instances work, and describes how to implement clustering to protect

It describes how to consolidate SQL Server workloads, work with both on-premises and Microsoft Azure cloud-based solutions, and how to plan and implement high availability

• Explain how to perform the basic Windows PowerShell operations • Explain how to access the Windows PowerShell library for Group Policy • Manage systems using Windows

Available PowerShell cmdlets can be used to create PowerShell plugins for use with GDMA or GroundWork Child Servers that select Event Log messages to be delivered directly to the

Create the schedule task group run PowerShell script 1 On a server or workstation log slice as Administrator 2 Launch Task Scheduler 3 Next to?. More of powershell scheduled task