🕵️♂️
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 | |
Verifies if currently logged in user is a local user or domain user | |
.DESCRIPTION | |
This function will evaluate the users domain and determine if the current user is a domain user or local user. If true is returned the user is a domain user, if false is returned the user is a local user. | |
.EXAMPLE | |
Test-DomainUser | |
This will return a true/false indicating if the user is a domain user or not | |
.EXAMPLE | |
Test-DomainUser -Verbose |
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
Start-Sleep -s 55 |
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 | |
Tests if specified registry key is present | |
.DESCRIPTION | |
Evaluates provided registry path and determines if key is present. True or false is returned. | |
.PARAMETER RegKeyPath | |
Registry key path - must be in PS shorthand. Ex: HKLM:\SECURITY | |
.EXAMPLE | |
Test-RegKey -RegKeyPath HKLM:\SECURITY | |
Verifies if the specified registry key exists |
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
#----------------------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 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
#----------------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 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
#------------------------------------------------------ | |
#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 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
#determine if current VM AutomaticStopAction settings is using up a lot of harddrive space | |
#--------------------------------------------------------- | |
$vmMemory = 0 | |
#--------------------------------------------------------- | |
try { | |
$vms = Get-VM -ErrorAction Stop | |
foreach ($vm in $vms) { | |
if ($vm.AutomaticStopAction -eq "Save") { | |
$vmMemory += [math]::round($vm.MemoryAssigned / 1GB, 0) | |
} |
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
#version info | |
$PSVersionTable | |
$PSVersionTable.PSVersion | |
$PSVersionTable.WSManStackVersion | |
$PSVersionTable.WSManStackVersion.Major | |
#WFM version | |
(host).Version |
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
#get the updated help | |
Update-Help -Module PowerShellGet | |
#install NuGet if not already installed | |
$testNuGet = $null | |
$nuGet = Get-PackageProvider | Select-Object -ExpandProperty Name | |
foreach($result in $nuGet){ | |
if($result -eq "NuGet"){ | |
$testNuGet = $true | |
} |
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
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 | |
} |