This file contains hidden or 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
-- Copy of script from Jugal Shah | |
-- http://sqldbpool.com/2013/05/26/t-sql-script-to-find-out-the-database-file-size-space-used-and-available-free-space/ | |
set nocount on | |
create table #dbfileInfo( | |
name varchar(300), | |
location varchar(300), | |
filesizeMB decimal(9,2), | |
spaceUsedMB decimal(9,2), |
This file contains hidden or 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
$varsToSet = @("Something","Else","Here") | |
$i=0 | |
#set variables | |
foreach ($this in $varsToSet) { | |
$i++ | |
New-Variable -Name "dynamic$($this)" -Value $i | |
} | |
#retrieve variables |
This file contains hidden or 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
$newvols = ("vol-7f273b7b","vol-b5273bb1","vol-b6273bb2","vol-c6273bc2","vol-b1273bb5") | |
$tags = @() | |
$tag = New-Object Amazon.EC2.Model.Tag | |
$tag.Key = "Attached" | |
$tag.Value = "i-d7a706e9" | |
$tags += $tag | |
$tag = New-Object Amazon.EC2.Model.Tag |
This file contains hidden or 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
#method 1 | |
$f = New-Object Amazon.EC2.Model.Filter | |
$f.Name = "attachment.instance-id" | |
$f.Value.Add("i-a005239e") | |
$voltodel = Get-EC2Volume -Filters $f | |
#method 2 | |
$voltodel = Get-EC2Volume -Filters @{Name="attachment.instance-id"; Value="i-a005239e"} |
This file contains hidden or 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
$disks = (wmic diskdrive list brief | measure-object -line | select -ExpandProperty Lines)-2 | |
#1.. | |
$disks | ForEach-Object -Begin {$a = $null} -Process { ` | |
$a += $("select disk "+$_+[char][int](13)+[char][int](10)) ; ` | |
$a += "online disk noerr "+[char][int](13)+[char][int](10) ; ` | |
$a += "clean "+[char][int](13)+[char][int](10) ; ` | |
$a += "attributes disk clear readonly noerr "+[char][int](13)+[char][int](10) ; ` | |
$a += "convert dynamic noerr "+[char][int](13)+[char][int](10) ;} -End { $a += "exit"+[char][int](13)+[char][int](10) ; ` | |
$a | Set-Content c:\diskpart1.txt -Encoding ASCII ` |
This file contains hidden or 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
# | |
# Create Striped Volume set from (Available) Raw Disks | |
# | |
#settings | |
$letter = "E" #Drive Letter | |
$allocation = 65536 #Blocksize in Bytes | |
$label = "My Disk Label" #drive label | |
#Get started |
This file contains hidden or 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
# | |
# Create Striped Volume set a Single (only 1 available) Raw Disk | |
# | |
#settings | |
$letter = "F" #Drive Letter | |
$allocation = 65536 #Blocksize in Bytes | |
$label = "Master F: Logs" #drive label | |
#Get started |
This file contains hidden or 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
<# | |
.SYNOPSIS | |
Creates a number of NTFS Volume in AWS, attaches to an instance, formats, brings them online. | |
.EXAMPLE | |
_createVolumes.ps1 -zone ap-southeast-2a -type standard -instance i-12345678 -allocation 64 | |
This command creates volumes for instance i-12345678. | |
The Disks will be 64KB NTFS allocation. | |
#> | |
#No params supplied |
This file contains hidden or 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
#setup variables | |
$ami = "ami-e95c31d3" #public Windows server 2012 R2 | |
$subnet = "subnet-e1a4f488" #VPC Subnet for instance | |
$group = "sg-e5f3e889" #whatever security group | |
$folder = 'C:\Users\me\OneDrive' | |
$allVolumesAvailable = $False | |
$readyCount = 0 | |
$maxRetries = 20 | |
$sleepBetweenChecks = 10 | |
$Retries = 0 |