PowerShell Fast Track / Быстрый путь к PowerShell Год издания: 2025 Автор: Sukhija Vikas / Сукхиджа Викас Издательство: Apress Media LLC ISBN: 979-8-8688-1157-9 Язык: Английский Формат: PDF Качество: Издательский макет или текст (eBook) Количество страниц: 179 Описание: Create complex scripts in PowerShell and learn how to connect them to cloud services like Azure and Azure AD. This updated version of the book will help you learn PowerShell by providing small "cheat" snippets that you can combine to write efficient and effective scripts. New to the book: PowerShell 5 to PowerShell 7 upgrade throughout the text New code Snippets for AWS and other technologies. New Chapter on error reporting PowerShell Fast Track starts with the basics of PowerShell before moving on to discuss functions like date and logs, along with concepts such as inputs for your scripts. Author Vikas Sukhija then walks you through interactive input and Snapins modules, where you will learn GUI button prompts and how to import sessions. He'll then show you how to report errors through email and log errors to a text file. Reporting CSV (Comma Separate Value) is discussed next, followed by a demonstration of miscellaneous functions, including how to connect your PowerShell scripts with Azure, SharePoint, Teams and other services. As you progress further, you'll see how PowerShell provides powerful features for automation that can be leveragedfor managing your Teams workload. Finally, using practical examples, you will learn how to implement and create scripts for day-to-day usage. After reading this book, you will be able to hit the ground running and use PowerShell's powerful features in your own work. What You Will Learn: Utilize code Snippets to perform practical tasks Combine the code to create more complex scripts. Logging and reporting Connect to various products such as Exchange, SharePoint, Teams, and AzureAD Who This Book Is For: System administrators. Создавайте сложные скрипты в PowerShell и узнайте, как подключать их к облачным сервисам, таким как Azure и Azure AD. Эта обновленная версия книги поможет вам освоить PowerShell, предоставляя небольшие "читерские" фрагменты, которые вы можете комбинировать для написания эффективных сценариев. Новое в книге: По всему тексту обновлен PowerShell с 5 до PowerShell 7. Добавлены новые фрагменты кода для AWS и других технологий. Новая глава, посвященная сообщению об ошибках Краткий обзор PowerShell начинается с основ PowerShell, а затем мы переходим к обсуждению таких функций, как дата и журналы, а также таких концепций, как ввод данных для ваших сценариев. Затем автор Викас Сухия познакомит вас с модулями интерактивного ввода и Snapins, где вы узнаете о подсказках к кнопкам графического интерфейса и о том, как импортировать сеансы. Затем он покажет вам, как сообщать об ошибках по электронной почте и записывать их в текстовый файл. Далее обсуждается создание отчетов в формате CSV (значение, выделенное запятой), после чего демонстрируются различные функции, в том числе способы подключения ваших сценариев PowerShell к Azure, SharePoint, Teams и другим службам. По мере продвижения вы увидите, как PowerShell предоставляет мощные возможности для автоматизации, которые можно использовать для управления рабочей нагрузкой вашей команды. Наконец, на практических примерах вы узнаете, как внедрять и создавать сценарии для повседневного использования. Прочитав эту книгу, вы сможете приступить к работе и использовать мощные возможности PowerShell в своей собственной работе. Что вы узнаете: Используйте фрагменты кода для выполнения практических задач Комбинируйте код для создания более сложных сценариев. Ведение журнала и создание отчетов Подключение к различным продуктам, таким как Exchange, SharePoint, Teams и AzureAD Для кого предназначена эта книга: Системные администраторы.
Примеры страниц (скриншоты)
Оглавление
About the Author .................................................................................................vii About the Technical Reviewer .................................................................................ix Chapter 1: PowerShell Basics .................................................................................1 Variables and On-Screen Printing ............................................................................4 If/Else .................................................................................................................10 Conditional/Logical Operators .................................................................................12 Logical Operators ..................................................................................................13 Switch .................................................................................................................15 Loops ..................................................................................................................16 For Loop and While Loop ........................................................................................17 For Loop ..............................................................................................................17 While Loop ..........................................................................................................20 Functions ............................................................................................................22 Summary ............................................................................................................24 Chapter 2: Date and Logs ......................................................................................25 Date Manipulation .................................................................................................28 Creating Folders Based on a Date ...........................................................................29 Ready-Made Date and Log Functions .......................................................................30 Summary ............................................................................................................41 Chapter 3: Input to Your Scripts .............................................................................43 Import-CSV .........................................................................................................44 Importing from a Text File .....................................................................................48 Input from an Array .............................................................................................50 User Input with Prompts .......................................................................................51 Summary ............................................................................................................53 Chapter 4: Interactive Input ..................................................................................55 Read-Host ...........................................................................................................55 Input Parameters .................................................................................................57 GUI Button ..........................................................................................................59 Prompt (Yes or No) ...............................................................................................64 Summary ............................................................................................................66 Chapter 5: Modules ..............................................................................................69 PowerShell Snap-Ins .............................................................................................69 Modules ..............................................................................................................72 Cheat Module (vsadmin) .......................................................................................75 Summary ............................................................................................................93 Chapter 6: Alerting (Email) ...................................................................................95 Formatting a Message Body ...................................................................................97 Sending HTML .....................................................................................................98 Sending Email—PowerShell Graph SDK ..................................................................100 Summary ..........................................................................................................103 Chapter 7: Error Reporting ..................................................................................105 Reporting Errors Through Email ............................................................................105 Logging Everything Including Errors ......................................................................109 Logging Errors to a Text File .................................................................................110 Try Catch ...........................................................................................................111 Summary ..........................................................................................................112 Chapter 8: Reporting ..........................................................................................115 CSV Report ........................................................................................................115 Excel Reporting ..................................................................................................120 HTML Reporting ..................................................................................................125 Summary ..........................................................................................................130 Chapter 9: Miscellaneous Keywords .......................................................................131 Split ..................................................................................................................132 Replace .............................................................................................................133 Select-String .....................................................................................................134 Compare-Object ................................................................................................135 Summary .........................................................................................................139 Chapter 10: Gluing It All Together .......................................................................141 Product Examples (Daily Use) ............................................................................147 Microsoft Exchange ..........................................................................................147 Clean Database so That Mailboxes Appear in a Disconnected State .........................147 Find Disconnected Mailboxes ............................................................................148 Extract Message Accept From .........................................................................148 Active Sync Stats .........................................................................................148 Message Tracking ........................................................................................148 Search Mailbox/Delete Messages ..................................................................149 Exchange Quota Report ...............................................................................149 Set Quota .................................................................................................151 Active Directory .........................................................................................151 Exporting Group Members ...........................................................................152 Setting Values for AD Attributes ...................................................................153 Exporting Active Directory Attributes ...........................................................153 Adding Members to the Group from a Text File ..............................................159 Removing Members of the Group from a Text File ..........................................160 Office 365 ................................................................................................161 Exchange Online Mailbox Report ..................................................................164 Exchange Online Message Tracking ..............................................................165 Searching a Unified Log ..............................................................................166 Azure AD (Entra) .......................................................................................167 Adding Users to an Azure AD Group from a Text File of UPN .............................167 Removing Users in an Azure AD Group from a Text File of UPN ..........................168 Checking If a User Is Already a Member of a Group ..........................................168 Adding Administrators to a Role .....................................................................168 Checking for Azure AD User Provisioning Errors .................................................169 Microsoft Graph Module ....................................................................................169 AWS PowerShell Module ...................................................................................171 Text/CSV File Operations ...................................................................................172 Regex ................................................................................................................173 Summary ..........................................................................................................175 Index ................................................................................................................177
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum