0% found this document useful (0 votes)
224 views

Configuring Windows Server 2019

This document discusses configuring and managing Windows Server 2019 using Server Manager and Windows PowerShell. It covers using Server Manager to monitor servers, installing roles and features, and using PowerShell scripts for administration.

Uploaded by

Omoyemi Oni
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
224 views

Configuring Windows Server 2019

This document discusses configuring and managing Windows Server 2019 using Server Manager and Windows PowerShell. It covers using Server Manager to monitor servers, installing roles and features, and using PowerShell scripts for administration.

Uploaded by

Omoyemi Oni
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 83

Configuring

Windows
Server 2019
Module 2

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 1
Learning Objectives (1 of 2)

After completing this module you should be able to:


• Use Server Manager to monitor and manage Windows Server
systems
• Install and use the Windows Admin Center to monitor and
manage Windows Server systems
• Configure server hardware devices
• Use the System File Checker and Sigverif to verify system files

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 2
Learning Objectives (2 of 2)

After completing this module you should be able to:


• Configure key Windows Server components within Control Panel
and Device Manager
• Explain the purpose and configuration of the Windows Registry
• Identify the components, features, and usage of Windows
PowerShell
• Use Windows PowerShell to manage a server
• Create PowerShell scripts for systems administration

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 3
Working with Server Manager (1 of 10)

• Used to monitor and manage several different Windows Server systems


• Server Manager Dashboard panes
− Dashboard section at the top
− Welcome to Server Manager pane (often hidden by administrators)
− Roles and Server Groups pane
• Dashboard uses various colors and icons
• Additional Server Manager panes
− Events, Services, Best Practices Analyzer, Performance, Roles and Features
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 4
Working with Server Manager (2 of 10)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 5
Working with Server Manager (3 of 10)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 6
Working with Server Manager (4 of 10)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 7
Working with Server Manager (5 of 10)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 8
Working with Server Manager (6 of 10)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 9
Working with Server Manager (7 of 10)

• Server roles introduced starting with Windows Server 2012


− Have configuration tools built into the Server Manager interface
− Example: Storage Spaces
• Some server roles have their own MMC tool for configuration
• Starting an MMC tool
− Navigate to a server group or role section within the navigation area
− Right-click a server in the Servers pane and choose the appropriate tool
− Example: DHCP server role
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 10
Working with Server Manager (8 of 10)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 11
Working with Server Manager (9 of 10)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 12
Working with Server Manager (10 of 10)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 13
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 14
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 15
Adding Roles and Features Using Server
Manager (1 of 7)
• Three different ways to add roles and features within Server Manager
− Selecting Add roles and features from the Welcome to Server Manager pane
within the Dashboard section
− Selecting Add Roles and Features from the Manage menu
− Selecting Add Roles and Features from the Tasks menu within the Roles and
Features pane for a server or server role
• Starting the installation of a role is the same for all three methods
− Use the Add Roles and Features Wizard

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 16
Adding Roles and Features Using Server
Manager (2 of 7)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 17
Adding Roles and Features Using Server
Manager (3 of 7)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 18
Adding Roles and Features Using Server
Manager (4 of 7)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 19
Adding Roles and Features Using Server
Manager (5 of 7)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 20
Adding Roles and Features Using Server
Manager (6 of 7)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 21
Adding Roles and Features Using Server
Manager (7 of 7)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 22
Using the BPA to Verify Server Roles

• BPA scan
− Determines if role configuration meets Microsoft minimum guidelines
− Scan results indicate security level and category for recommendations
• Levels of severity
What is the full form of BPA scan?
− Information, warning, error
Best Practices Analyzer scan
• Categories for BPA recommendations
− Configuration, predeployment, postdeployment, performance, BPA
prerequisites

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 23
Working with the Windows Admin Center

• Server Manager disadvantage


− Needs to connect to Windows Server system to run it
− Need to install the RSAT on a Windows 10 PC
• Windows Admin Center
− Relatively new tool
− Remotely manage Windows Server 2019 using a modern Web browser
− Preferred if hosting large numbers of remote Windows Server systems
− Boasts a wide range of monitoring and management functionality

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 24
Installing the Windows Admin Center (1 of 2)

• Download the desired version (preview or regular)


• Start the installer; navigate through several screens, clicking Next each time
− Accept license
− Automatically update the Windows Admin Center
− Prompt for function capabilities in different scenarios
− Prompt to modify local computer’s trusted host settings
− Prompt on how to generate encryption certificate
• URL to access Admin Center displayed on final screen
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 25
Installing the Windows Admin Center (2 of 2)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 26
Using the Windows Admin Center (1 of 3)

• First use requires log-in with valid credentials


− Prompted to complete a quick tour
• Placed at the connections screen within the Windows Admin Center
− Can manage server hosting the Windows Admin Center
− Can add Windows Server 2012 and later systems and edit tags
• Many similarities to Server Manager
• Many tools within the navigation pane
− Configuration, remote access, Azure cloud integration
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 27
Using the Windows Admin Center (2 of 3)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 28
Using the Windows Admin Center (3 of 3)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 29
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 30
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 31
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 32
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 33
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 34
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 35
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 36
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 37
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 38
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 39
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 40
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 41
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 42
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 43
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 44
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 45
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 46
Configuring Server Hardware Devices

