Skip to content

Instantly share code, notes, and snippets.

View techthoughts2's full-sized avatar
🕵️‍♂️
Investigating a better artifact workflow

Jake Morrison techthoughts2

🕵️‍♂️
Investigating a better artifact workflow
View GitHub Profile
@techthoughts2
techthoughts2 / Get-GeneralInfo.ps1
Created December 28, 2015 15:49
Get general device information loaded up
<#
.Synopsis
Get-GeneralInfo gathers general info about the device to provide in the output
.DESCRIPTION
Get-GeneralInfo gathers general info about the device including hostname, model to display in the final output
#>
function Get-GeneralInfo {
#--------------------------------------------------------------------------------------
#Getting the host name with error control
try{
@techthoughts2
techthoughts2 / Pause.ps1
Last active December 28, 2015 16:07
Pause the script
Start-Sleep -s 55
@techthoughts2
techthoughts2 / New-VHD.ps1
Created December 28, 2015 16:28
Create a New-VHD
#----------------------Variables Used----------------------------------------
[string]$vmName = $null
[string]$vhdName = $null
[string]$vhdType = $null
[string]$path = $null
[string]$vhdPath = $null
[int64]$vhdSize = $null
[string]$dynamic = $null
[string]$confirm = $null
#--------------------END Variables Used--------------------------------------
@techthoughts2
techthoughts2 / New-VM.ps1
Created December 28, 2015 16:31
Creates a new Hyper-V VM with user prompts
#----------------USER CREATION QUESTIONS-------------------
[string]$vmName= Read-Host ”Name of VM”
#__________________________________________________________
[int32]$generation = Read-Host "Generation Type"
#__________________________________________________________
[string]$dynamic = $null
while("yes","no" -notcontains $dynamic){
$dynamic = Read-Host "Will this VM use dyanmic memory? (yes/no)"
}
if($dynamic -eq "yes"){
@techthoughts2
techthoughts2 / Hyp_Lab_Setup.ps1
Created December 28, 2015 16:33
Quick Hyper-V Lab Setup
#------------------------------------------------------
#check currently installed roles
Get-WindowsFeature | where {$_.installed -eq "True"}
#------------------------------------------------------
#------------------------------------------------------
#install the Hyper-V Role
Install-WindowsFeature Hyper-V -IncludeManagementTools -Restart -Verbose
#------------------------------------------------------
@techthoughts2
techthoughts2 / UserChoices.ps1
Last active January 6, 2016 16:54
User Choices
#will we disable NICs in the team to determine if each NIC connection is good?
while("yes","no" -notcontains $Script:nicCheckSetting){
$Script:nicCheckSetting = Read-Host "Would you like to run the NIC Team connectivty check to check each NIC in the team? (yes/no)"
}
#for standalone Hyps - which drive will the VMs be stored on?
while("c:","d:","e:","f:","g:","h:","i:","j:","k:","l:","m:","n:","o:","p:","q:","r:","s:","t:","u:","v:","w:","x:","y:","z:" -notcontains $Script:vmVHDLocation){
$Script:vmVHDLocation = Read-Host "What drive letter will the VMs and VHDs be stored? (Ex. D: or S:)"
}
@techthoughts2
techthoughts2 / Versioning.ps1
Created February 28, 2016 04:37
Version commands
#version info
$PSVersionTable
$PSVersionTable.PSVersion
$PSVersionTable.WSManStackVersion
$PSVersionTable.WSManStackVersion.Major
#WFM version
(host).Version
@techthoughts2
techthoughts2 / FizzBuzz.ps1
Created February 29, 2016 05:13
FizzBuzz
for ($i = 1; $i -le 100; $i++) {
if ($i % 15 -eq 0) {
"FizzBuzz"
} elseif ($i % 5 -eq 0) {
"Buzz"
} elseif ($i % 3 -eq 0) {
"Fizz"
} else {
$i
}
@techthoughts2
techthoughts2 / Date_Manip.ps1
Last active August 8, 2016 17:09
Date manipulation
$certInfo = ls Cert:\LocalMachine\My | where { $_.Subject -eq $subject }
$expireDate = $certInfo.NotAfter
[int]$daysRemaining = New-TimeSpan -End $expireDate | Select-Object -ExpandProperty Days
$date = Get-Date
$1weekOut = $date.AddDays(7)
@techthoughts2
techthoughts2 / secureString.ps1
Last active November 27, 2016 03:37
Convert a plain text string to a secure string
$password = Read-Host "Enter your password"
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force