Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Windows Server 2016 Automation with PowerShell Cookbook
PREMIUM
Số trang
651
Kích thước
30.3 MB
Định dạng
PDF
Lượt xem
1498

Windows Server 2016 Automation with PowerShell Cookbook

Nội dung xem thử

Mô tả chi tiết

Windows Server 2016 Automation with

PowerShell Cookbook

Second Edition

Automate manual administrative tasks with ease

Thomas Lee

BIRMINGHAM - MUMBAI

Windows Server 2016 Automation with

PowerShell Cookbook

Second Edition

Copyright © 2017 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or

transmitted in any form or by any means, without the prior written permission of the

publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the

information presented. However, the information contained in this book is sold without

warranty, either express or implied. Neither the author, nor Packt Publishing, and its

dealers and distributors will be held liable for any damages caused or alleged to be caused

directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the

companies and products mentioned in this book by the appropriate use of capitals.

However, Packt Publishing cannot guarantee the accuracy of this information.

First published: October 2015

Second edition: September 2017

Production reference: 1190917

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham

B3 2PB, UK.

ISBN 978-1-78712-204-8

www.packtpub.com

Credits

Author

Thomas Lee

Copy Editors

Safis Editing

Juliana Nair

Reviewer

Mike F Robbins

Project Coordinator

Judie Jose

Acquisition Editor

Meeta Rajani

Proofreader

Safis Editing

Content Development Editor

Abhishek Jadhav

Indexer

Aishwarya Gangawane

Technical Editor

Mohd Riyan Khan

Graphics

Kirk D'Penha

Production Coordinator

Aparna Bhagat

About the Author

Thomas Lee is a consultant/trainer/writer from England and has been in the IT business

since the late 1960's. After graduating from Carnegie Mellon University, Thomas joined

ComShare where he was a systems programmer building the Commander II time-sharing

operating system, a forerunner of today's Cloud computing paradigm. He moved to

Comshare UK in 1975 and later went to work for ICL, again developing operating systems.

After a sabbatical in 1980/81, he joined Arthur Andersen Management Consultants (now

known as Accenture). He left in 1988 to run his own consulting and training business,

which is still active today.

Thomas holds numerous Microsoft certifications, including MCSE (one of the first in the

world) and later versions, MCT (22 years), and was awarded Microsoft's MVP award 17

times. He is also a Fellow of the British Computer Society. He has written extensively for

the UK trade press, including PC Pro.

Today, Thomas writes and talks mainly on PowerShell and Azure. He currently works for a

number of clients to deliver training and to build training courses. Having traveled the

world, he entered semi-retirement in 2016 and is spending more time at his cottage in the

English countryside, along with his wife, Susan, and their daughter, Rebecca. He continues

to give back to the community and spends a lot of time as group administrator for the

PowerShell forum on Spiceworks, where he is also a Moderator.

Acknowledgment

I’d first like to thank Jeffrey Snover of Microsoft for the invention of PowerShell. I was

lucky enough to be in the room the very first time he presented what was then called

Monad. His enthusiasm was infectious, and 15 years later I am still excited.

Also, a shout out to the author of the first edition, Ed Goad. His first edition was a great

base to work on although all the recipes in this edition are reworked totally.

A huge thank you has to go to the Packt team: Meeta Rajani, Abhishek Jadhav, Mohd Riyan

Khan, and Judie Jose. You guys did a great job getting this book out of the door and dealing

with the crises that arose during the writing. And thanks too to our most excellent tech

reviewer Mike Robbins. Your reviews were always excellent.

When I began this project, I had a co-author, David Cobb. Sadly, for personal reasons, he

had to drop out, but I thank him for the chapters he was able to write.

We had a large number of volunteer reviewers who read through the various chapters. I

appreciate all the work you folks did to try to make this a better book.

As each recipe evolved, I would sometimes hit problems. I got a lot of help from the

Spiceworks community. Their PowerShell forum is a great source of information and

encouragement. If you have problems with PowerShell, this is a great place to get a

solution.

And finally, I have to thank my wonderful wife, Susan. She has been patient as things

progressed, she put up with my bad moods when progress was not as smooth as desirable,

and kept me sane when all around me was craziness.

About the Reviewer

Mike F. Robbins is a Microsoft MVP on Windows PowerShell and a SAPIEN Technologies

MVP. He is a co-author of Windows PowerShell TFM 4th Edition and is a contributing author

of a chapter in the PowerShell Deep Dives book. Mike has written guest blog articles for the

Hey, Scripting Guy! blog, PowerShell Magazine, and PowerShell.org. He is the winner of

the advanced category in the 2013 PowerShell Scripting Games. Mike is also the leader and

co-founder of the Mississippi PowerShell User Group. He blogs at mikefrobbins.com and

can be found on Twitter at @mikefrobbins.

www.PacktPub.com

For support files and downloads related to your book, please visit www.PacktPub.com.

Did you know that Packt offers eBook versions of every book published, with PDF and

ePub files available? You can upgrade to the eBook version at www.PacktPub.comand as a

print book customer, you are entitled to a discount on the eBook copy. Get in touch with us

at [email protected] for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a

range of free newsletters and receive exclusive discounts and offers on Packt books and

eBooks.

