Skip to content

Instantly share code, notes, and snippets.

View PanosGreg's full-sized avatar

Panos Grigoriadis PanosGreg

  • Dublin, Ireland
View GitHub Profile
@PanosGreg
PanosGreg / get_env_variables_jwts.yaml
Created January 30, 2026 14:10
GitHub Actions Workflow that shows JWTs and Env Variables
name: Get Environment Variables and JWTs
# This workflow was tested on a self-hosted windows runner (Windows Server 2025)
# On the VM, PowerShell v7.5.4 was installed and was used for this workflow as the shell
# The GitHub Actions Runner service version was v2.331.0.0 (Jan-2026)
on:
workflow_dispatch:
defaults:
@PanosGreg
PanosGreg / ConvertFrom-JwtToken.ps1
Created January 30, 2026 13:45
Convert JWT Blob to an object
function ConvertFrom-JwtToken {
<#
.DESCRIPTION
Decodes a JWT token. This was taken from link below. Thanks to Vasil Michev.
.LINK
https://www.michev.info/Blog/Post/2140/decode-jwt-access-and-id-tokens-via-powershell
#>
[OutputType([System.Collections.Specialized.OrderedDictionary])]
[cmdletbinding()]
param(
@PanosGreg
PanosGreg / DNSME-API.ps1
Last active November 27, 2025 17:24
DNS Made Easy helper functions. Might expand and write a proper module for this at some stage.
<#
.SYNOPSIS
DNS Made Easy helper functions
Context: I needed to do some bulk operations in DNS Made Easy at work,
I didn't find anything adequate online and so I wrote this.
.DESCRIPTION
This file exposes 3 functions, an enum and a class.
@PanosGreg
PanosGreg / ServiceCertificate.ps1
Created October 20, 2025 07:33
Functions to Get/Delete/Import a certificate from/on a windows service
# This file contains the following functions:
# Import-ServiceCertificate - Import a PFX certificate to a service cert store
# Get-ServiceCertificate - Get the certificates of a service
# Remove-ServiceCertificate - Delete a certificate from a service
#Requires -RunAsAdministrator
function Import-ServiceCertificate {
@PanosGreg
PanosGreg / Get-ImageFromHub.ps1
Created October 4, 2025 15:57
Find the docker image from Docker Hub, for the current Windows Server OS
function Get-ImageFromHub {
<#
.SYNOPSIS
Find the docker image for the current Windows Server OS from Docker Hub.
Additionally it can also inspect the image and get its size (from all of its layers)
NOTE: This function does not download the docker image, just its metadata.
The -ShowSize switch requires the docker tool.
.EXAMPLE
Get-ImageFromHub -ShowSize
@PanosGreg
PanosGreg / Get-ProcessWithService.ps1
Last active October 5, 2025 18:00
Get the processes along with their relevant service (if any), just like "tasklist /svc"
function Get-ProcessWithService {
<#
.SYNOPSIS
Get the processes along with the relevant service associated to each process (if any)
This is the equivalent to "tasklist /svc" cmd command.
.EXAMPLE
Get-ProcessWithService | where Service | select ProcessId,Name,Service
.NOTES
WMI Query Language (WQL) WHERE Clause
https://learn.microsoft.com/en-us/windows/win32/wmisdk/where-clause
@PanosGreg
PanosGreg / Install-VscodeExtension.ps1
Created September 11, 2025 00:47
Install VS Code extension. I had an issue due to proxy and certs, this function has a workaround for that.
# this hashtable is used on the extension name validation for the input
# it is also used to get the extension id
$script:VSCodeExtensions = @{
'vscode-icons' = 'vscode-icons-team.vscode-icons'
powershell = 'ms-vscode.powershell'
csharp = 'ms-dotnettools.csdevkit'
terraform = 'hashicorp.terraform'
}
# Note: if this was a module, we could have this in a .psd1 file
@PanosGreg
PanosGreg / GetComputerName.ps1
Created August 27, 2025 11:58
All the different ways to get the Computer Name
# ENV variable
$env:COMPUTERNAME
# Note: this is limited to 15 characters
# native C++
hostname.exe
# Note: this shows the full name <<=====
# environment class
@PanosGreg
PanosGreg / Test-ADCredential.ps1
Last active August 26, 2025 08:01
Verify Active Directory credentials
function Test-ADCredential {
<#
.Synopsis
Verify Active Directory credentials
.EXAMPLE
Test-ADCredential -Username user1 -Password Secret01
#>
[CmdletBinding(DefaultParameterSetName = 'PSCreds')]
[OutputType([Boolean])]
@PanosGreg
PanosGreg / Resolve-AmazonARN.ps1
Last active July 18, 2025 15:52
Parse an Amazon Resource Name (ARN) into its individual parts
function Resolve-AmazonArn {
<#
.SYNOPSIS
Parse an Amazon Resource Name (ARN) into its individual parts.
.EXAMPLE
'arn:aws:iam::111222333444:role/MyRole' | Resolve-AmazonArn
.EXAMPLE
Resolve-AmazonArn arn:aws:s3:::MyBucket/MyFolder/*
.EXAMPLE
Resolve-AmazonArn s3://MyBucket/MyFolder/MyFile.json