Skip to content

Instantly share code, notes, and snippets.

View aaronparker's full-sized avatar

Aaron Parker aaronparker

View GitHub Profile
@aaronparker
aaronparker / UserFoldersStats.json
Created October 2, 2021 08:48
Azure Workbook to display metrics gathered by Invoke-UserFolderStats
{
"version": "Notebook/1.0",
"items": [
{
"type": 1,
"content": {
"json": "# OneDrive Known Folder Move\n\nUser folder inventory for planning implementation and tracking of [Known Folder Move](https://docs.microsoft.com/en-us/onedrive/redirect-known-folders) with OneDrive for Business.\n\nUser folder details are gathered via Endpoint Analytics Proactive Remediations with [**Invoke-UserFolderStats.ps1**](https://github.com/Insentra/mem-foundations/blob/main/device-reporting/scripts/Invoke-UserFolderStats.ps1) and forwarded to Log Analytics via the [Azure Monitor HTTP Data Collector API](https://docs.microsoft.com/en-us/azure/azure-monitor/logs/data-collector-api).\n",
"style": "info"
},
"name": "Intro"
@aaronparker
aaronparker / Invoke-UserFolderStats.ps1
Last active October 2, 2021 11:42
Collect Windows user folder status and OneDrive Known Folder move and post to Azure Monitor
<#
.SYNOPSIS
Get user folder sizes to determine impact on OneDrive Known Folder Move
#>
[CmdletBinding()]
Param (
[Parameter(Mandatory = $False)]
# Update with Log Analytics Workspace ID
[System.String] $CustomerId = "",
@aaronparker
aaronparker / AppControl.kql
Last active August 29, 2021 05:39
Defender for Endpoint application control events
// Defender for Endpoint query
DeviceEvents
| where Timestamp > ago(1d)
and ActionType startswith "AppControlExecutableAudited"
| where AccountName !has "system"
and AccountName !has "local service"
and AccountName !has "network service"
and AccountName !has "dwm-1"
| where FolderPath startswith "%OSDRIVE%"
//| order by Timestamp desc
@aaronparker
aaronparker / Expand-GzipArchive.ps1
Last active April 10, 2021 13:36
Expand a Gzip file with PowerShell
Function Expand-GzipArchive {
[CmdletBinding(SupportsShouldProcess = $False)]
param (
[Parameter(Mandatory = $True, Position = 0)]
[ValidateNotNullOrEmpty()]
[ValidateScript( { If (Test-Path -Path $_ -PathType "Leaf") { $True } Else { Throw "Cannot find path $_." } })]
[System.String] $Path,
[Parameter(Mandatory = $False, Position = 1)]
[ValidateNotNullOrEmpty()]
@aaronparker
aaronparker / install-istatserver.sh
Last active September 30, 2023 08:10
Installing iStat Server for Linux on raspbian
# https://bjango.com/help/istat3/linuxpackages/
# Commands used to install iStat Server for Linux on a Raspbery Pi running Raspbian
# Update Raspbian
# sudo apt-get update
# sudo apt-get upgrade
# Install dependencies
sudo apt-get install automake
sudo apt-get install libxml2-dev
@aaronparker
aaronparker / Disable-AzureADUserPasswordExpiration.ps1
Last active February 9, 2019 10:45
Disable password expiration for an individual Azure AD account
# Install the Azure AD module and log into Azure AD
Install-Module AzureADPreview
Connect-AzureAD
# Get details of the specific account
$user = Get-AzureADUser -SearchString "user@domain.com"
# View password policy on the acccount
$user | Select-Object @{N = "PasswordNeverExpires"; E = {$_.PasswordPolicies -contains "DisablePasswordExpiration"}}
@aaronparker
aaronparker / Switch-EmsLicenses.ps1
Created December 1, 2018 12:32
Find users registered in Intune with EMS E3 and replace with EMS E5 licenses
# Connect to Office 365
Connect-MsolService
# Get specific user accounts
Get-MsolUser -UserPrincipalName "bill.murray@stealthpuppy.com"
# Get license SKUs
Get-MsolAccountSku
# EMS licenses
@aaronparker
aaronparker / Get-DigitalSignatures.ps1
Last active August 21, 2019 06:27
Get digital signatures from files in a target folder.
<#
.SYNOPSIS
Get digital signatures from files in a target folder.
.DESCRIPTION
Gets digital signatures from .exe and .dll files from a specified path and sub-folders.
Retreives the certificate thumbprint, certificate name, certificate expiry, certificate validity and file path and outputs the results.
Output includes files that are not signed.
.NOTES
@aaronparker
aaronparker / Get-AzureBlobItems.ps1
Last active May 13, 2019 00:59
Get-AzureBlobItems function to return an array from a list of files in an Azure blob storage container.
Function Get-AzureBlobItems {
<#
.SYNOPSIS
Returns an array of items and properties from an Azure blog storage URL.
.DESCRIPTION
Queries an Azure blog storage URL and returns an array with properties of files in a Container.
Requires Public access level of anonymous read access to the blob storage container.
Works with PowerShell Core.
@aaronparker
aaronparker / Set-RedirectOneDriveTask.ps1
Last active July 21, 2021 13:51
Creates a scheduled task to redirect folders into the OneDrive sync folder at logon
<#
.SYNOPSIS
Creates a scheduled task to enable folder redirection into OneDrive
#>
# Variables
$Url = "https://gist.githubusercontent.com/aaronparker/cf124f13bb58d95342707527900d307b/raw/e4683d9bf95c5ac77c6d2d43b5f2454185cf1e55/Redirect-FoldersOneDrive.ps1"
$Target = "$env:ProgramData\Scripts"
$Script = "Redirect-FoldersOneDrive.ps1"