Skip to content

Instantly share code, notes, and snippets.

View RobBiddle's full-sized avatar

Robert Biddle RobBiddle

View GitHub Profile
@RobBiddle
RobBiddle / Restore-TeamsFiles.ps1
Created March 31, 2023 20:29
Restore files deleted from a Microsoft Teams team
<#
.SYNOPSIS
Restore files deleted in Microsoft Teams
.DESCRIPTION
Restore files deleted by a specific user on a specific date
.NOTES
PowerShell 7 only
Author: Robert D. Biddle
https://github.com/RobBiddle
#>
@RobBiddle
RobBiddle / Get-WMILocalGroupMember.ps1
Last active March 23, 2022 18:52
PowerShell function to Get Windows Local Group Members via WMI - Returns a PSObject
function Get-WMILocalGroupMember {
[CmdletBinding()]
[OutputType([PSObject])]
param (
[Parameter()]
[String]
$ComputerName = $env:computername,
[Parameter()]
[String]
$GroupName
@RobBiddle
RobBiddle / Save-MoneyOnEBSStorage.psm1
Last active December 16, 2020 00:11
Save money with this PowerShell function to switch AWS EBS Volumes from gp2 to gp3 :-D
function Save-MoneyOnEBSStorage {
(Get-AWSCredential -ListProfileDetail).ProfileName | ForEach-Object {
$ThisProfile = $_
Get-EC2Volume -ProfileName $ThisProfile | `
Where-Object State -eq 'in-use' | `
Where-Object VolumeType -eq 'gp2' | `
ForEach-Object {
if ($_.Iops -gt 3000) {
$ThisIops = $_.Iops
}
@RobBiddle
RobBiddle / gist:d88d7c760dd363715f3c1cc0f4caba97
Created March 4, 2019 18:15
PowerShell Parameter ValidatePattern (REGEX) validation check which will match either a valid GUID or a valid FQDN
[Parameter]
[ValidatePattern( '(?=^.{1,254}$)(^(?:(?!\d+\.|-)[a-zA-Z0-9_\-]{1,63}(?<!-)\.?)+(?:[a-zA-Z]{2,})$)|(\{|\()?[A-Za-z0-9]{4}([A-Za-z0-9]{4}\-?){4}[A-Za-z0-9]{12}(\}|\()?' )]
[System.String]
@RobBiddle
RobBiddle / keybase.md
Created December 21, 2017 22:38
My Keybase.io proof

Keybase proof

I hereby claim:

  • I am robbiddle on github.
  • I am robertbiddle (https://keybase.io/robertbiddle) on keybase.
  • I have a public key ASDcidAdm5FN7QZM_Szl3ZIy1rn0JhRieZ6kjTNmV3bxlgo

To claim this, I am signing this object:

@RobBiddle
RobBiddle / DSC_Script_DnsClientServers.ps1
Last active March 26, 2018 16:11
DSC Script Resource to set DNS Client Servers on any active IPv4 Interface
# This Script Resource is required because not all EC2 Instance types end up with "Ethernet" as the primary adapter, some are "Ethernet 2" etc
Script SetDnsClientServers {
TestScript = {
$CurrentdnsServers = (Get-NetAdapter | Where-Object Status -eq "Up").InterfaceIndex | ForEach-Object {
(Get-DnsClientServerAddress -InterfaceIndex $_ | Where-Object AddressFamily -eq 2).ServerAddresses
# AddressFamily is type UINT16, IPv4 equals 2
}
if($CurrentdnsServers.count -lt 2){Return $false}
if(($CurrentdnsServers -like $using:DnsServer1) -and ($CurrentdnsServers -like $using:DnsServer2)) {
Return $true