function rdp { [cmdletbinding()] param ($server,[switch]$fullScreen) if ($fullscreen) { mstsc -v $server -f } else { mstsc -v $server /w 1680 /h 875 } } function Get-TraceRoute { [cmdletbinding()] param( $address ) Test-NetConnection $address -TraceRoute | Select -ExpandProperty TraceRoute | foreach { Resolve-DnsName $_ -type PTR -ErrorAction SilentlyContinue } } function Get-Minutes { [cmdletbinding()] param( [datetime]$start, [datetime]$end = (Get-Date) ) Write-Host "Total Minutes: $("{0:N0}" -f (New-TimeSpan $start $end).TotalMinutes)" -BackgroundColor Red } function Pull-ProcessMemory ($process) { get-process "$process*" | Group-Object -Property ProcessName | Format-Table Name, @{n='Mem (MB)';e={'{0:N0}' -f (($_.Group|Measure-Object WorkingSet -Sum).Sum / 1MB)};a='right'} -AutoSize } function Find-PhoneNum ($lastname,$firstname) { $phonebook = Import-Csv "$env:USERPROFILE\Google Drive\Pythian_phonebook.csv" -Delimiter ',' if ($lastname) { $phonebook | where {$_."Last Name" -match $lastname} | select "First Name", "Last Name", Number, "Cell Phone Number" } if ($firstname) { $phonebook | where {$_."First Name" -match $firstname} | select "First Name", "Last Name", Number, "Cell Phone Number" } } Import-Module posh-git function Convert-PandocWord { [cmdletbinding()] param([string]$mdfile,[string]$outWord) if ( (Test-Path $mdfile) ) { & pandoc.exe -s -S $mdfile -o $outWord } if ( (Test-Path $outWord) ) { Invoke-Item $outWord } } # AWS profile - Pythian sandbox Import-Module AWSPowerShell Set-AWSCredentials -ProfileName aws_sandbox $awsMyOwner = @( @{name='tag:owner'; values="melton"} ) function Get-MyEc2Instances { [cmdletbinding()] param() $data = Get-EC2Instance -Filter $awsMyOwner | Select-Object -ExpandProperty Instances | Select-Object InstanceId, @{l="Name";e={$_.Tag | Where-Object Key -eq "Name" | % {$_.Value}}}, PublicIpAddress, PrivateIpAddress, @{l="state";e={($_.State).Name}} | Sort-Object PrivateIpAddress return $data } function Start-MyEc2Instances { [cmdletbinding()] param( [switch]$basic, [switch]$sql14 ) $sql14List = 'melton-win12r2-sql1402','melton-win12r2-sql1401' if ($basic) { #Start DC01 (Get-MyEc2Instances | where-object {$_.name -eq 'melton-dc01'}).InstanceId | Start-EC2Instance Start-Sleep -Seconds 90 #Start win2016 (Get-MyEc2Instances | where-object {$_.name -eq 'melton-win16-utility'}).InstanceId | Start-EC2Instance } if ($sql14) { (Get-MyEc2Instances | Where-Object {$sql14List -contains $_.name}).InstanceId | Start-EC2Instance } } function Stop-MyEc2Instances { [cmdletbinding()] param( [switch]$all ) if ($all) { #Start DC01 (Get-MyEc2Instances).InstanceId | Stop-EC2Instance } }