🕵️♂️
This file contains 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 | |
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{ |
This file contains 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
Start-Sleep -s 55 |
This file contains 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
#----------------------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-------------------------------------- |
This file contains 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
#----------------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"){ |
This file contains 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
#------------------------------------------------------ | |
#check currently installed roles | |
Get-WindowsFeature | where {$_.installed -eq "True"} | |
#------------------------------------------------------ | |
#------------------------------------------------------ | |
#install the Hyper-V Role | |
Install-WindowsFeature Hyper-V -IncludeManagementTools -Restart -Verbose | |
#------------------------------------------------------ | |
This file contains 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
#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:)" | |
} | |
This file contains 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
#version info | |
$PSVersionTable | |
$PSVersionTable.PSVersion | |
$PSVersionTable.WSManStackVersion | |
$PSVersionTable.WSManStackVersion.Major | |
#WFM version | |
(host).Version |
This file contains 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
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 | |
} |
This file contains 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
$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) |
This file contains 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
$password = Read-Host "Enter your password" | |
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force |