Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Windows Server Automation with PowerShell Cookbook, Fifth Edition
Windows Server Automation with PowerShell Cookbook, Fifth Edition

Windows Server Automation with PowerShell Cookbook, Fifth Edition: Powerful ways to automate, manage, and administrate Windows Server 2022 using PowerShell 7.2 , Fifth Edition

Arrow left icon
Profile Icon Thomas Lee
Arrow right icon
Mex$179.99 Mex$771.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.7 (21 Ratings)
eBook Jan 2023 714 pages 5th Edition
eBook
Mex$179.99 Mex$771.99
Paperback
Mex$963.99
Subscription
Free Trial
Arrow left icon
Profile Icon Thomas Lee
Arrow right icon
Mex$179.99 Mex$771.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.7 (21 Ratings)
eBook Jan 2023 714 pages 5th Edition
eBook
Mex$179.99 Mex$771.99
Paperback
Mex$963.99
Subscription
Free Trial
eBook
Mex$179.99 Mex$771.99
Paperback
Mex$963.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Windows Server Automation with PowerShell Cookbook, Fifth Edition

Installing the Cascadia Code font

Fonts, like color schemes in general, are a very personal thing. Some people love the comic sans font, for example, while others loathe it. Some love dark themes, and others don’t. For programming, including PowerShell (with the console, VS Code, and possibly even notepad), fixed-width fonts are easier to use. But the choice of which font is always a personal preference.

As part of the Visual Studio Code launch, Microsoft also created a new and free font that you can download and use at the PowerShell 7 console and inside VS Code. This recipe shows how you can download the font, install it, and set this font to be the default in VS Code.

This recipe shows how to install the Cascadia Code font, but you can choose many great fonts. See this article on (arguably!) the ten best fonts for use with VS Code https://toastofcode.com/best-fonts-for-programming-with-vscode/.

And should you want to use a different font for VS Code, you can adapt this recipe...

Exploring PSReadline

Early versions of PowerShell were monochrome, although the terminal (conhost.exe) did provide some limited coloring. These versions of Windows PowerShell also lacked some of the cool features found in Linux shells.

With PowerShell 4, PowerShell included a new module, PSReadLine. The module provides a command-line editing experience that is on a par with the best of the Linux command shells (e.g. BASH). The PSReadLine module provides additional console editing features within both PowerShell 7 and Windows PowerShell.

When you type into a PowerShell console, PSReadLine intercepts your keystrokes to provide syntax coloring, simple syntax error notification, etc. PSReadLine enables you to customize your environment to suit your personal preferences. Some key features of the module include:

  • Syntax coloring of the command line entries
  • Multi-line editing
  • History Management
  • Customizable key bindings
  • Highly customizable

For an overview of PSReadLine, see https://docs.microsoft...

Utilizing Windows PowerShell Compatibility

The PowerShell 7 Windows Compatibility solution allows you to use older Windows PowerShell commands whose developers have not (yet) ported the commands to work natively in PowerShell 7. PowerShell 7 creates a special remoting session into a Windows PowerShell 5.1 endpoint, loads the modules into the remote session, then uses implicit remoting to expose proxy functions inside the PowerShell 7 session. This remoting session has a unique session name, WinPSCompatSession. Should you use multiple Windows PowerShell modules, PowerShell 7 loads them all into a single remoting session. Also, this session uses the “process” transport mechanism versus Windows Remote Management (WinRM). WinRM is the core transport protocol used with PowerShell remoting. The process transport is the transport used to run background jobs; it has less overhead than using WinRM, so is more efficient.

An example of the compatibility mechanism is using...

Installing RSAT

The Remote Server Admin Tools (RSAT) is a set of management tools you use to manage individual Windows Features. The RSAT are fundamental to administering the roles and features you can install on Windows Server. The Windows Server DNS Server feature, for example, comes with both an MMC and a module that you use to manage the DNS Server on a given host.

A nice thing about the commands in the ServerManager module – everything is a feature, meaning you do not know whether the tools manage a Windows feature or a Windows role.