https://www.packtpub.com/mapt

Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt

books and video courses, as well as industry-leading tools to help you plan your personal

development and advance your career.

Why subscribe?

Fully searchable across every book published by Packt

Copy and paste, print, and bookmark content

On demand and accessible via a web browser

Customer Feedback

Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial

process. To help us improve, please leave us an honest review on this book's Amazon page

at https://www.amazon.com/dp/1787122042.

If you'd like to join our team of regular reviewers, you can email us at

[email protected]. We award our regular reviewers with free eBooks and

videos in exchange for their valuable feedback. Help us be relentless in improving our

products!

Table of Contents

Preface 1

Chapter 1: What's New in PowerShell and Windows Server 11

Introduction 11

Exploring Remote Server Administration Tools (RSAT) 12

How to do it... 12

How it works... 14

There's more... 18

Discovering new cmdlets in PowerShell 4 and Windows Server 2012 R2 18

New cmdlets 19

How to do it... 19

How it works... 20

There's more... 22

Discovering new cmdlets in PowerShell 5/5.1 and Windows Server 2016 22

Getting ready 23

PowerShellGet module 23

PackageManagement module 23

Microsoft.PowerShell.Archive module 23

Microsoft.PowerShell.Utility module 23

Other new modules 24

Other new cmdlets 25

How to do it... 25

How it works... 28

There's more... 32

Exploring PowerShellGet 32

How to do it... 32

How it works... 36

There's more... 43

Exploring PackageManagement 43

How to do it... 44

How it works... 47

There's more... 51

Creating an internal PowerShell repository 51

How to do it... 52

How it works... 56

There's more... 57

[ ]

Chapter 2: Implementing Nano Server 58

Introduction 58

Deploying a Nano Server in a VM 58

Getting ready 59

How to do it... 59

How it works... 61

There's more... 64

Connecting to and managing a Nano Server 64

Getting ready 65

How to do it... 65

How it works... 68

There's more... 79

Installing features with Nano Server packages 80

Getting ready 80

How to do it... 81

How it works... 83

There's more... 88

Chapter 3: Managing Windows Updates 91

Introduction 91

Installing Windows Server Update Services 92

Getting ready 92

How to do it... 92

How it works... 94

There's more... 99

Configuring WSUS update synchronization 100

Getting ready 100

How to do it... 100

How it works... 103

There's more... 106

Configuring the Windows Update client 106

Getting ready 106

How to do it... 106

How it works... 108

There's more... 109

Creating computer target groups 109

Getting ready 110

How to do it... 110

How it works... 110

[ ]

There's more... 111

Configuring WSUS auto-approvals 112

Getting ready 112

How to do it... 112

How it works... 113

There's more... 114

Managing updates 115

Getting ready 115

How to do it... 115

How it works... 117

There's more... 120

Chapter 4: Managing Printers 121

Introduction 121

Installing and sharing printers 122

Getting ready 122

How to do it... 122

How it works... 123

Publishing a printer 125

Getting ready 125

How to do it... 125

How it works... 126

There's more... 126

Changing the spool directory 128

Getting ready 128

How to do it... 128

How it works... 130

Changing printer drivers 131

Getting ready 131

How to do it... 132

How it works... 132

Printing a test page on a printer 133

Getting ready 133

How to do it... 133

How it works... 134

Reporting on printer security 135

Getting ready 135

How to do it... 135

How it works... 137

Modifying printer security 137

[ ]

Getting ready 138

How to do it... 138

How it works... 139

Deploying shared printers 139

Getting ready 140

How to do it... 145

How it works... 147

There's more... 147

Enabling Branch Office Direct Printing 147

Getting ready 148

How to do it... 148

How it works... 149

There's more... 150

Creating a printer pool 150

Getting ready 150

How to do it... 150

How it works... 151

Reporting on printer usage 152

Getting ready 153

How to do it... 153

How it works... 154

There's more... 155

Chapter 5: Managing Server Backup 156

Introduction 156

Configure and set backup policy 158

Getting ready 158

How to do it... 159

How it works... 160

There's more... 164

Examine the results of a backup 164

Getting ready 165

How to do it... 165

How it works... 166

There's more... 169

Initiate a backup manually 169

Getting ready 169

How to do it... 170

How it works... 171

There's more... 173

[ ]

Restore files and folders 173

Getting ready 174

How to do it... 175

How it works... 176

There's more... 178

Backup and restore a Hyper-V Virtual Machine 178

Getting ready 178

How to do it... 178

How it works... 180

There's more... 185

Backup and perform bare metal recovery 186

Getting ready 186

How to do it... 186

How it works... 189

There's more... 202

Restore the registry from a backup 202

Getting ready 202

How to do it... 203

How it works... 207

There's more... 209

Create a daily backup report 210

Getting ready 210

How to do it... 210

How it works... 213

There's more... 214

Backup and restore using Microsoft Azure 215

Getting ready 215

How to do it... 215

How it works... 219

There's more... 226

Chapter 6: Managing Performance 227

Introduction 227

Explore performance counters with Get-Counter 229

Getting ready 229

How to do it... 230

How it works... 231

There's more... 235

Explore performance counters using CIM cmdlets 236

Getting ready 237

Tải ngay đi em, còn do dự, trời tối mất!