Skip to content

Instantly share code, notes, and snippets.

View PrzemyslawKlys's full-sized avatar
🍉
Dreaming about great things! A bit bored...

Przemysław Kłys PrzemyslawKlys

🍉
Dreaming about great things! A bit bored...
View GitHub Profile
@indented-automation
indented-automation / ADDns.ps1
Created July 21, 2022 14:30
This is a mess. Needs major refactoring.
##############################################################################################################################################################
# IANA #
##############################################################################################################################################################
#
# Address family
#
New-Enum -ModuleBuilder $IndentedDnsMB -Name "Indented.Dns.IanaAddressFamily" -Type "UInt16" -Members @{
IPv4 = 1; # IP version 4
@JustinGrote
JustinGrote / Start-ExchangeThreadJob.ps1
Created February 9, 2022 22:05
Run Exchange Commands in Parallel
#requires -module ExchangeOnlineManagement,ThreadJob
function Start-ExchangeThreadJob {
<#
.SYNOPSIS
Works like Start-Threadjob but for Exchange and preserves the exchange state
.NOTES
This works because the new REST commands are basically CLIXML proxies via a REST API. A dynamic module is generated upon
connection to the exchange server, and it has the session context and token "hard coded" into the module.
By simply bringing this module into the runspace, it shares the same context and token.
#>
@JustinGrote
JustinGrote / ExoHttpClient.ps1
Last active July 10, 2024 18:42
Fetch Exchange mailboxes via REST API in parallel using Async and HttpClient
using namespace Microsoft.Exchange.Management.AdminApiProvider
using namespace Microsoft.Exchange.Management.ExoPowershellSnapin
using namespace System.Collections.Generic
using namespace System.Net.Http
using namespace System.Net.Http.Headers
using namespace System.Threading.
<#
I made this as a way to overcome some limitations with very complicated filter queries that exceed the REST limit, while being able to run them in parallel without resorting to runspaces
#>
@vexx32
vexx32 / PowershellLoopBehavior.md
Last active January 15, 2022 10:36 — forked from JustinGrote/PowershellLoopBehavior.md
Reference Table for Loop Behavior in Powershell
Loop Return Continue Break
Normal Expectation Exit Scope Next Item Exit Loop
.foreach{} Next Item Break Scopes / Next Item of Parent Loop Break Scopes / Exit Parent Loop
foreach ($y in $x) Exit Scope Next Item Exit Loop
for ($i;$i -lt 5;$i++) Exit Scope Next Item Exit Loop
Foreach-Object -InputObject @() Next Item Break Scopes / Next Item of Parent Loop Break Scopes / Exit Parent Loop
Switch Exit Scope Next Item Exit Switch
While
@i128
i128 / TraceDetailedDNSLogs.ps1
Created July 3, 2019 16:50
Simple Script for Parsing Detailed DNS Debug Logs
function Get-DNSDebugLog
{
<#
.SYNOPSIS
This cmdlet parses a Windows DNS Debug log with details.
Author: @jarsnah12
License: BSD 3-Clause
Required Dependencies: None
Optional Dependencies: None
@ChendrayanV
ChendrayanV / home.ps1
Created January 7, 2019 08:19
PSHTML | MetroUI | PowerShell | Polaris
# Import-Module .\assemblies\PSHTML\PSHTML.psd1
html -Content {
head -Content {
Title -Content "iCMS | Home"
Link -href "./../assets/css/metro.min.css" -rel "stylesheet"
Link -href "./../assets/css/metro-colors.min.css" -rel "stylesheet"
Link -href "./../assets/css/metro-rtl.min.css" -rel "stylesheet"
Link -href "./../assets/css/metro-icons.min.css" -rel "stylesheet"
script -src "./../assets/js/jquery-3.3.1.min.js"
script -src "./../assets/js/metro.min.js"
@nohwnd
nohwnd / scopechecks.ps1
Created December 12, 2018 15:54
Shared state between DSL keywords in Pester
# in module scope
$script:pester
function describe () {
$script:pester.EnterBlock("describe")
}
function it () {
using Namespace System.Management.Automation.Language
Function Get-AliasTarget {
[cmdletbinding()]
param (
[Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
[Alias('PSPath', 'FullName')]
[string[]]$Path
)
function Save-WebCertificate {
param (
# Attempt to acquire a certificate from the specified URI
[Parameter(Mandatory)]
[ValidateScript( { $_.Scheme -eq 'https' } )]
[Uri]$Uri,
# Save the certificate in PEM format to the specified path.
[Parameter(Mandatory)]
[String]$Path,
@keithga
keithga / Get-LatestUpdate.ps1
Last active February 23, 2024 13:17
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 (KeithGa@DeploymentLive.com), All rights reserved.