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

Configuring Hyper-V networking


In the Creating a virtual machine recipe, you created a VM, VM1. This virtual machine has, by default, a single network card that Hyper-V sets to acquire IP address details from DHCP. In this recipe, you assign the NIC to a switch and configure IP address details.

Getting ready

This recipe assumes you have created VM1 as per the Creating a virtual machine recipe. The recipe also makes use of a DHCP server running on DC1. You set this DHCP server up in the Installing and authorizing a DHCP Server recipe, and configured the DHCP server in the Configure DHCP scopes recipe, in Chapter 8, Managing Windows Network Services.

How to do it...

Here you see how to configure Hyper-V networking:

  1. Get NIC details and any IP Address from the VM1 VM:
      Get-VMNetworkAdapter -VMName VM1
  1. Get VM networking details:
      $user = 'Localhost\Administrator' 
      $pass =  ConvertTo-SecureString -String 'Pa$$w0rd' `
               -AsPlainText -Force
      $cred = New-Object -TypeName...