Skip to content

Commit

Permalink
AZ-040
Browse files Browse the repository at this point in the history
  • Loading branch information
rramoscabral committed Sep 12, 2024
1 parent 6fbb8ee commit f7e9a8b
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 4 deletions.
66 changes: 66 additions & 0 deletions docs/06TrainerDemos.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,46 @@ has_children: false
<!-- Demonstrations -->
- **Querying CIM, WMI and WQL**
```powershell
# 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:'"
```
<br/>
Expand All @@ -105,6 +145,32 @@ has_children: false
<!-- Demonstrations -->
- **If Statement**
```powershell
$x = 9
$y = 0
if ($x -lt $y)
{
Write-Host "OI"
}
else
{
Write-Error "Erro"
}
```
- **Function**
```powershell
Function Get-ServerData
{
Param ($ComputerName)
Get-CimInstance -Class Win32_OperatingSystem -ComputerName $ComputerName
}
```
<br/>
Expand Down
13 changes: 9 additions & 4 deletions docs/07TrainerReferences.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ has_children: false
| Lessons | Notes |
| --- | ---
| Review CIM and WMI | - [Distributed Management Task Force (DMTF)](https://www.dmtf.org/) |
| Query configuration information by using CIM and WMI | -[Weekend Scripter: The WMI Explorer Tool](https://devblogs.microsoft.com/scripting/weekend-scripter-the-wmi-explorer-tool/) |
| Query configuration information by using CIM and WMI | - [Weekend Scripter: The WMI Explorer Tool](https://devblogs.microsoft.com/scripting/weekend-scripter-the-wmi-explorer-tool/) |
| Query and manipulate repository objects by using CIM and WMI methods | |


Expand All @@ -91,11 +91,16 @@ has_children: false

## Learning Path 7: Windows PowerShell scripting

<!--

| Lessons | Notes |
| --- | ---
| --- | --- |
-->
| Create and run scripts by using Windows PowerShell | |
| Work with scripting constructs in Windows PowerShell | - [foreach statemen](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_foreach) <br> - [if statement](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_if) <br> - [switch statement](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_switch) |
| Import data in different formats for use in scripts by using Windows PowerShell cmdlets | |
| Use methods to accept user inputs in Windows PowerShell scripts | |
| Troubleshoot scripts and handle errors in Windows PowerShell | |
| Use functions and modules in Windows PowerShell scripts | |



<br/>
Expand Down

0 comments on commit f7e9a8b

Please sign in to comment.