Skip to content

Instantly share code, notes, and snippets.

View JustinGrote's full-sized avatar

Justin Grote JustinGrote

View GitHub Profile
@JustinGrote
JustinGrote / piaportforward.py
Last active December 23, 2022 05:15
PrivateInternetAccess Port Forwarding Script
#!/usr/bin/env python3
#original script by Hanashi from PIA forums, mods to update transmission by Doonze
#converted to python3 and Deluge support added by Rastan
### IMPORTS
import requests
import json
import sys
import netifaces
@JustinGrote
JustinGrote / solusvm_monitor.py
Created July 4, 2016 21:05
SolusVM Monitor Alert
#!/usr/bin/env python3
###DESCRIPTION
#This script sends an email alert when a specific SolusVM metric
#exceeds its monitor
###USAGE
#solusvm_monitor.py <metric> <monitor>
#Metric: One of hdd, bw, or mem. Default is bw
#Monitor: Threshold to alert when exceeded. Default is 80
@JustinGrote
JustinGrote / New-MailboxBatchMigrationCSV.ps1
Created August 5, 2016 05:31
Exchange Mailbox Batch Migration with Intelligent Mailbox Balancing
#requires -version 3.0
#requires -pssnapin Microsoft.Exchange.Management.PowerShell.E2010
<#
.SYNOPSIS
Generates a CSV that can be used with the BatchMigration process
.DESCRIPTION
This script generates a CSV from a list of mailboxes for local migrations. Its primary use is to allow for custom mailbox distribution methods, such as by least-full database or round-robin
This is primarily meant for greenfield migrations where all databases are of similar configuration, and not heterogeneous database environments.
.NOTES
@JustinGrote
JustinGrote / Get-VMGuestDiskUsage.ps1
Created August 10, 2016 02:30
Get VMware Guest Disk Utilization Report of Virtual Machines
#requires -version 3.0
#requires -pssnapin vmware.vimautomation.core
#Uncomment this on first run for initial connection. Unnecessary for re-runs
#connect-viserver d1vm-vc01,d2vm-vc01,d1vm-vcvdi01,d2vm-vcvdi01 -credential (get-credential)
$noDiskInfoVMs = @()
$vm = get-vm
$vm |
where guestid -notmatch 'windows7_64Guest' |
@JustinGrote
JustinGrote / Format-ExchangeMessageTrace.ps1
Created August 15, 2016 22:47
Exchange Extended Message Trace script to parse an Exchange Extended Message Trace into usable Powershell Objects
<#
.SYNOPSIS
Takes an Exchange Extended Message Trace and parses it into usable powershell objects
#>
[CmdletBinding()]
param (
#Path to the extended message trace CSV
[Parameter(Mandatory)][String[]]$CSVPath
)
@JustinGrote
JustinGrote / Get-ADSIEnabledComputer.ps1
Created December 1, 2016 02:14
Get AD Computers using legacy ADSI Interface (Useful for Windows 2003 and areas where AD Web Services is not available for Get-ADComputer)
<#
.EXAMPLE
Get Enabled Computers from a domain in another environment
Get-ADSIEnabledComputer -connectionstring 'LDAP://myserver1.contoso.com/DC=contoso,dc=com' -username "admin" -password "Password@1307"
#>
#TODO: Convert Username/Password to PSCredential field for security
param (
@JustinGrote
JustinGrote / RemoveSmallFolders.ps1
Created August 18, 2017 01:54
Remove Folders with less than a certain filesize in them. Works on Powershell Linux too with beta5
(get-childitem) | % {[PSCustomObject]@{Name=$_.Fullname;Size=(get-childitem $_ -recurse | % length | measure -sum | % sum | % {$_/1MB})}} | where size -lt 100 | % {Remove-Item -Recurse -Force $_.name}
@JustinGrote
JustinGrote / Stop-DSCService.ps1
Last active April 19, 2018 22:39
Stop Powershell Desired State Configuration Forcefully
function Stop-DSCService {
stop-process (gwmi msft_providers | Where provider -like 'dsccore').hostprocessidentifier -force
remove-dscconfigurationdocument -stage pending -force
}
@JustinGrote
JustinGrote / Commvault.ps1
Last active March 11, 2024 21:24
Commvault REST API Commands I will make into a Module Someday
<#
Quickstart
------------------
Get-Help Connect-CVServer -detailed
Get-Help Invoke-CVCommand -detailed
Connect-CVServer mycommvaultserver -force -verbose
Invoke-CVCommand 'Client'
Invoke-CVCommand 'Client/136'
#>
@JustinGrote
JustinGrote / Test-CVPerformance.ps1
Created May 22, 2018 16:18
Use the Commvault CVDiskPerf program to test all fixed mounted disks except C: and report their performance
$CVDiskPerfEXE = 'C:\Program Files\Commvault\ContentStore\Base\cvdiskperf.exe'
$LogOutputDir = "$Home\desktop"
$drivesToTest = get-volume | where drivetype -match 'fixed' | where driveletter | where driveletter -notmatch 'C' | sort driveletter
foreach ($driveItem in $drivesToTest) {
[string]$driveletter = $driveitem.driveletter
write-verbose "Testing Drive $driveletter"
write-progress "Testing Drive $driveletter"
$args = @()