Skip to content

Instantly share code, notes, and snippets.

View KurtDeGreeff's full-sized avatar

Kurt De Greeff KurtDeGreeff

View GitHub Profile
@prof-trial-and-error
prof-trial-and-error / ntfspermissions.ps1
Created August 13, 2018 13:24
Managing NTFS folder security with PowerShell module NTFSSecurity
#First, show the script which directory
$directory = "\\<HOST>\<Dir>\"
#[Optional!] Inside the directory defined above filter for folders you want to check
$folders = Get-ChildItem $Directory -Directory | Where-Object { $_.Name -like "XXXX??" }
#now go through each folder in that directory
foreach ($folder in $folders)
{
Write-Host $folder
@SMSAgentSoftware
SMSAgentSoftware / New-InteractiveDataDisplayChart.ps1
Created June 20, 2018 16:43
Creates a simple interactive bar chart using Microsoft's opensource Interactive Data Display project
## Example of how to use the opensource InteractveDataDisplay module from Microsoft to create a WPF chart in PowerShell
Add-Type -AssemblyName PresentationFramework
Add-Type -AssemblyName System.IO.Compression.FileSystem
# Location to download the required libraries and reference them from
$Source = "C:\Users\tjones\OneDrive\PowerShell\POSH Projects\Interactive Data Display"
#region DownloadDependencies
$URLs = @(
<manifest schemaversion="4.0" binaryversion="1.01">
<configuration>
<options>
<!-- Command-line only options -->
<option switch="i" name="Install" argument="optional" noconfig="true" exclusive="true" />
<option switch="c" name="Configuration" argument="optional" noconfig="true" exclusive="true" />
<option switch="u" name="UnInstall" argument="none" noconfig="true" exclusive="true" />
<option switch="m" name="Manifest" argument="none" noconfig="true" exclusive="true" />
<option switch="t" name="DebugMode" argument="none" noconfig="true" />
<option switch="s" name="PrintSchema" argument="optional" noconfig="true" exclusive="true" />
@Kieranties
Kieranties / Write-HostExample.ps1
Last active November 4, 2025 13:28
Write information messages in PowerShell that support colors (like Write-Host) but always honors the context `$InformationPreference variable - https://blog.kieranties.com/2018/03/26/write-information-with-colours
<#
.SYNOPSIS
A simple example of Write-Host
#>
# Displays the message
Write-Host -Object 'Hello'
# Try to silence directly
Write-Host "Still shown :-(" -InformationAction SilentlyContinue

Credit: Mark Kraus
Website: https://get-powershellblog.blogspot.com

Collection Type Guidence

When to use what

  • Use Arrays if you know the element types and have a fixed length and/or known-up-front collection size that will not change.
  • Use ArrayList if you have an unkown collection size with either unknown or mixed type elements.
  • Use a Generic List when know the type of the elements but not the size of the collection.
  • Use a HashTable if you are going to do key based lookups on a collection and don't know the object type of the elements.
  • Use a Dictionary<TKey, TValue> you are going to do key based lookups on a collection and you know the type of the elements.
  • Use a HashSet when you know the type of elements and just want unique values and quick lookups and assignmnets.
@fresh2dev
fresh2dev / AnyBox_ProcessKiller.ps1
Last active March 13, 2018 21:09
AnyBox Demo - Process Killer
Import-Module AnyBox
[string]$default_input = 'localhost'
[hashtable]$answer = $null
[bool]$continue = $true
[hashtable]$common = @{WindowStyle = 'ToolWindow'; Title = 'Process Killer'; CancelButton = 'Cancel'}
while ($continue) {
@psignoret
psignoret / Get-AzureADPSPermissions.ps1
Last active March 23, 2026 14:45
Script to list all delegated permissions and application permissions in Microsoft Entra ID
# THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF
# FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
#Requires -Modules @{ ModuleName="Microsoft.Graph.Authentication" ; ModuleVersion="2.15.0" }
#Requires -Modules @{ ModuleName="Microsoft.Graph.DirectoryObjects"; ModuleVersion="2.15.0" }
#Requires -Modules @{ ModuleName="Microsoft.Graph.Identity.SignIns"; ModuleVersion="2.15.0" }
#Requires -Modules @{ ModuleName="Microsoft.Graph.Applications" ; ModuleVersion="2.15.0" }
#Requires -Modules @{ ModuleName="Microsoft.Graph.Users" ; ModuleVersion="2.15.0" }
<#
@CosmosKey
CosmosKey / Get-ADGroupMemberSamAccountName
Created February 27, 2018 23:54
Get-ADGroupMemberSamAccountName
Function Get-ADGroupMemberSamAccountName {
param(
[Parameter(Mandatory,ValueFromPipeline)]
[ValidateNotNullOrEmpty()]
[string]$GroupName
)
process {
$name = $GroupName
$domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
$dc = $domain.FindDomainController([System.DirectoryServices.ActiveDirectory.LocatorOptions]::WriteableRequired)
@nyanhp
nyanhp / adreplication_part2.ps1
Created February 22, 2018 09:42
Making sense of AD Replication schedules pt 2
function Get-ADReplicationSchedule
{
[CmdletBinding()]
param
(
[Parameter(ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[System.DirectoryServices.ActiveDirectory.ActiveDirectorySchedule]$ReplicationSchedule,
[Parameter(ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[string]$DistinguishedName
$ModuleScript = {
$folders = @('functions', 'private', 'classes')
ForEach ($folder in $folders)
{
$currentPath = $PSScriptRoot | Join-Path -ChildPath $folder
If (Test-Path -Path $currentPath -PathType Container)
{
$functions = Get-ChildItem -Path $currentPath -Filter '*.ps1'