Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Wes Carroll wcarroll

🎯
Focusing
View GitHub Profile
@wcarroll
wcarroll / Windows10-Setup.ps1
Created Nov 20, 2020 — forked from NickCraver/Windows10-Setup.ps1
(In Progress) PowerShell Script I use to customize my machines in the same way for privacy, search, UI, etc.
View Windows10-Setup.ps1
##################
# Privacy Settings
##################
# Privacy: Let apps use my advertising ID: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 0
# To Restore:
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 1
# Privacy: SmartScreen Filter for Store Apps: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost -Name EnableWebContentEvaluation -Type DWord -Value 0
@wcarroll
wcarroll / MyProfile.ps1
Last active Dec 15, 2019
PowerShell Profile
View MyProfile.ps1
Function Get-MyIp {
Invoke-RestMethod -Uri "https://ipinfo.io/json"
}
Function Get-LastCommandExecutionTime {
<#
.SYNOPSIS
Gets the execution time of the last command used.
.EXAMPLE
Get-LastCommandExecutionTime
@wcarroll
wcarroll / AoCD1P2.ps1
Last active Dec 1, 2019
Advent of Code 2019 - Day 1 - Problem 2 Solution
View AoCD1P2.ps1
Function Get-Fuel ($PayloadMass) {
$RequiredFuel = [Math]::Floor($PayloadMass / 3) - 2
if ($RequiredFuel -le 0) {
return 0
} else {
return $($RequiredFuel + $(Get-Fuel($RequiredFuel)))
}
}
$PayloadMasses = Get-Content .\PayloadMasses.txt
@wcarroll
wcarroll / AoCD1P1.ps1
Last active Dec 1, 2019
Advent of Code 2019 - Day 1 - Problem 1 Solution
View AoCD1P1.ps1
Function Get-Fuel ($PayloadMass) {
[Math]::Floor($PayloadMass / 3) - 2
}
$PayloadMasses = Get-Content .\PayloadMasses.txt
$TotalRequiredFuel = 0
foreach ($PayloadMass in $PayloadMasses) {
$TotalRequiredFuel += Get-Fuel($PayloadMass)
}
Write-Output "Total Required Fuel: $TotalRequiredFuel"
@wcarroll
wcarroll / profile.ps1
Created Sep 21, 2019
My PowerShell Profile
View profile.ps1
Function Get-LastCommandExecutionTime {
<#
.SYNOPSIS
Gets the execution time of the last command used.
.EXAMPLE
Get-LastCommandExecutionTime
Description
-----------
Gets the last execution time of the last command run.
View update-datastoreidentifier.ps1
foreach ($volume in $VolumeList){
$volumeUri = "$VMSettingsUrl/volumes/$($volume.volumeIdentifier)"
$currentVolume = Invoke-RestMethod -Uri $volumeUri -Method GET -TimeoutSec 100 -Headers $ZertosessionHeader -ContentType $TypeJSON
$currentVolume.Datastore.DatastoreIdentifier = $newVMDS.DatastoreIdentifier
$body = $currentVolume | Convertto-Json -depth 10
$ChangeVolumeLocationRequest = Invoke-RestMethod -Uri $volumeUri -Method PUT -TimeoutSec 100 -Headers $ZertosessionHeader -ContentType $TypeJSON -Body $body
} #Close Volume Loop