Skip to content

Instantly share code, notes, and snippets.

@joegasper
joegasper / Get-PingSweep.ps1
Last active April 30, 2024 19:12
Get-PingSweep - super fast (~500ms) subnet ping sweep with option to resolve IP address
# Inspiration from https://twitter.com/mrhvid/status/929717169130176512 @mrhvid @Lee_Holmes
function ResolveIp($IpAddress) {
try {
(Resolve-DnsName $IpAddress -QuickTimeout -ErrorAction SilentlyContinue).NameHost
} catch {
$null
}
}
@joegasper
joegasper / export-team-membership-roster.js
Last active April 9, 2024 15:22 — forked from guillaumemeyer/export-team-membership-roster.js
Exports the owners and members of a Microsoft Teams team as a CSV file
// ****************************************************************************************************************************
// Abstract:
// This script is just a quick trick to export the owners and members of a team as a CSV file without administrator permissions.
// The following properties are exported: Display name, Title, Location, Role, Tags, UPN(email)
//
// Usage:
// 1. Open the team in your web browser: https://teams.microsoft.com
// 2. Select "Manage team" from its menu.
// 3. Select the "Members" tab.
// 4. Expand the "Owners" and "Members and guests" sections.
@joegasper
joegasper / Download-MsftEbooks.ps1
Last active March 20, 2024 11:12
Download free Microsoft eBooks in massive list provided by Microsoft
#[1] https://blogs.msdn.microsoft.com/mssmallbiz/2016/07/10/how-to-download-all-of-the-free-ebooks-and-resources-in-my-free-ebooks-giveaway/
#[2] https://blogs.msdn.microsoft.com/mssmallbiz/2017/07/11/largest-free-microsoft-ebook-giveaway-im-giving-away-millions-of-free-microsoft-ebooks-again-including-windows-10-office-365-office-2016-power-bi-azure-windows-8-1-office-2013-sharepo/
#Some links are to webpages or Sway, I'd like to save the link to these pages - still to do.
$saveTo = 'D:\MS_eBooks\' #where to place the eBooks
New-Item -Path $saveTo -ItemType Directory
$masterListLink = 'http://ligman.me/29zpthb' #[1] link to the text file of links to the eBooks.
#$masterListLink = 'http://ligman.me/2sZVmcG' #[2] link to the text file of links to the eBooks.
#Get an array of links, triming the header in the first line.
$eBookLinks = @((Invoke-WebRequest -Uri $masterListLink -MaximumRedirection 1).Content -split "`n" | % {$_.trim()} | select -Skip 1 )
foreach ($eBookLink in $eBookLinks) {
@joegasper
joegasper / New-DicePassPhrase.ps1
Last active February 28, 2024 22:00
Generate a password/passphrase based on a dice password list
<#
.SYNOPSIS
Returns a passphrase
.DESCRIPTION
Returns a passphrase based on a dice password list.
.EXAMPLE
New-DicePassPhrase
miles welt eta pall 41st
@joegasper
joegasper / Update-AfsStorageSyncAgent.ps1
Last active February 16, 2024 12:22
PowerShell function to update Azure File Sync (AFS) Storage Agent on computer(s).
<#
.SYNOPSIS
Updates the Azure Files Storage Sync Agent on specified computers.
.DESCRIPTION
This cmdlet updates the Azure Files Storage Sync Agent on the specified computers by retrieving the installation directory from the registry, importing the update agent module DLL, and running the update process.
.PARAMETER ComputerName
Specifies the computer name on which the Azure Files Storage Sync Agent will be updated.
@joegasper
joegasper / Get internet headers.OUTLOOK.yaml
Last active November 27, 2023 19:28
Gets internet headers on a message in Read mode.
name: Get internet headers
description: Gets internet headers on a message in Read mode.
host: OUTLOOK
api_set: {}
script:
content: |
$("#run").click(run);
function run() {
Office.context.mailbox.item.getAllInternetHeadersAsync(function(asyncResult) {
@joegasper
joegasper / winget-update-manifest.md
Last active November 13, 2023 01:51
winget - Update Existing Package Manifest
@joegasper
joegasper / Get-M365GroupsForUser.ps1
Created October 31, 2023 02:14
Microsoft 365 Group memberships for a user or summary report using ActiveDirectory module
<#
.Synopsis
Microsoft 365 Group memberships for a user or summary report
.DESCRIPTION
Output a list of a user's modern group memberships (Teams, Engage, Planner, Groups) or summary report
.EXAMPLE
Get-M365GroupsForUser -UserName pvenkman | sort DisplayName | select DisplayName,Description
.EXAMPLE
Get-M365GroupsForUser -UserName pvenkman -Report | where Owners -like "*rsantz*"
.EXAMPLE
@joegasper
joegasper / Get-M365GroupsOwned.ps1
Created October 31, 2023 02:10
Display Microsoft 365 Groups owned by a user using the ActiveDirectory module and msExchCoManagedByLink attribute
<#
.Synopsis
Display Microsoft 365 Groups owned by a user.
.DESCRIPTION
Display modern groups (Microsoft 365 Group, Microsoft Teams, Planner, Viva Engage, etc.)
of which the user is an owner. Script requires synchronization of modern groups to the
operator's Active Directory and the operator has permissions to read user object attributes.
The script requires the PowerShell module "ActiveDirectory".
.EXAMPLE
Get-M365GroupsOwned -UserName pvenkman | select DisplayName,Name
@joegasper
joegasper / PS-BGInfo.ps1
Created October 31, 2023 01:36 — forked from dieseltravis/PS-BGInfo.ps1
update wallpaper background image with powershell (like Sysinternals BGInfo)
# PS-BGInfo
# Powershell script that updates the background image with a random image from a folder and writes out system info text to it.
# run as a lower priority task
[System.Threading.Thread]::CurrentThread.Priority = 'BelowNormal'
# Configuration:
# Font Family name
$font="Input"