Each feature in Windows Server can optionally have management tools, and most do. These tools include PowerShell cmdlets, functions, aliases, GUI Microsoft Management Console (MMC) files, and Win32 console applications. The DNS Server’s RSAT tools include a PowerShell module, an MMC , as well as the command-line tool dnscmd.exe. While you probably do not need the console applications since you can use the cmdlets, that is...

Exploring Package Management

The PackageManagement PowerShell module provides tools that enable you to download and install software packages from a variety of sources. The module, in effect, implements a provider interface that software package management systems use to manage software packages.

You can use the cmdlets in the PackageManagement module to work with a variety of package management systems. This module, in effect, provides an API to package management providers such as PowerShellGet, discussed in the Exploring PowerShellGet and PS Gallery recipe.

The primary function of the PackageManagement module is to manage the set of software repositories in which package management tools can search, obtain, install, and remove packages. The module enables you to discover and utilize software packages from a variety of sources, including the PowerShell Gallery.

The modules in the various internet repositories, including the PowerShell Gallery, vary in quality. Some...

Exploring PowerShellGet and the PS Gallery

In a perfect world, PowerShell would come with a command that performed every single action any IT professional should ever need or want. But, as Jeffrey Snover (the inventor of PowerShell) says: To Ship is To Choose. And that means PowerShell itself, as well as Windows Server features, may not have every command you need. At a practical level, the various Windows feature teams, as well as the PowerShell team, do not have infinite resources to implement every good idea. And that is where the PowerShell community and the PowerShell Gallery (PS Gallery) come in.

