Skip to content

Instantly share code, notes, and snippets.

View griffeth-barker's full-sized avatar

Griffeth Barker griffeth-barker

View GitHub Profile
@griffeth-barker
griffeth-barker / Trust-VCenterCertificates.ps1
Last active April 23, 2026 15:32
Download and install VCenter trusted root CA certificates
<#
.SYNOPSIS
Trusts the CA certificates for the specified VCenter server.
.DESCRIPTION
Downloads the certificates for the trusted root CA for vcenter.domain.tld
then installs them into the Local Machine's trusted store.
.PARAMETER Server
Mandatory string containing the fully-qualified domain name (FQDN) for the
VCenter for which the CA certificates should be trusted.
.INPUTS
@griffeth-barker
griffeth-barker / Right-Hose.ps1
Last active April 15, 2026 03:58
Write a hose to the console (this is a joke and not to be reused).
# lol - https://bsky.app/profile/dbakevlar.bsky.social/post/3mjidu6x4ek2c
function Right-Hose {
[CmdletBinding()]
param ()
#region ascii art
$ascii = @'
::::.
.:::::::
@griffeth-barker
griffeth-barker / prompt-timestamp.ps1
Last active March 9, 2026 07:02
Simple timestamp in PowerShell prompt
# You can add the below to your PowerShell profile to add a timestampe to your PowerShell prompt.
# There are tons of ways to go about doing this; this is just one way.
# You also don't need to join an array of strings, you could just do "string" + " string" + " string" etc.
# I just prefer this way.
function prompt {
@(
"$(Get-Date -Format 'yyyy-MM-dd hh:mm:ss')",
"PS",
"$($pwd.Path)",
@griffeth-barker
griffeth-barker / New-GJBEntraAppDeployment.ps1
Created January 9, 2026 18:56
Create EntraID Enterprise Apps with SSO and Security Groups
<#
.SYNOPSIS
Creates necessary componenets for an EntraID Enterprise Application with SAML SSO.
.DESCRIPTION
Creates an Application Registration, Enterprise Application, and two Security Groups
in Microsoft EntraID based on provided parameters and associates them as necessary.
.PARAMETER Name
The name of the enterprise application. This is used to formulate the groups names
as well.
.PARAMETER IdentifierUri
@griffeth-barker
griffeth-barker / class_WebIdentityInfo.ps1
Last active January 2, 2026 15:47
class_WebIdentityInfo for ifconfig.me
<#
.SYNOPSIS
Represents public web identity information of the current machine.
.DESCRIPTION
The WebIdentityInfo class represents the public web identity information of the
current computer as seen from the ifconfig.me service.
It includes properties such as IP address, user agent, TCP port, HTTP method, encoding,
via, and forwarded headers.
@griffeth-barker
griffeth-barker / Get-MgCommonGroups.ps1
Created November 24, 2025 17:59
Identify Entra groups where all specified users are a member
function Get-MgCommonGroups {
<#
.SYNOPSIS
Identifies groups of which all the provided users are members (intersections).
.DESCRIPTION
This function consumes an array of Entra ID user identities via ObjectId or UserPrincipalName and checks for
intersections in group membership (groups where all of the provided users are members), and returns a list of
those groups.
@griffeth-barker
griffeth-barker / Copy-EntraGroupMember.ps1
Last active November 13, 2025 15:57
Copy Entra group members from one group to another
function Copy-EntraGroupMember {
<#
.SYNOPSIS
Copies members from the source Entra groups to the destination Entra group.
.DESCRIPTION
Copies all members from the specified source Entra groups to the specified destination Entra group.
.PARAMETER SourceGroupId
A GUID reflecting the Id or objectId of the source group from which members should be copied.
.PARAMETER DestinationGroupId
A GUID reflecting the Id or objectId of the destination group to which members should be copied.
@griffeth-barker
griffeth-barker / New-RandomPassword.ps1
Created September 30, 2025 17:30
Generate a random password
function New-RandomPassword {
<#
.SYNOPSIS
Generates a random password.
.DESCRIPTION
This function uses the RNGCryptoServiceProvider to genereate a random password of the
provided length.
.PARAMETER Length
How many characters long the random password should be.
.PARAMETER AsPlainText
@griffeth-barker
griffeth-barker / Test-PasswordEntropy.ps1
Created September 30, 2025 17:30
Test password entropy/strength
function Test-PasswordEntropy {
<#
.SYNOPSIS
Evaluates the entropy and strength of a password.
.DESCRIPTION
Accepts a secure string, plain string, PSCredential, or SecretManagement secret object
from the pipeline or parameter and evaluates password entropy.
.PARAMETER InputObject
The object to evaluate, as a secure string, plain string, PSCredential, or SecretManagement
.INPUTS
@griffeth-barker
griffeth-barker / Set-FileLocationByFragment.ps1
Last active September 24, 2025 13:41
Don't cd ..\..\.. - Changing directory up or down multiple levels with fcd
function Set-LocationByFragment {
<#
.SYNOPSIS
Sets the present working directory to the first path that matches the given fragment.
.DESCRIPTION
This function identifies all parent directory paths of the present working directory and searches for a
valid path that ends in the given fragment. If a match is found, the present working directory is set to
that path.