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
function Get-DownloadSpeed | |
{ | |
[CmdletBinding()] | |
Param | |
( | |
# Param1 help description | |
[Parameter(Mandatory=$true, Position=0)] | |
$SpeedtestServer, |
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
PS> Get-CimInstance win32_logicaldisk | foreach-object {write "$($_.caption) $([math]::round(($_.size /1gb),2)), $([math]::round(($_.FreeSpace /1gb),2)) "} | |
C: 117.99, 21.12 | |
D: 59.45, 9.48 | |
E: 0, 0 | |
F: 1863.02, 830.57 | |
G: 7.6, 0.22 | |
Y: 1862.89, 1409.86 |
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
#replace get-ciminstance with get-wmiobject if using v2 | |
Get-CimInstance win32_operatingsystem | ft -autosize ` | |
CSName, ` | |
Caption, ` | |
OSArchitecture, ` | |
@{Label="RAM, GB"; Expression={[math]::round($_.TotalVisibleMemorySize/1mb, 2)}} | |
Get-CimInstance win32_processor | ft -autosize ` | |
@{Label="Socket"; Expression={$_.SocketDesignation}}, ` |
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
################## | |
# 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 |
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
function Get-Temperature { | |
$t = Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace "root/wmi" | |
$returntemp = @() | |
foreach ($temp in $t.CurrentTemperature) | |
{ | |
$currentTempKelvin = $temp / 10 | |
$currentTempCelsius = $currentTempKelvin - 273.15 | |
$currentTempFahrenheit = (9/5) * $currentTempCelsius + 32 | |
$returntemp += $currentTempCelsius.ToString() + " C / " + $currentTempFahrenheit.ToString() + " F / " + $currentTempKelvin + "K" |
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
$i=1; while ($i -lt 200) {write-warning "iteration $i completed in $(Measure-Command {$result = 1; foreach ($number in 5000..1000000) {$result = $result * $number}})"; $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
<# | |
This script performs the 'search' phase of a Windows Update, using the standard WUA API. | |
It does not download or install updates. | |
Sole purpose of this script is to find out how long it takes to download the required cabfile, | |
then process it against a live system and return the list of updates available for that system. | |
#> | |
function DownloadFile { | |
param ( | |
[Parameter(Mandatory=$true,Position=0)] $url, | |
[Parameter(Mandatory=$true,Position=1)] $file |
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-process notepad; start-process calc; start-process wordpad | |
start-process notepad; start-process calc; start-process wordpad | |
#now the part I always forget | |
get-process | where processname -in notepad,calc,wordpad | |
#spaces ok too | |
get-process | where processname -in notepad, calc, wordpad |
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
$size = $(get-item .\Rootstore.sst).Length | |
Write-Host "Size $size" | |
switch ($size) { | |
($_ -gt 30000000000) {$foo = "reallybig" ;break} | |
($_ -lt 25000000000) {$foo = "size5" ;break} | |
($_ -lt 20000000000) {$foo = "size4" ;break} | |
($_ -lt 15000000000) {$foo = "size3" ;break} | |
($_ -lt 10000000000) {$foo = "size2" ;break} | |
($_ -lt 5000000000) {$foo = "size1" ;break} | |
} |
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
#requires -version 2.0 | |
function Get-UpdateList { | |
<# | |
.Synopsis | |
Gets list of updates from Windows Update. | |
.PARAMETER Criteria | |
The search criteria, see http://goo.gl/7nZSPs |
OlderNewer