The PS Gallery provides a huge range of PowerShell artifacts for you to leverage. To some degree, if you can conceive of a use for PowerShell, there are likely to be things in the Gallery to delight you. If you are a Grateful Dead fan, for example, there are some scripts to manage your live concert collection (https://www.powershellgallery.com/packages/gdscripts/1.0.4). If you need...

Creating and Using a Local Package Repository

In the Exploring PowerShellGet and PS Gallery recipe, you saw how you could download PowerShell modules and more from the PS Gallery. You can install them, or save them for investigation. One nice feature is that after you install a module using Install-Module, you can later update the module using Update-Module.

As an alternative to using a public repository, you can create your own private repository. You can then use the commands in the PowerShellGet module to find, install, and manage your modules. A private repository allows you to create your modules and put them into a local repository for your IT professionals, developers, or other users to access.

There are several methods you can use to set up your internal package repository. One approach would be to use, a third-party tool such as ProGet from Inedo (see https://inedo.com/ for details on ProGet).

A simple way to create a repository is to set up an SMB file share...

Establishing a Script Signing Environment

You can often find that it is essential to know if an application, or a PowerShell script, has been modified since it was released. You can use Windows Authenticode Digital Signatures for this purpose.

Authenticode is a Microsoft code-signing technology that identifies the publisher of Authenticode-signed software. Authenticode also verifies that the software has not been tampered with since it was signed and published.

You can also use Authenticode to digitally sign your script using a PowerShell command. You can then ensure PowerShell only runs digitally-signed scripts by setting an execution policy of AllSigned or RemoteSigned.

After you sign a PowerShell script, you can set PowerShell’s execution policy to force PowerShell to test the script to ensure the digital signature is still valid and only run scripts that succeed. You can set PowerShell to do this either for all scripts (you set the execution policy to AllSigned...

Working With Shortcuts and the PSShortCut Module

A shortcut is a file that contains a pointer to another file or URL. You can place a shell link shortcut to some executable program, such as PowerShell, on your Windows desktop. When you click the shortcut in Windows Explorer, Windows runs the target program. You can also create a shortcut to a URL.

Shell link shortcuts have the extension .LNK, while URL shortcuts have the .URL extension. Internally, a file shortcut has a binary structure that is not directly editable. For more details on the internal format, see https://learn.microsoft.com/openspecs/windows_protocols/ms-shllink/16cb4ca1-9339-4d0c-a68d-bf1d6cc0f943.

The URL shortcut is a text document that you could edit with VS Code or Notepad. For more details on the URL shortcut file format, see http://www.lyberty.com/encyc/articles/tech/dot_url_format_-_an_unofficial_guide.html.

There are no built-in commands to manage shortcuts in PowerShell 7. As you saw earlier in...

Working With Archive Files

Since the beginning of the PC era, users have employed a variety of file compression mechanisms. An early method used the ZIP file format, initially implemented by PKWare’s PKZip program quickly became a near-standard for data transfer. A later Windows version, WinZip, became popular. With Windows 98, Microsoft provided built-in support for ZIP archive files. Today, Windows supports ZIP files up to 2GB in total size. You can find more information about the ZIP file format at https://en.wikipedia.org/wiki/Zip_(file_format).

Numerous developers, over the years, have provided alternative compression schemes and associated utilities, including WinRAR and 7-Zip. WinZip and WinRAR are both excellent programs but are commercial programs. 7-Zip is a freeware tool that is also popular. All three offer their own compression mechanisms (with associated file extension) and support the others as well.

For details on WinZip, see https://www.winzip.com/win...

Searching for Files Using the Everything Search Tool

Void Tools is a software company that produced the Everything search tool. Most IT pros run it from the GUI but there is a community module to help you use this tool using PowerShell. The Everything tool and the PowerShell community have developed a nice little product that you can easily leverage in PowerShell. The Everything applications return fully qualified filenames for those files on your system whose names meet a specified pattern. You can use either a wild card (e.g., *.PS1) or a regular expression (e.g., '\.PS1$') as a pattern. There is also an add-on module that provides an easy-to-use PowerShell COMMAND.

The key benefit is that it is very fast. On a large Windows host with say one million total files, it might take 10-12 seconds to return a list of all the files on that system. To find all the .PS1 files on the system drive would take under 100 milliseconds. By comparison, using Get-ChildItem would take...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • New edition updated to the latest version of PowerShell 7.2 and Windows Server 2022
  • Discover new ways to optimize your PowerShell code by working through easy-to-follow recipes
  • Learn PowerShell best practices to automate common tasks and manage DHCP in Microsoft Windows Server, objects in Active Directory, Hyper-V, and Azure

Description

The Windows Server Automation with PowerShell Cookbook is back with a new edition, featuring over 100 PowerShell recipes that will make your day-to-day work easier. This book is designed to help you learn how to install, configure and use PowerShell 7.2 effectively. To start with, we’ll look at how to install and configure PowerShell 7.2, along with useful new features and optimizations, and show you how the PowerShell compatibility solution bridges the gap to older versions of PowerShell. We’ll also be covering a wide range of fundamental and more advanced use cases, including how to create a VM and set up an Azure VPN, as well as looking at how to back up to Azure. As you progress, you’ll explore topics such as using PowerShell to manage networking and DHCP in Windows Server, objects in Active Directory, Hyper-V, and Azure. We’ll also take a closer look at WSUS, containers and see how to handle modules that are not directly compatible with PowerShell 7. Finally, you’ll also learn how to use some powerful tools to diagnose and resolve issues with Windows Server. By the end of this PowerShell book, you’ll know how to use PowerShell 7.2 to automate tasks on Windows Server 2022 with ease, helping your Windows environment to run faster and smoother.

Who is this book for?

This book is for systems administrators, software architects, developers, consultants, and engineers working with Windows Server 2022 who want to automate tasks more effectively with PowerShell 7.2. You’ll need to have conquered the basics of PowerShell and have a rudimentary understanding of PowerShell scripting before you can get started with this book.

What you will learn

  • Perform key admin tasks on Windows Server
  • Keep your organization secure with JEA, group policies, logs, and Windows Defender
  • Use .NET Framework for administrative scripting
  • Manage data and storage on Windows, including disks, volumes, and filesystems
  • Report system performance using built-in cmdlets and WMI to obtain single measurements
  • Apply the right tools and modules to troubleshoot and debug Windows Server
  • Create, manage, and back up a second VM using the subnetwork in Azure
  • Learn how to set up a VPN in Azure with PowerShell

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jan 31, 2023
Length: 714 pages
Edition : 5th
Language : English
ISBN-13 : 9781804615102
Vendor :
Microsoft
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jan 31, 2023
Length: 714 pages
Edition : 5th
Language : English
ISBN-13 : 9781804615102
Vendor :
Microsoft
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Mex$85 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Mex$85 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Mex$ 3,015.97
Mastering Windows Server 2022
Mex$1025.99
Windows Server Automation with PowerShell Cookbook, Fifth Edition
Mex$963.99
PowerShell Automation and Scripting for Cybersecurity
Mex$1025.99
Total Mex$ 3,015.97 Stars icon
Banner background image

Table of Contents

16 Chapters
Installing and Configuring PowerShell 7 Chevron down icon Chevron up icon
Managing PowerShell 7 in the Enterprise Chevron down icon Chevron up icon
Exploring .NET Chevron down icon Chevron up icon
Managing Active Directory Chevron down icon Chevron up icon
Managing Networking Chevron down icon Chevron up icon
Implementing Enterprise Security Chevron down icon Chevron up icon
Managing Storage Chevron down icon Chevron up icon
Managing Shared Data Chevron down icon Chevron up icon
Managing Printing Chevron down icon Chevron up icon
Exploring Windows Containers Chevron down icon Chevron up icon
Managing Hyper-V Chevron down icon Chevron up icon
Debugging and Troubleshooting Windows Server Chevron down icon Chevron up icon
Managing Windows Server with Window Management Instrumentation (WMI) Chevron down icon Chevron up icon
Managing Windows Update Services Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.7
(21 Ratings)
5 star 81%
4 star 9.5%
3 star 9.5%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Damir Bukovec Jul 17, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
It is a great product and exactly what I was looking for.
Feefo Verified review Feefo
Mark A Delagarza Feb 07, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Outstanding book! Has a good amount of information about automation with Powershell and utilizing it in different environments. It has helped me make a lot of my everyday processes into an automation script, so now I can get things done faster with a click of a button.Helps you get your Powershell setup and configured correctly for automation. Introduction to Visual studio code, Active Directory scripting, group policy, Domain controllers,enterprise security, printers, Hyper-V, VM-replication, PS-Script anaylzing, beggung and troubleshooting, WSUS manager.He explains everything then walks you step by step on how to do them yourself.I recommend this book to anybody looking to get efficient in powershell and automating your every day tasks. That way you can save time and get more done in your day.
Amazon Verified review Amazon
Mr. S. McGrath Feb 15, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Thomas has been writing books on PowerShel for a long time and this shows in his latest title.The list of topics is concise as are the explanations of all of the solutions he provides. This is a worthy edition to my collection and I'll be referencing it often.
Amazon Verified review Amazon
Amazon Customer Apr 01, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
PowerShell is as powerful as it sounds. If you're looking to automate tasks with PowerShell in an environment where you manager windows servers, this is a great book. It goes over all the necessary management you need to do for server administration, using PowerShell to automate it. Not only is the book thorough and detailed, but it simplifies the concepts well enough any beginner who isn't as familiar to learn from it. It was simple for me to read, as a beginner in automating windows server tasks. This book is a great tool to keep in my arsenal whenever I'll need to reference. Anyone can pick this up and learn something useful about PowerShell!
Amazon Verified review Amazon
Tiffany Harper Apr 01, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
My favorite part about the book is its organization. The book is organized into chapters, focusing on specific areas of Windows Server administration, such as Active Directory, Group Policy, and Hyper-V. This is really helpful for me as I'm starting a new IAM Analyst role and I'll be able to put this book to use on the job. With that being said, the book structure makes it easy for readers to find the information they need and to apply the techniques they learn to their own environments.I also love the practical focus because I'm a hands-on learner. The author provides numerous examples of PowerShell scripts and commands that can be used to automate common administrative tasks on Windows servers. Each example is explained in detail, with step-by-step instructions and screenshots to help readers understand how the script works.I definitely recommend this book to those working with PowerShell in any capacity.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.