Skip to content

Instantly share code, notes, and snippets.

@valorad
valorad / Export-UntrustedGuardian.ps1
Last active June 14, 2024 08:09
Hyper-V TPM Migration (To solve error: "The key protector could not be unwrapped" that causes VM startup failure)
$GuardianName = 'UntrustedGuardian'
$CertificatePassword = Read-Host -Prompt 'Please enter a password to secure the certificate files' -AsSecureString
$guardian = Get-HgsGuardian -Name $GuardianName
if (-not $guardian)
{
throw "Guardian '$GuardianName' could not be found on the local system."
}

Tweaked script:

import re
import sys
import pefile
import struct
import binascii
@s3rj1k
s3rj1k / HowTo
Last active July 22, 2024 14:19
Ubuntu 20.04.3 AutoInstall
# For recent versions of Ubuntu:
- https://www.pugetsystems.com/labs/hpc/ubuntu-22-04-server-autoinstall-iso/
# Docs:
- https://wiki.ubuntu.com/FoundationsTeam/AutomatedServerInstalls
- https://wiki.ubuntu.com/FoundationsTeam/AutomatedServerInstalls/ConfigReference
- https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html
- https://discourse.ubuntu.com/t/please-test-autoinstalls-for-20-04/15250/53
# Download ISO Installer:
@ox-b
ox-b / Backup-GPOs.ps1
Created June 5, 2019 21:12 — forked from felmoltor/Backup-GPOs.ps1
Powershell script to backup a domain gpo list
# Date: 10-2015
# Author: Felipe Molina (@felmoltor)
# Summary: Authomatize the backup proccess of GPO for a domain.
# Create a folder with the time when this script was executed and inside it a folder for each GPO of the domain
# The program needs two mandatory parameters:
# * Domain: The domain from where we want to backup the GPOs
# * backuppath: The path to the folder where we want to store this backups
param(
[Parameter(Mandatory=$True,Position=1)][String]$domain,
@AndrewPla
AndrewPla / Iterate Over PSCustomObject Properties Example.ps1
Created January 6, 2019 19:21
iterate through all properties on a pscustomobject. This is example code to accompany a blogpost.
# Create a pscustomobject from a hashtable
$object = [pscustomobject]@{ Key1 = 'Val1' ; Key2 = 'Val2' }
# Grab all noteproperty members
$objMembers = $object.psobject.Members | where-object membertype -like 'noteproperty'
foreach ($member in $objMembers) {
# Now you can do what you want with the name and value.
$Member.name
$Member.Value
@mt7479
mt7479 / sccm-fsp-notes.md
Last active September 30, 2023 19:45
Notes on the Fallback Status Point

Notes on the Fallback Status Point

I recently was challenged by moving to the FSP to a different location and started researching the available documentation which leaves, to be blunt, much room for improvements.

Most of my findings deal with implementation of Internet Based Client Management but could be useful in an Intranet environment also.

This gist is a attempted write-up of all the stuff I could put together before and after this reddit post.

Facts

@faishal
faishal / upgrade-openssh-7.3p1-centos-6.7.sh
Created October 6, 2016 14:02
Upgrade OpenSSH to 7.3p1 in Cent OS 6
#!/bin/bash
# Copyright © 2016 Faishal Saiyed
cd
timestamp=$(date +%s)
if [ ! -f openssh-7.3.zip ]; then wget https://github.com/faishal/openssh-portable/releases/download/cent.os.6.7.openssh.7.3p1/openssh-7.3.zip; fi;
unzip -o openssh-7.3.zip -d openssh-7.3p1
cd openssh-7.3p1/
cp /etc/pam.d/sshd pam-ssh-conf-$timestamp
rpm -U *.rpm
yes | cp pam-ssh-conf-$timestamp /etc/pam.d/sshd