This file contains 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
function Get-AzSystemUptime { | |
param ( | |
[string] $resourceGroup, | |
[string] $vmName | |
) | |
$osType = (Get-AzVM -ResourceGroupName $resourceGroup -Name $vmName).StorageProfile.OsDisk.OsType | |
if ($osType -eq 'Windows') { | |
Write-Output "Getting System Uptime for $vmName in $resourceGroup..." | |
Write-Warning "This may take up to 35 seconds" |
This file contains 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 | |
# Microsoft Hyper-V Intergration Services (Ubuntu/Debian Install Script) | |
# Author: Simon Lee | |
# Script Revision: 1.0 | |
# Description: Install linux-virtual kernal for Ubuntu/Debian Server | |
# Clear Current Screen | |
clear | |
# Check Session Status |
This file contains 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 the value of a REG_BINARY from the registry | |
$value = Get-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\Path\To\Your\Key" -Name "ValueName" | |
# Convert the REG_BINARY value to a readable format | |
$readableValue = [System.BitConverter]::ToString($value.ValueName) | |
# Display the readable format | |
Write-Output $readableValue |
This file contains 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
# AutoBuild Operating System Installation | |
if ($autoBuild) { | |
Write-Output `r "ABC :: AutoBuild is enabled, Applying Operating System Image..." `r | |
Write-Output "ABC :: Checking AutoBuild Configuration..." `r | |
Write-Output "ABC :: VM Generation: [$hvGeneration]" | |
Write-Output "ABC :: Iso Path: [$isoPath]" | |
# Mount OS Disk | |
Write-Output `r "ABC :: Mounting OS Disk" | |
$osDiskContext = Mount-VHD -Path $osDiskPath | Out-Null |
This file contains 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
This is a public gist | |
created in January 2024 | |
to show case Hugo Gist Shorcodes. | |
- Created by Simon, 16-01-2024 |
This file contains 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
## This Script is intended to be used for Querying remaining time and resetting Terminal Server (RDS) Grace Licensing Period to Default 120 Days. | |
## Developed by Veli Kadir KOZAN(kadir@kadirkozan.com.tr) June 20th 2021 | |
## www.kadirkozan.com.tr | |
Clear-Host | |
$ErrorActionPreference = "SilentlyContinue" | |
## Display current Status of remaining days from Grace period. | |
$GracePeriod = (Invoke-WmiMethod -PATH (gwmi -namespace root\cimv2\terminalservices -class win32_terminalservicesetting).__PATH -name GetGracePeriodDays).daysleft | |
Write-Host -fore Green ====================================================== |
This file contains 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
Set-Location C:\Code\<repo-name> | |
# Create me a File | |
$i = (Get-Item *.txt).Count + 1 ; New-Item file$i.txt |
This file contains 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
# Enhanced Session HvBus | |
``` pwsh | |
Set-VM ubuntu -EnhancedSessionTransportType HvSocket | |
https://github.com/Hinara/linux-vm-tools | |
wget https://raw.githubusercontent.com/Hinara/linux-vm-tools/ubuntu20-04/ubuntu/22.04/install.sh | |
Reboot |
This file contains 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
> [!NOTE] | |
> Highlights information that users should take into account, even when skimming. | |
> [!TIP] | |
> Optional information to help a user be more successful. | |
> [!IMPORTANT] | |
> Crucial information necessary for users to succeed. | |
> [!WARNING] |
This file contains 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
# Function to convert seconds to a readable format | |
function ConvertToReadableTime { | |
param ( | |
[int]$uptimeSeconds | |
) | |
$uptime = New-TimeSpan -Seconds $uptimeSeconds | |
"{0} days, {1} hours, {2} minutes, {3} seconds" -f $uptime.Days, $uptime.Hours, $uptime.Minutes, $uptime.Seconds | |
} | |
# Get the hostname |
NewerOlder