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-SslCertificate.ps1
Created March 11, 2026 11:29
Get the certificate from an SSL-enabled service
function Get-SslCertificate {
<#
.EXAMPLE
Get-SslCertificate -Address devad2487dc3.ad.coupadev.net -Port 636
Check the Active Directory service on a domain controller to get the certificate we deployed for use by LDAPS
#>
[OutputType([System.Security.Cryptography.X509Certificates.X509Certificate2])] # <-- default output
[OutputType([System.Security.Cryptography.X509Certificates.X509Certificate])] # <-- fallback output
[CmdletBinding()] # if we can't convert it to X509Certificate2
@PanosGreg
PanosGreg / GitHubActions-Functions.ps1
Last active March 12, 2026 12:47
Functions for working with GitHub Actions
<#
.SYNOPSIS
Commands to work with GitHub Actions
This file contains these functions:
- Get-GhaApiVersion
- Get-GhaStep
- Get-Workflow
- Get-WorkflowJob
- Get-WorkflowLog
@PanosGreg
PanosGreg / Resolve-Error.ps1
Created March 5, 2026 14:51
Go through an Error Record recursively and get all exceptions and messages
function Resolve-Error {
[OutputType([object],[string])] # <-- by default [object], and [string] with AsString
[CmdletBinding()]
param (
[Parameter(ValueFromPipeline, Mandatory)]
[ValidateNotNull()]
$ErrorRecord,
[switch]$AsString
)
@PanosGreg
PanosGreg / StepWrapper.ps1
Last active February 23, 2026 15:35
GitHub Actions Step Wrapper script for transparent data access between steps
<#
.SYNOPSIS
Step-Wrapper script for GitHub Actions Workflows
The main benefit is that it allows any variables defined in a step,
to be accessible to all subsequent steps. As if the code from all the steps
is running as a single script, without having to define the variables on each step.
.DESCRIPTION
This script wraps the user's command on each step.
@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