This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param( | |
[String] $Servers | |
) | |
$srvrs = gc $servers | |
$collection = @() | |
foreach ($srv in $srvrs){ | |
$serverStatus = New-Object PSObject | |
$serverStatus |Add-Member NoteProperty ServerName $srv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Test-PingRDP { | |
Param( | |
[String]$ServerList, | |
[String]$CSVOutput = ".\ServerStatus.csv" | |
) | |
$collection = @() | |
Get-Content $serverList | ForEach-Object{ | |
$serverStatus = New-Object PSObject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -Version 2.0 | |
Function Get-ServerHDDinfo{ | |
<# | |
.SYNOPSIS | |
Gets all harddrive size info using WMI | |
.DESCRIPTION | |
Returns one object per drive: drive mount, label, total size, used size, used percent, free size. | |
WMI is slower than invoke-command so this is a fail back function for when PSRemoting isn't enabled. |
OlderNewer