Skip to content

Instantly share code, notes, and snippets.

@bryanvine
bryanvine / BV-Working_with_Parse.ps1
Last active August 29, 2015 14:23
Powershell Script - Get-Parse & Publish-Parse - upload and download data from Parse.com Core DB
#Requires -Version 3.0
Function Get-Parse{
<#
.SYNOPSIS
Gets data from Parse.com's core DB.
.DESCRIPTION
Limitation: 10,000 entries per call. If your class is bigger, you'll need to break up your calls by objectIds.
@bryanvine
bryanvine / BV-Compare_Source_Files.ps1
Last active August 29, 2015 14:23
Powershell Script - Compare Source Files - utility function to compare code between dev, prod, qa, bcp, etc.
#Requires -Version 2.0
Function Compare-SourceFiles {
<#
.SYNOPSIS
Compares two directories and calculates any differences in files between them using MD5 hash comparison.
.DESCRIPTION
Only looks at full file paths, empty directories aren't scanned.
.PARAMETER Source1
Full path (or UNC network share) to a directory to compare
@bryanvine
bryanvine / BV-Test_Ping-RDP
Last active August 29, 2015 14:23
Quick Script Function Test-PingRDP - make a report from a list of servers, testing if it responds to a ping and has RDP open
Function Test-PingRDP {
Param(
[String]$ServerList,
[String]$CSVOutput = ".\ServerStatus.csv"
)
$collection = @()
Get-Content $serverList | ForEach-Object{
$serverStatus = New-Object PSObject
@bryanvine
bryanvine / TestIP_RDP.ps1
Last active August 29, 2015 14:23
Quick Script - Check if servers are pingable and have RDP port TCP 3389 open
Param(
[String] $Servers
)
$srvrs = gc $servers
$collection = @()
foreach ($srv in $srvrs){
$serverStatus = New-Object PSObject
$serverStatus |Add-Member NoteProperty ServerName $srv
@bryanvine
bryanvine / BV-Uptime.ps1
Last active August 29, 2015 14:23
Function: Get-LastBootTime - remotely find out when your computers where last rebooted
#Requires -Version 2.0
Function Get-LastBootTime{
<#
.SYNOPSIS
Uses WMI to query one or more computers and returns a sorted table of names and date/times of since last boot.
.DESCRIPTION
Works with any windows computer that can accept remote WMI queries
.PARAMETER ComputerName
Specifies one or more server names.
@bryanvine
bryanvine / BV-HTMLTableMaker.ps1
Last active August 29, 2015 14:23
ConvertTo-HtmlTabel - Make Pretty HTML formatted tables
#Requires -Version 3.0
Function ConvertTo-HtmlTable{
<#
.SYNOPSIS
Converts table objects into HTML text for web page conversion and/or emailing as html reports.
.DESCRIPTION
Will convert any object array into a formatted HTML string output for saving as a web page or for emailing.
Doesn't handle nested objects, please only provide a two-demensional table as input.
.PARAMETER Table
@bryanvine
bryanvine / gist:ad340458dfcaf31756fe
Last active August 29, 2015 14:23
Exampe - Invoke-Multithread
#http://www.bryanvine.com/2015/06/powershell-script-invoke-multithread.html
#ScriptBlock: function declaration with function name on the last line without the -ComputerName parameter
$SB = {
Function Check-WindowsServer{
param(
[string[]]$ComputerName
)
foreach ($server in $ComputerName){
@bryanvine
bryanvine / BV-Multithread.ps1
Last active August 29, 2015 14:23
Make any powershell script multithreaded with this powershell function wrapper (Invoke-Multithread)
#Requires -Version 3.0
Function Invoke-Multithread{
<#
.SYNOPSIS
Wrapper function that lets you divide and conquer a server list to multithread it's execution.
.DESCRIPTION
Similar behavior to Invoke-Command -Asjob which lets you remotely start scriptblocks on target servers,
this function starts local jobs that are to be targeted at remote servers.
Great for multithreaded push deployments or report generation
<#
Cleanup-windows-installer.ps1
http://www.bryanvine.com/2015/06/powershell-script-cleaning-up.html
Bryan Vine
6/22/2015
www.bryanvine.com
This script uses Heath Stewart's VB script to identify which files need to be saved and then removes everything else.