Skip to content

Instantly share code, notes, and snippets.

@ciphertxt
ciphertxt / GetBitsTransferProgress.ps1
Created March 18, 2014 01:57
Progress bar for current "Transferring" BITS Transfers with a time remain calculation.
while ((Get-BitsTransfer | ? { $_.JobState -eq "Transferring" }).Count -gt 0) {
$totalbytes=0;
$bytestransferred=0;
$timeTaken = 0;
foreach ($job in (Get-BitsTransfer | ? { $_.JobState -eq "Transferring" } | Sort-Object CreationTime)) {
$totalbytes += $job.BytesTotal;
$bytestransferred += $job.bytestransferred
if ($timeTaken -eq 0) {
#Get the time of the oldest transfer aka the one that started first
$timeTaken = ((Get-Date) - $job.CreationTime).TotalMinutes
# Originally published at https://gist.github.com/nzthiago/5736907
# I Customized it for SPC14 with slides
# If you like it, leave me a comment
# If you don't like it, complain to Github. :)
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$rss = (new-object net.webclient)
# Grab the RSS feed for the MP4 downloads
@ciphertxt
ciphertxt / Test-ServerConnectivity.ps1
Created October 27, 2014 00:11
Test a server for connectivity without PING
# From http://blogs.technet.com/b/heyscriptingguy/archive/2014/10/25/powertip-test-connectivity-to-remote-servers-without-ping.aspx
# Test a server for connectivity without PING
's1','s2' | % {Test-Wsman $_}
Get-BitsTransfer | Select-Object -Property *,@{ Name = 'PercentComplete'; Expression = { '{0:P}' -f ($PSItem.BytesTransferred/$PSItem.BytesTotal); }; };
@ciphertxt
ciphertxt / Get-EC2LatestWindowsServerAMI.ps1
Created February 4, 2015 00:06
Get's the latest Windows Server image for EC2 provisioning
Import-Module AWSPowerShell
Function Get-EC2LatestWindowsServerAMI
{
return Get-EC2Image | ? { $_.Platform -eq "Windows" -and $_.ImageOwnerAlias -eq "amazon" -and $_.Name -like "*Windows*Server*2012*R2*English*Base*" } | Sort-Object -Property CreationDate -Descending | Select-Object -First 1
}
@ciphertxt
ciphertxt / Get-EC2WindowsServer2012R2Base.ps1
Created February 4, 2015 00:19
Get-EC2ImageByName windows_2012r2_base | Select-Object -First 1
Get-EC2ImageByName windows_2012r2_base | Select-Object -First 1
@ciphertxt
ciphertxt / azrdp.ps1
Last active August 29, 2015 14:17 — forked from pcgeek86/azrdp.ps1
function azrdp {
<#
.Author
Trevor Sullivan <pcgeek86@gmail.com>
.Description
Invoke a RDP session to an Azure Virtual Machine, without having to type the
Cloud Service name or Virtual Machine name.
.Outputs
#!/bin/bash
# Encode a WAV to a finalized podcast MP3 with metadata, in the current directory
# Requires lame
# With Homebrew on Mac OS X: brew install lame
SHOW_AUTHOR="ATP"
EPISODE_NUMBER=104
EPISODE_TITLE="Minutiæ"
{
"bold_folder_labels": true,
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
"draw_white_space": "selection",
"ensure_newline_at_eof_on_save": true,
"fade_fold_buttons": false,
"font_face": "Input Mono Narrow",
"font_size": 16,
"gutter": true,
"highlight_line": true,
@ciphertxt
ciphertxt / Getting Your SharePoint Farm Information
Created October 26, 2015 13:56 — forked from PCfromDC/Getting Your SharePoint Farm Information.ps1
This PowerShell script gets all of your SharePoint Farm's information
#Get Backup Path
$bkdir = read-host("Enter Folder Location eg: (C:\temp)") # Get Backup Path!
if ($bkdir.EndsWith("\")){$bkdir = $bkdir.TrimEnd("\")}
# Set Backup Path if you want to hard code your path
#$bkdir = "\\serverName\Shared\Temp" (optional "C:\Temp")
# Verify folder exists
if ((test-path $bkdir) -eq $false ) # Verify folder else create it...
{