This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Get-Member - Gets Properties and Methods of Objects - Used to see what makes up an Object. | |
| Get-Service | Get-Member | |
| TypeName: System.Service.ServiceController#StartupType | |
| Name MemberType Definition | |
| ---- ---------- ---------- | |
| Name AliasProperty Name = ServiceName |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Get Root Privilages | |
| sudo su | |
| # Install httpd (Amazon Linux v2) | |
| yum update -y | |
| yum install -y httpd.x86_64 | |
| systemctl start httpd.service |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| az vm create \ | |
| --resource-group learn-eb27549d-6f40-4a1c-852e-edc60ea4e9b8 \ | |
| --name my-vm \ | |
| --image UbuntuLTS \ | |
| --admin-username azureuser \ | |
| --generate-ssh-keys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| terraform { | |
| required_providers { | |
| azurerm = { | |
| source = "hashicorp/azurerm" | |
| version = "= 2.99" | |
| } | |
| } | |
| } | |
| provider "azurerm" { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $vm = Get-AzVM -ResourceGroupName <RESOURCE_GROUP_NAME> -VMName labVM0 | |
| $vm.HardwareProfile.VmSize = "Standard_B1s" | |
| Update-AzVM -VM $vm -ResourceGroupName <RESOURCE_GROUP_NAME> | |
| \\\To view results of the change, enter Get-AzVM. We should see VMSize for labVM0 changed to Standard_B1s. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get-Counter '\Processor(_Total)\% Processor Time' -Continuous | ForEach-Object {Write-Host "CPU Usage: $($_.CounterSamples[0].CookedValue)%"; Start-Sleep -Seconds 5} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get-Counter '\Memory\Available MBytes' -Continuous | ForEach-Object {Write-Host "Available Memory: $($_.CounterSamples[0].CookedValue) MB"; Start-Sleep -Seconds 10} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get-WmiObject Win32_LogicalDisk | Where-Object { $_.DriveType -eq 3 } | ForEach-Object { | |
| $disk = $_ | |
| $freeSpace = [math]::Round($disk.FreeSpace / 1GB, 2) | |
| $totalSpace = [math]::Round($disk.Size / 1GB, 2) | |
| Write-Host "$($disk.DeviceID) - Free Space: ${freeSpace}GB / Total Space: ${totalSpace}GB" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get-EventLog -LogName System -EntryType Error -After (Get-Date).AddHours(-1) | ForEach-Object { | |
| Write-Host "Error Event Found: $($_.Message)" | |
| } |