Skip to content

Instantly share code, notes, and snippets.

View rossarioking's full-sized avatar

Rossario King rossarioking

  • Dublin
View GitHub Profile
@rossarioking
rossarioking / Get-Member.ps1
Created March 7, 2020 18:23
Working with Get-Member Command #PowerShell
# 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
@rossarioking
rossarioking / Bootstrap to Install Apache on Amazon Linux 2
Last active March 28, 2020 20:15
Bootstrap to install Apache on Amazon Linux 2
#!/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
@rossarioking
rossarioking / Create VM with Azure CLI.txt
Created January 19, 2023 20:56
Create VM with Azure CLI
az vm create \
--resource-group learn-eb27549d-6f40-4a1c-852e-edc60ea4e9b8 \
--name my-vm \
--image UbuntuLTS \
--admin-username azureuser \
--generate-ssh-keys
@rossarioking
rossarioking / Add Tags to a VM in Azure.txt
Created July 27, 2023 10:29
Adding Tags to a VM in Azure
az vm update -g "395-fc169a22-add-remove-and-update-tags-for-resou" -n webvm1 --set tags.MarkForDeletion=Yes
@rossarioking
rossarioking / Terraform_WebApp_Lab.tf
Created July 27, 2023 13:34
Deploy a Web Application with Terraform
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "= 2.99"
}
}
}
provider "azurerm" {
@rossarioking
rossarioking / Azure_Resize VMs in the Availability Set.txt
Created August 30, 2023 20:26
Azure_Resize VMs in the Availability Set
$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.
@rossarioking
rossarioking / Monitoring CPU Usage with Powershell.ps1
Last active September 23, 2023 14:07
Monitoring CPU Usage with Powershell
Get-Counter '\Processor(_Total)\% Processor Time' -Continuous | ForEach-Object {Write-Host "CPU Usage: $($_.CounterSamples[0].CookedValue)%"; Start-Sleep -Seconds 5}
@rossarioking
rossarioking / Monitoring Memory Usage with Powershell.ps1
Created September 23, 2023 13:57
Monitoring Memory Usage with Powershell
Get-Counter '\Memory\Available MBytes' -Continuous | ForEach-Object {Write-Host "Available Memory: $($_.CounterSamples[0].CookedValue) MB"; Start-Sleep -Seconds 10}
@rossarioking
rossarioking / Monitoring Disk Space with Powershell.ps1
Created September 23, 2023 13:58
Monitoring Disk Space with Powershell
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"
}
@rossarioking
rossarioking / Monitoring Event Logs with Powershell.ps1
Created September 23, 2023 14:00
Monitoring Event Logs with Powershell
Get-EventLog -LogName System -EntryType Error -After (Get-Date).AddHours(-1) | ForEach-Object {
Write-Host "Error Event Found: $($_.Message)"
}