Book Image

Windows Server 2016 Automation with PowerShell Cookbook - Second Edition

By : Thomas Lee, Ed Goad
Book Image

Windows Server 2016 Automation with PowerShell Cookbook - Second Edition

By: Thomas Lee, Ed Goad

Overview of this book

This book showcases several ways that Windows administrators can use to automate and streamline their job. You'll start with the PowerShell and Windows Server fundamentals, where you'll become well versed with PowerShell and Windows Server features. In the next module, Core Windows Server 2016, you'll implement Nano Server, manage Windows updates, and implement troubleshooting and server inventories. You'll then move on to the Networking module, where you'll manage Windows network services and network shares. The last module covers Azure and DSC, where you will use Azure on PowerShell and DSC to easily maintain Windows servers.
Table of Contents (21 chapters)
Title Page
Credits
About the Author
Acknowledgment
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Installing and authorizing a DHCP server


Installing and authorizing a DHCP server is easy and straightforward. You can use the GUI, Server Manager to achieve this. Server Manager, though, is a GUI layered on top of PowerShell. The GUI gathers the details, and PowerShell does the rest. In this recipe, you carry out the installation and basic configuration using just the native cmdlets.

Getting ready

This recipe installs a DHCP server on DC1. You need that system up and running.

How to do it...

  1. Login to DC1, and add the DHCP server feature to your system:
Install-WindowsFeature -Name DHCP `                         -IncludeManagementTools
  1. Add the DHCP server's security groups:
Add-DHCPServerSecurityGroup -Verbose
  1. Let DHCP know it's all configured:
Set-ItemProperty `
         -Path HKLM:\SOFTWARE\Microsoft\ServerManager\Roles\12 `  -Name ConfigurationState `     -Value 2
  1. Authorize the DHCP server in Active Directory:
Add-DhcpServerInDC -DnsName DC1.Reskit.Org
  1. Restart DHCP:
Restart-Service -Name DHCPServer...