Skip to content

Instantly share code, notes, and snippets.

View aaronparker's full-sized avatar
👨‍💻

Aaron Parker aaronparker

👨‍💻
View GitHub Profile
@hinchley
hinchley / AppLocker.ps1
Created September 12, 2016 09:39
A PowerShell script for generating AppLocker policies. Usage is discussed in the following article: http://hinchley.net/2016/06/13/an-approach-for-managing-microsoft-applocker-policies/
<# examples:
# generate a baseline policy.
powershell.exe -file applocker.ps1 -baseline -output c:\policies\baseline.xml
# generate an application-specific policy.
powershell.exe -file applocker.ps1 -application -in c:\policies\baseline.xml -out c:\policies\application.xml
# generate an adhoc policy.
powershell.exe -file applocker.ps1 -adhoc -in c:\path -filter *.* -out c:\policies\adhoc.xml
@semenko
semenko / SetupFoldersForOneDrive.ps1
Last active September 26, 2024 21:54
Powershell Redirect Folders to OneDrive Account & Sync
# Work in progress!
# Derived from http://stackoverflow.com/questions/25709398/set-location-of-special-folders-with-powershell
<#
.SYNOPSIS
Sets a known folder's path using SHSetKnownFolderPath.
.PARAMETER Folder
The known folder whose path to set.
.PARAMETER Path
The path.
@markwragg
markwragg / Sort-Natural.ps1
Last active September 26, 2024 21:54
PowerShell natural sort. A regex way to sort files that have a number in them correctly, e.g rather than img1, img10, img11, img2, -> img1, img2, img10, img11
# http://stackoverflow.com/a/5429048/2796058
$ToNatural = { [regex]::Replace($_, '\d+', { $args[0].Value.PadLeft(20) }) }
Get-ChildItem | Sort-Object $ToNatural
@keithga
keithga / Get-LatestUpdate.ps1
Last active September 26, 2024 21:54
script to get latest build.
<#
.SYNOPSIS
Get the latest Cumulative update for Windows
.DESCRIPTION
This script will return the list of Cumulative updates for Windows 10 and Windows Server 2016 from the Microsoft Update Catalog.
.NOTES
Copyright Keith Garner ([email protected]), All rights reserved.
@Ioan-Popovici
Ioan-Popovici / Start-WindowsCleanup.ps1
Last active September 26, 2024 21:30
Performs a windows cleanup by removing volume caches, update backups, update and CCM caches.
<#
.SYNOPSIS
Performs a windows cleanup.
.DESCRIPTION
Performs a windows cleanup by removing volume caches, update backups, update and CCM caches.
.PARAMETER CleanupOptions
Supported options:
"comCacheRepair" # Component Cache Repair
"comCacheCleanup" # Component Cache Cleanup
"volCacheCleanup" # Volume Cache Cleanup
@ian-noble
ian-noble / boxstarter-full-win10.ps1
Last active October 23, 2022 16:31
Boxstarter - Full - Windows 10
<#
.SYNOPSIS
BoxStarter script to configure Windows 10 development PC.
.DESCRIPTION
Install BoxStarter:
. { Invoke-WebRequest -useb http://boxstarter.org/bootstrapper.ps1 } | Invoke-Expression; get-boxstarter -Force
Run by calling the following from an **elevated** command-prompt.
Remove -DisableReboots parameter to allow the script to reboot as required.
Add-Type -TypeDefinition @"
using System;
using System.IO;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Linq;
using Microsoft.Win32;
@api0cradle
api0cradle / AccessChk.bat
Last active April 16, 2025 05:41
AppLocker hardening
accesschk -w -s -u Users "C:\Program Files" >> programfiles.txt
accesschk -w -s -u Everyone "C:\Program Files" >> programfiles.txt
accesschk -w -s -u "Authenticated Users" "C:\Program Files" >> programfiles.txt
accesschk -w -s -u Interactive "C:\Program Files" >> programfiles.txt
accesschk -w -s -u "This Organization" "C:\Program Files" >> programfiles.txt
accesschk -w -s -u "Authentication authority asserted identity" "C:\Program Files" >> programfiles.txt
accesschk -w -s -u "Mandatory Label\Medium Mandatory Level" "C:\Program Files" >> programfiles.txt
accesschk -w -s -u %username% "C:\Program Files" >> programfiles.txt
accesschk -w -s -u Users "C:\Program Files (x86)" >> programfilesx86.txt
@scotgabriel
scotgabriel / Windows command line gui access.md
Last active November 11, 2023 14:53
Common windows functions via rundll user32 and control panel

Rundll32 commands

OS: Windows 10/8/7

Add/Remove Programs

  • RunDll32.exe shell32.dll,Control_RunDLL appwiz.cpl,,0

Content Advisor

  • RunDll32.exe msrating.dll,RatingSetupUI

Control Panel

@rdejong1979
rdejong1979 / delete-device-objects-microsoft-intune
Last active February 16, 2021 15:05
Delete obsolete/stale device objects from Microsoft Intune/Azure AD
<#
.SYNOPSIS
Delete obsolete/stale device objects from Microsoft Intune/Azure AD
.DESCRIPTION
Based on input parameters ('management agent', 'compliance state' and 'management state', 'Days last synced') the script is used to perform "housekeeping" to keep your Microsoft Intune/Azure AD clean and tidy of obsolete/stale device objects.
The script deletes device objects based on their device state, device compliance state, management channel and the number of days devices hasn't synced/connected to Microsoft Intune.
.AUTHORS
Name: Ronny de Jong