Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Trainer demonstrations

Table of contents

  1. Learning Path 1: Get started with Windows PowerShell
  2. Learning Path 02: Maintain system administration tasks in Windows PowerShell
  3. Learning Path 03: Working with the Windows PowerShell pipeline
  4. Learning Path 04: Work with PowerShell providers and PowerShell drives in Windows PowerShell
  5. Learning Path 05: Query management information by using Common Information Model and Windows Management Instrumentation
  6. Learning Path 06: Working with variables, arrays, and hash tables
  7. Learning Path 07: Windows PowerShell scripting
  8. Learning Path 08 Administer remote computers with Windows PowerShell:
  9. Learning Path 09: Manage cloud resources by using Windows PowerShell
  10. Learning Path 10: Manage Microsoft 365 services by using Windows PowerShell
  11. Learning Path 11: Create and manage background jobs and scheduled jobs in Windows PowerShell




Learning Path 1: Get started with Windows PowerShell

  • Getting started with Windows PowerShell

      #Switch Powershell Engine
      PowerShell.exe -Version 2
    
      #View Powershell Version
      $psversiontable.psversion
    




Learning Path 02: Maintain system administration tasks in Windows PowerShell




Learning Path 03: Working with the Windows PowerShell pipeline




Learning Path 04: Work with PowerShell providers and PowerShell drives in Windows PowerShell




Learning Path 05: Query management information by using Common Information Model and Windows Management Instrumentation

  • Querying CIM, WMI and WQL

      # List all classes
      Get-CimClass Namespace root\CIMv2 | Sort CimClassName
      Get-WmiObject -Namespace root\cimv2 List |  Sort Name
    
    
    
      # WMI
      Get-CimClass Win32_Volume
    
      # CIM
      Get-CimClass CIM_storagevolume 
    
    
      # View Services
      Get-WmiObject Class Win32_Service
    
      # View Proccess
      Get-CimInstance ClassName Win32_Process
    
    
      #Querying CIM
    
      (Get-CimInstance -ClassName Cim_StorageVolume).where({$PSItem.DriveLetter -eq 'C:'})
        
      Get-CimInstance -ClassName CIM_StorageVolume | where driveletter -eq "C:"
    
    
      # Querying CIM vs WMI
      Get-CimInstance -ClassName Win32_LogicalDisk -ComputerName $env:COMPUTERNAME
    
      Get-WmiObject -ClassName Win32_LogicalDisk -ComputerName $env:COMPUTERNAME
    
      Get-CimInstance Query "SELECT * FROM Win32_LogicalDisk WHERE DeviceID  = 'C:'"
    
      Get-WmiObject Query "SELECT * FROM Win32_LogicalDisk WHERE  DeviceID  = 'C:'"
    




Learning Path 06: Working with variables, arrays, and hash tables




Learning Path 07: Windows PowerShell scripting

  • If Statement
      $x = 9
      $y = 0
    
    
      if ($x -lt $y)
      {
          Write-Host "OI"
      }
      else
      {
          Write-Error "Erro"
      }
    
  • Function

      Function Get-ServerData
      {
          Param ($ComputerName)
          Get-CimInstance -Class Win32_OperatingSystem -ComputerName $ComputerName
      }
    




Learning Path 08 Administer remote computers with Windows PowerShell:




Learning Path 09: Manage cloud resources by using Windows PowerShell




Learning Path 10: Manage Microsoft 365 services by using Windows PowerShell




Learning Path 11: Create and manage background jobs and scheduled jobs in Windows PowerShell