In PowerShell, administrative tasks are generally performed by cmdlets, which are specialized .NET classes implementing a particular operation.
These work by accessing data in different data stores, like the file system or registry, which are made available to PowerShell via providers.
- PowerShell Overview
- Brushing up on objects
- PowerShell Versions
- Windows PowerShell versus PowerShell Core
- Concepts and Terminology
- Getting Commands
- Getting Help
- Providers and Drives
The Windows PowerShell Integrated Scripting Environment (ISE) is a host application for Windows PowerShell.
In Windows PowerShell ISE, you can run commands and write, test, and debug scripts in a single Windows-based graphic user interface
with multiline editing, tab completion, syntax coloring, selective execution, context-sensitive help, and support for right-to-left languages.
In addition to the PowerShell ISE, PowerShell is also well-supported in Visual Studio Code.
Furthermore, the ISE is not supported with PowerShell Core, while Visual Studio Code is supported for PowerShell Core on all platforms (Windows, macOS, and Linux).
- PowerShell Console
- Integrated Scripting Environment (ISE)
- Visual Studio Code
The Windows PowerShell design integrates concepts from many different environments.
Several of them are familiar to people with experience in specific shells or programming environments, but very few people will know about all of them.
Looking at some of these concepts provides a useful overview of the shell.
- Viewing Object Structure
- Object Pipeline
- Using Format Cmdlets to Change Output
- Export Data with Out Cmdlets
- Using Variables to Store Objects
- Working with the Object cmdlets: Where-Object, Foreach-Object, ...
Working with Objects
PowerShell provides full access to COM, WMI and .NET, enabling administrators to perform administrative tasks on both local and remote Windows systems.
- Files and Folders
- Registry Keys and Values
- COM Objects
- WMI Objects
- .NET Objects
- Static Classes
Extending PowerShell Functionality
A module is a set of related Windows PowerShell functionalities, grouped together as a convenient unit (usually saved in a single directory).
By defining a set of related script files, assemblies, and related resources as a module, you can reference, load, persist, and share your code much easier than you would otherwise.
PowerShell Package Manager allows you to find, install and remove software all from within PowerShell from various repositories on the Internet and without having to search around the Internet or your network to find software installers.
- Package Manager
- PowerShell Gallery
- PowerShell Profiles
- Operators and Expressions
PowerShell Remoting lets you run PowerShell commands or access full PowerShell sessions on remote Windows systems.
- PowerShell Remoting Overview
- WS-Management (WSMAN)
- Remote CIM Sessions
- Import/Export Remote Sessions
- WinRM Security
- WinRM Double Hop Problem
- Remoting with PowerShell Core
The execution policy is part of the security strategy of Windows PowerShell.
It determines whether you can load configuration files and run scripts, and it determines which scripts, if any, must be digitally signed before they will run.
- PowerShell Execution Policy
- Script Signing
- Security Sensitive Information in Scripts
Windows PowerShell includes a dynamically typed scripting language which can implement complex operations using cmdlets imperatively.
The scripting language supports variables, functions, branching, loops, structured error/exception handling and closures/lambda expressions, as well as integration with .NET.
- While – do while – do until
- If - Switch
- Break - Continue
Managing Your Environment
The goal of PowerShell is to ease your work as an administrator. In this module we will talk about basic management tasks that you need
to perform and how you can accomplish this through PowerShell.
Configuring network settings, settings security on files and folders, managing Active Directory.
- File Shares
- Data Import
- Server Management
- Active Directory
Jobs are long-running tasks that are executed in the background. You don't have to wait for the job to finish and can perform other tasks while the job is running.
Once completed, the job output can be retrieved. Jobs can be executed on a remote system or they can be scheduled.
- Background Jobs
- Remoting Jobs
- Scheduled Jobs
With the out of the box possibilities, you can easily debug your scripts before running them in production.
You can set breakpoints and use standard debugging options like step over, step into, step out.
To modify the default PowerShell error handling behavior, you can write a try-catch statement and run special code when errors are encountered.
- Debugging options
- Error Handling
- Trap Statement
- Try - Catch Statement
DevOps: Desired State Configuration
DSC allows for declaratively specifying how a software environment should be configured. Upon running a configuration, DSC will ensure that the system gets the state described in the configuration.
DSC configurations are idempotent. The Local Configuration Manager (LCM) periodically polls the system using the control flow described by resources to make sure that the state of a configuration is maintained.
- Desired State Configuration Overview
- DSC Components: Configuration - Node - Resource
- Apply DSC Configurations
- Push versus Pull Mode
- Azure Automation DSC
Turn your real time management and automation scripts into useful reusable tools and cmdlets.
Use PowerShell to create your own modules.
- Script Basics
- Advanced Functions
- Advanced Parameter Configuration
- Command Documentation
- Creating a PowerShell Module
JEA: Just Enough Administration
Just Enough Administration (JEA) is a security technology that enables delegated administration for anything that can be managed with PowerShell.
JEA allows you to reduce the number of administrators on your machines by leveraging virtual accounts or group managed service accounts that perform privileged actions on behalf of regular users.
It limits what users can do by specifying which cmdlets, functions, and external commands they can run.
- JEA Overview
- Role Capabilities
- Session Configurations
- Register JEA Endpoint
- Auditing and Reporting
PowerShell on Linux
PowerShell Core is an open-source cross-platform version of PowerShell, that not only runs on Windows, but runs on macOS and Linux as well.
PowerShell Core packages are available for Windows 7+, Ubuntu, Redhat, Centos, macOS, Fedora, OpenSuse, and Debian.
This allows system administrators to use a common administrative scripting language on all the servers they manage.
- Install PowerShell Core on Linux
- Manage Linux Systems
- Manage Windows Systems from Linux
- Remoting over SSH