• Many types of hardware devices


• Plug and Play (PnP)
− Operating system works with hardware devices to automatically detect and
configure recently installed hardware to work with the operating system
• Simple PnP device installation process
− Attach device
− Wait for Windows Server 2019 to detect it
− Install appropriate device drivers

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 47
Adding Hardware Using Control Panel (1 of 2)

• Devices and Printers utility


− Force the operating system to detect and install new PnP hardware
− Install non-PnP hardware
− Troubleshoot problems you might be having with existing hardware
• Start Devices and Printers utility from the Control Panel
− Two views: Category view (default) or Classic view
• Sample tasks
− Add device, display device, troubleshoot device
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 48
Adding Hardware Using Control Panel (2 of 2)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 49
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 50
Using Device Manager (1 of 3)

• Device Manager shows all devices on the system


• Open Device Manager from Control Panel to update a device driver
− Generic or Unknown devices require updated drivers for full functionality
− PnP hardware resource must be considered to prevent conflicts
 Interrupt Request (IRQ) line, Input/Output (I/O) address, reserved
memory range
• Can check for a resource conflict and examine other device properties
− Device Properties box has four tabs to review

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 51
Using Device Manager (2 of 3)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 52
Using Device Manager (3 of 3)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 53
Verifying System Files

• System file signatures can become invalid


− Overwritten, corrupted, modified by malware
• System File Checker
− Scans system files for integrity
− Replaces damaged or overwritten files with the proper version
• File Signature Verification tool (Sigverif)
− A scan-only tool that determines if files have a signature
− Output written to a log file called sigverif.txt
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 54
Configuring Windows Settings

• Configurable elements of the operating system


− Performance options
− Environment variables
− Startup and recovery options
− Power options

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 55
Configuring Performance Options (1 of 4)

• Configuring processor scheduling and Data Execution Prevention


− Processor scheduling
 Configures processor resources allocated to a program
− Data Execution Prevention (DEP)
 Monitors server programs for memory use issues
• In Control Panel, navigate to System and Security, and select System
− Select Advanced system settings, click Settings in the Performance section
− Highlight Advanced tab or Data Execution Prevention tab

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 56
Configuring Performance Options (2 of 4)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 57
Configuring Performance Options (3 of 4)

• Configuring virtual memory


• Virtual memory: disk storage used to expand capacity of physical memory
− Uses a paging technique
 Pages move from physical memory into virtual memory on disk
• Paging file: area of disk allocated for virtual memory
− Location of the paging file is important
− Parameters used to tune paging file size: initial size and maximum size
− Configure initial size by multiplying amount of installed RAM times 1.5
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 58
Configuring Performance Options (4 of 4)

• Configuring file caching


• File caching turned on by default
− Speeds up the time it takes to read from or write to a disk
• Flushing
− Freeing memory used for cached data after data written to disk
• Can turn off caching and flushing to easily hot swap a drive
− Server can seem slower to users
− May lose data during hot swap while the server is in use
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 59
Configuring Environment Variables (1 of 2)

• Environment variable
− Tells the operating system where to find certain programs and program-
related information
• System environment variables are defined by the operating system
− Apply to any user logged in to the computer
• User environment variables are defined on a per-user basis
− Used to provide a wide variety of different information

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 60
Configuring Environment Variables (2 of 2)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 61
Configuring Startup and Recovery

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 62
Configuring Power Options (1 of 2)

• Power options that can be set


− Select a power plan
− Choose what the power button does
− Create a power plan
− Choose when to turn off the display
• Three power plans
− Balanced, Power saver, and High performance

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 63
Configuring Power Options (2 of 2)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 64
The Windows Registry

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 65
Windows Registry Contents

• Windows Registry is hierarchical in structure


− Made up of keys, subkeys, and entries
• Windows Server 2019 Registry’s five root keys
− HKEY_LOCAL_MACHINE
− HKEY_CURRENT_USER
− HKEY_USERS
− HKEY_CLASSES_ROOT
− HKEY_CURRENT_CONFIG

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 66
Working with Windows PowerShell (1 of 6)

• Supports MS-DOS shell output redirection (>>) and command chaining (;)
• Most commands run within PowerShell will consist of cmdlets
• Piping (|) sends information between cmdlets to build more complex commands
or filters output to display only the desired output
• Many cmdlets options Cmdlets are case-insensitive, so Get-Host and get-host are equivalent.

− –whatif, –confirm, -verbose, -debug, -erroraction


• PowerShell supports special navigation keys and key combinations
• PowerShell’s features provide additional functionality or increase efficiency
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 67
Working with Windows PowerShell (2 of 6)

• Customizing Windows PowerShell sessions


− Change Windows PowerShell session’s look or how it is executed
− Provide specific options to the PowerShell command
− Creating a PowerShell console file that has a .psc1 extension
• Aliases and functions
− Alias is a command shortcut that makes navigating and using Windows
PowerShell easier
− Functions can execute multiple cmdlets

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 68
Working with Windows PowerShell (3 of 6)

• PowerShell profile scripts


− Alias and function commands placed in a PowerShell profile script
− Automatically executed every time Windows PowerShell started for the user
− Must first enable script execution before making the script
− Edit PowerShell profile using the command notepad $profile within
PowerShell
• Modifying command output
− Pipe output, -recurse option, Sort-Object, Group-Object,
ConvertTo-HTML, Export-CSV
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 69
Working with Windows PowerShell (4 of 6)

• PowerShell objects
− Object has attributes (properties that describe the object)
− Methods (things that the object can do)
− Control nearly all aspects of the Windows operating system
 Processes, files, and network sockets

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 70
Working with Windows PowerShell (5 of 6)

• PowerShell provider plugins


− Provide functionality within Windows PowerShell
− Allow PowerShell to interact with other parts of the system
• Filesystem provider: default provider
• Many other providers
− Variable provider, environment provider, alias provider, function provider,
certificate provider, registry provider
• Many cmdlets supported

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 71
Working with Windows PowerShell (6 of 6)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 72
System Administration Commands

• PowerShell can be used for many tasks


− Post-installation tasks
− View, install, and remove Windows roles and features
− Configure and troubleshoot the network and configure firewall settings
− Manage services and processes
− Perform remote administration of computers within a domain environment
• Cmdlets allow an administrator to specify the computer name for a task
• Can execute a PowerShell script on several computers within a domain
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 73
Using WMI within Windows PowerShell

• WMI consumers: programs and system software that can query WMI
• WMI infrastructure: collective components built into the operating system that
respond to WMI queries
− WMI namespaces, WMI providers, WMI classes
• CIMv2 namespace (Common Information Model version 2)
− Queries hardware and software components on systems
− Modifies software components
• Real power of WMI: within WMI classes administrators query and manipulate

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 74
Creating PowerShell Scripts (1 of 8)

• PowerShell script
− Text file with a .ps1 extension executed within Windows PowerShell
− Commands execute from top-to-bottom
− Contents
 Windows commands, PowerShell cmdlets, complex control structures
− Can reuse Windows PowerShell code in different situations

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 75
Creating PowerShell Scripts (2 of 8)

• Executing PowerShell scripts


− Enable script support in Windows PowerShell and verify execution policy
− Execute a PowerShell script in PowerShell
 Full path: C:\scripts\myscript.ps1
 Relative path (within the C:\scripts directory): .\myscript.ps1 or
./myscript.ps1
− Execute a PowerShell script outside PowerShell
 Run PowerShell command in the Windows Run dialog box Command
Prompt window, supply script path as an argument
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 76
Creating PowerShell Scripts (3 of 8)

• Using Windows PowerShell ISE


− Windows Server 2019 start menu shows Windows PowerShell ISE
− Click the Script icon above the Windows PowerShell pane
 Opens a new PowerShell script in the upper pane called Untitled.ps1
 Modify, test, and save with a descriptive name
• Can create and test scripts on remote computers
− Need winRM started within Windows PowerShell ISE

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 77
Creating PowerShell Scripts (4 of 8)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 78
Creating PowerShell Scripts (5 of 8)

• Variables and constants store a value in memory for later use


− Variable and array variable values can be changed after being set
 PowerShell variables start with a $, not case sensitive
 Avoid special characters and reserved words within a variable name
 Use Set-Variable cmdlet
 Add -option constant to the Set-Variable cmdlet to create a
constant variable
 Prefix the variable with a type cast to change text string behavior
− Constant values cannot be changed
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 79
Creating PowerShell Scripts (6 of 8)

• Protecting PowerShell metacharacters


− Double-quotes ("), single-quotes ('), back-quote (`)
• Coloring and formatting output eases readability
− Many cmdlets allow for the modification of the output color
− Separator characters used when printing several variables
• Decision constructs allow modification of the flow of a PowerShell script
− Must have condition that returns true or false
− Compare data with operators, use the if and switch constructs
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 80
Creating PowerShell Scripts (7 of 8)

Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 81
Creating PowerShell Scripts (8 of 8)

• Loop constructs allow the performance of a task several times


− foreach, for, while, do...while, and do...until
• Creating your own PowerShell scripts
− Start small, use comments
− Ensure script allows the cmdlets to operate on different objects
• Finding PowerShell scripts on the Internet
− Use Web sites with reusable PowerShell scripts organized by function
− Search the Internet using a search engine such as Google
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 82
Summary

• Many tools help with the configuration process


− Server Manager adds roles
− BPA verifies role and server function configuration
− Windows Admin Center provides remote Web-based management
− Devices and Printers tool and Device Manager tool configure devices
− Many performance option settings can be configured
• Window Registry stores configurations used by Windows Server 2019
• PowerShell console files and profile scripts ease administration
Eckert/triOS College, Hands-On Microsoft Windows Server, 3rd Edition. ©2021 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole
or in part. 83

You might also like