Skip to content

Instantly share code, notes, and snippets.

View jpawlowski's full-sized avatar

Julian Pawlowski jpawlowski

View GitHub Profile
@jpawlowski
jpawlowski / proxmox-create-hourly-rotating-snapshot.sh
Last active November 6, 2024 11:48
Proxmox Hourly Snapshot Rotation Script: This Bash script automates the creation of hourly snapshots for running Proxmox VMs, while automatically deleting older snapshots to maintain a manageable rotation. It uses Proxmox CLI commands (pct and qm) without requiring additional libraries, making it lightweight and efficient. The script includes op…
#!/bin/bash
# Variables
DATE=$(date +"%Y%m%d%H")
DEFAULT_KEEP=24 # Default number of snapshots to keep
DEFAULT_RETAIN_DAYS=7 # Default days to keep LVM archive files
DRY_RUN=false
QUIET=false
KEEP=$DEFAULT_KEEP
RETAIN_DAYS=$DEFAULT_RETAIN_DAYS
@jpawlowski
jpawlowski / Set-MgDeviceExtensionAttribute.ps1
Last active June 11, 2024 09:15
Set extension attribute for a device.
<#PSScriptInfo
.VERSION 1.0.0
.GUID 380c73f8-ef67-4aeb-ae6b-2f5e563fabb8
.AUTHOR Julian Pawlowski
.COMPANYNAME Julian Pawlowski
.COPYRIGHT © 2024 Julian Pawlowski
.TAGS
.LICENSEURI https://opensource.org/license/MIT
.PROJECTURI https://gist.github.com/jpawlowski/d9e7cb61a36a4a22a69a935657e77335
.ICONURI
@jpawlowski
jpawlowski / Remove-MgGraphAdminConsent.ps1
Last active May 12, 2024 12:50
Remove delegated permissions for all users (also known as admin consent) to Microsoft Graph Explorer and Microsoft Graph PowerShell.
<#PSScriptInfo
.VERSION 1.0.0
.GUID d24ad04e-2bbc-4087-a8b3-9da63d79edc4
.AUTHOR Julian Pawlowski
.COMPANYNAME Julian Pawlowski
.COPYRIGHT © 2024 Julian Pawlowski
.TAGS
.LICENSEURI https://opensource.org/license/MIT
.PROJECTURI https://gist.github.com/jpawlowski/07d0ad578d50027c962c63228fd5c1a6
.ICONURI
@jpawlowski
jpawlowski / Remove-MgGraphUserConsent.ps1
Last active May 12, 2024 12:58
This script removes delegated permissions for a user to Microsoft Graph Explorer and Microsoft Graph PowerShell. The script requires the connecting user to have an active assignment for at least one of the following directory roles: 'Cloud Application Administrator', 'Application Administrator', 'Global Administrator'. You may specify a list of …
<#PSScriptInfo
.VERSION 1.0.0
.GUID fa3a4d56-2d51-465c-b6f7-6c8518b51e2f
.AUTHOR Julian Pawlowski
.COMPANYNAME Julian Pawlowski
.COPYRIGHT © 2024 Julian Pawlowski
.TAGS
.LICENSEURI https://opensource.org/license/MIT
.PROJECTURI https://gist.github.com/jpawlowski/7d4f2e76851349800e1cf86ff00ca43c
.ICONURI
@jpawlowski
jpawlowski / Create-MgGraphCustomRole-PrivilegedApplicationConsentAdministrator.ps1
Last active August 30, 2024 08:05
Create a custom role in Microsoft Entra that grants the ability to consent for delegated permissions and application permissions, including most application permissions for Microsoft Graph, except for a few sensitive permissions. Azure AD Graph permissions are NOT included.
<#PSScriptInfo
.VERSION 1.1.0
.GUID a17ec91c-0f75-42ab-b4ef-8766c1a25fca
.AUTHOR Julian Pawlowski
.COMPANYNAME Julian Pawlowski
.COPYRIGHT © 2024 Julian Pawlowski
.TAGS
.LICENSEURI https://opensource.org/license/MIT
.PROJECTURI https://gist.github.com/jpawlowski/ca1bde7e979f367e8007b056bc032b6e
.ICONURI
@jpawlowski
jpawlowski / PS5SemanticVersion.ps1
Last active October 15, 2024 03:09
PowerShell class for extended Semantic Version support that is compatible with PowerShell 5.1 to parse, compare, and sort version strings.
class SemanticVersionExtended {
<#
.SYNOPSIS
Represents a Semantic Version (SemVer).
.LINK
https://gist.github.com/jpawlowski/1c81fff8a55f5e368d831e60e235893c
#>
[int]$Major
[int]$Minor
@jpawlowski
jpawlowski / gpg-gen-ecc.sh
Last active May 6, 2022 08:57
Unattended generation of GnuPG / OpenPGP keys w/ ECC
#!/bin/sh
NAME='John Doe'
EMAIL='[email protected]'
export GNUPGHOME="$(mktemp -d)"
cat >$TMPDIR/gpg-gen.tmpl <<EOF
%echo Generating an OpenPGP key
Key-Type: eddsa
Key-Curve: ed25519
@jpawlowski
jpawlowski / profile.ps1
Created January 2, 2022 16:41 — forked from SteveL-MSFT/profile.ps1
PowerShell Prompt
#Requires -Version 7
# Version 1.2.10
# check if newer version
$gistUrl = "https://api.github.com/gists/a208d2bd924691bae7ec7904cab0bd8e"
$latestVersionFile = [System.IO.Path]::Combine("$HOME",'.latest_profile_version')
$versionRegEx = "# Version (?<version>\d+\.\d+\.\d+)"
if ([System.IO.File]::Exists($latestVersionFile)) {

PowerShell modules, digital signatures, NuGet nuspec and packages

d-fens GmbH General-Guisan-Strasse 6 CH-6300 Zug Switzerland

@jpawlowski
jpawlowski / profile.ps1
Created November 8, 2021 08:03
Dynamic Multi-Platform PowerShell Profile Loader
<#
.SYNOPSIS
Dynamic Multi-Platform PowerShell Profile Loader
.DESCRIPTION
Safe this script named 'profile.ps1' in either $PROFILE.AllUsersAllHosts or
$PROFILE.CurrentUserAllHosts.
(see: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_profiles#the-profile-variable)
It will automatically create a directory structure for every PS host
application, platform and PowerShell edition you use and replicate itself as