Skip to content

Instantly share code, notes, and snippets.

@ciphertxt
ciphertxt / DownloadSPC14.ps1
Created March 16, 2014 23:04
Downloads the SPC14 files with BITS instead of WebClient
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$rss = (new-object net.webclient)
$a = [xml]($rss.downloadstring("http://channel9.msdn.com/Events/SharePoint-Conference/2014/RSS/mp4high"))
$a.rss.channel.item | foreach {
$code = $_.comments.split("/") | select -last 1
$url = New-Object System.Uri($_.enclosure.url)
$file = $code + "-" + $_.creator + "-" + $_.title.Replace("'","").Replace("*","").Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "")
@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 / Get-SPDatabaseSizes.ps1
Created October 26, 2015 17:17
Gets the sizes and required storage of existing SharePoint databases. From http://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=193
Get-SPDatabase | ForEach-Object {$db=0} {$db +=$_.disksizerequired; $_.name + " - " + $_.disksizerequired/1024/1024} {Write-Host "`nTotal Storage (in MB) =" ("{0:n0}" -f ($db/1024/1024))} | Out-File c:\temp\spdatabasesizes.txt
with fs
as
(
select database_id, type, size * 8.0 / 1024 size
from sys.master_files
)
select
name,
(select sum(size) from fs where type = 0 and fs.database_id = db.database_id) DataFileSizeMB,
(select sum(size) from fs where type = 1 and fs.database_id = db.database_id) LogFileSizeMB