Skip to content

Instantly share code, notes, and snippets.

View scriptingstudio's full-sized avatar
👍
Awake and ready

Matthew Gray scriptingstudio

👍
Awake and ready
  • Interstellar Systems
  • Hiranyaloka
View GitHub Profile
@josheinstein
josheinstein / LINQ.psd1
Created April 30, 2012 16:29
LINQ-ish Cmdlets for PowerShell
@{
# MODULE
Description = 'LINQ for PowerShell'
ModuleVersion = '3.0'
GUID = '03BDA80F-0831-406E-B6AE-59E32D73F190'
# AUTHOR
Author = 'Josh Einstein'
CompanyName = 'Einstein Technologies'
Param(
[Parameter(Mandatory=$true,Position=0)] $ImportModuleFrom,
[Parameter(Position=1)] $LogPath
)
Function Create-Form
{
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
# Create the Conatainer Form to place the Labels and Textboxes
@mrpullen
mrpullen / Json-OrderedDictionary.ps1
Created January 20, 2016 05:13
Powershell to convert to / from JSON string to ordered hashtable.
function Compare-Hashtables {
param([hashtable]$primary,
[hashtable]$secondary
)
foreach($key in $primary.Keys) {
if($secondary.Contains($key)) {
if($primary[$key].GetType() -eq [System.Collections.Specialized.OrderedDictionary] -and
$secondary[$key].GetType() -eq [System.Collections.Specialized.OrderedDictionary] ) {
$res = Compare-Hashtables -primary $primary[$key] -secondary $secondary[$key]
@XPlantefeve
XPlantefeve / LICENSE.txt
Last active April 12, 2022 10:02
Powershell Gist management CMDlets
MIT License
Copyright (c) 2016 Xavier Plantefeve
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
#region AD Functions
#-------------------------------------------------------
function get-servers {
param([string[]]$names,
[string[]]$props = @('DNSHostName','OperatingSystem')
)
foreach ($name in $names) {
$c = $null
$hostname = ($name -split '\.')[0]
@atifaziz
atifaziz / Unprotect-ProtectedData.ps1
Created March 31, 2017 06:25
Decrypting DPAPI-protected Base64 data from PowerShell
Add-Type -AssemblyName System.Security;
[Text.Encoding]::ASCII.GetString([Security.Cryptography.ProtectedData]::Unprotect([Convert]::FromBase64String((type -raw (Join-Path $env:USERPROFILE foobar))), $null, 'CurrentUser'))
@Tiberriver256
Tiberriver256 / PowerShellNTFSStaticFileServer.ps1
Last active January 5, 2024 08:23
This script starts a small web server listening on localhost:8080 that will impersonate the authenticated user and serve static content. This means if they do not have NTFS permissions to the file they will get an access denied or a 404 file not found if they do not have NTFS access to list contents of the directory.
function Get-DirectoryContent {
<#
.SYNOPSIS
Function to get directory content
.EXAMPLE
Get-DirectoryContent -Path "C:\" -HeaderName "poshserver.net" -RequestURL "http://poshserver.net" -SubfolderName "/"
@sub314xxl
sub314xxl / gist:e6539e6c0969e90860bcd9a63609bcbc
Created December 7, 2017 12:10
GeneratePrintJobAccountingReports.ps1
<#
GeneratePrintJobAccountingReports.ps1
ver. 2014-09-26-01
This script reads event log ID 307 and ID 805 from the log "Applications and Services Logs > Microsoft > Windows > PrintService"
from the specified server and for the specified time period and then calculates print job and total page count data from these
event log entries.
It then writes the output to two .CSV files, one showing by-print job data and the other showing by-user print job data.
<?xml version="1.0" encoding="utf-8"?>
<!-- Sample Autounattend.xml for Windows 10 media. This has been tested on 1511, 1607, and 1709 - x64 architecture only
For more details visit my blog http://blogs.catapultsystems.com/mdowst/archive/2017/12/11/create-zero-touch-windows-10-iso/ -->
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
<DiskConfiguration>
<Disk wcm:action="add">
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
@potatoqualitee
potatoqualitee / Invoke-WsusDbQuery.ps1
Created August 1, 2019 09:13
Create a connection to a WSUS database using PowerShell
# No longer used but didn't want to throw it away.
function Invoke-WsusDbQuery {
[CmdletBinding()]
param (
[string]$ComputerName = $script:WsusServer,
[PSCredential]$Credential = $script:WsusServerCredential,
[string]$Pattern,
[string]$UpdateId,
[switch]$EnableException
)