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
| function Get-FileWCAsynchronous{ | |
| param( | |
| [Parameter(Mandatory=$true)] | |
| $url, | |
| $destinationFolder="$env:USERPROFILE\Downloads", | |
| [switch]$includeStats | |
| ) | |
| $wc = New-Object Net.WebClient | |
| $wc.UseDefaultCredentials = $true | |
| $file = $url | Split-Path -Leaf |
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
| function Get-FileBitsTransferSynchronous{ | |
| param( | |
| [Parameter(Mandatory=$true)] | |
| $url, | |
| $destinationFolder="$env:USERPROFILE\Downloads", | |
| [switch]$includeStats | |
| ) | |
| Import-Module BitsTransfer | |
| $destination = Join-Path $destinationFolder ($url | Split-Path -Leaf) | |
| $start = Get-Date |
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
| function Get-FileBitsTransferAsynchronous{ | |
| param( | |
| [Parameter(Mandatory=$true)] | |
| $url, | |
| $destinationFolder="$env:USERPROFILE\Downloads", | |
| [switch]$includeStats | |
| ) | |
| $start = Get-Date | |
| $job = Start-BitsTransfer -Source $url -Destination $destinationFolder -DisplayName 'Download' -Asynchronous | |
| $destination = Join-Path $destinationFolder ($url | Split-Path -Leaf) |
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
| function whereEx { | |
| [CmdletBinding()] | |
| Param | |
| ( | |
| [Parameter(ValueFromPipeline=$true)] | |
| $InputObject, | |
| [Parameter(Mandatory=$true, | |
| Position=0)] | |
| $predicateString |
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
| #requires zenCoding.dll in \resources. Download via https://github.com/madskristensen/zencoding and compile. | |
| function Get-ZenCode{ | |
| [Alias("zenCode")] | |
| [CmdletBinding()] | |
| Param | |
| ( | |
| [Parameter(Mandatory=$true, | |
| Position=0)] | |
| $zenCodeExpr, | |
| [Parameter(ValueFromPipeline=$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
| function Get-WmiPowerShell { | |
| [CmdletBinding()] | |
| Param | |
| ( | |
| [Parameter(Mandatory)]$Class, | |
| [Parameter(Mandatory)]$Filter | |
| ) | |
| $errors = $tokens = $null | |
| $AST= [Management.Automation.Language.Parser]::ParseInput($filter.ToString().Replace('$null','NULL'), [ref]$tokens, [ref]$errors) | |
| $tokens = $tokens | where { $_.Text -and $_.Name -ne '_' -and $_.Kind -ne 'Dot' } |
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
| foreach ($command in ('Get-WmiObject','Get-CimInstance')){ | |
| $Metadata = New-Object System.Management.Automation.CommandMetaData (Get-Command $command) | |
| $proxyCmd = [System.Management.Automation.ProxyCommand]::Create($Metadata) #| clip | |
| if ($command -eq 'Get-WmiObject'){ | |
| $newParam = @' | |
| [Parameter(ParameterSetName='query')] | |
| [ScriptBlock] | |
| $PowerShellFilter, | |
| '@ | |
| } |
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
| function mySelect { | |
| [CmdletBinding()] | |
| param( | |
| [Parameter(ValueFromPipeline=$true)] | |
| [psobject]$InputObject, | |
| [Parameter(Position=0)] | |
| $Property | |
| ) | |
| begin{ | |
| #only if the property array contains a hashtable property |
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
| function Get-DateRange { | |
| Add-Type -AssemblyName System.Windows.Forms | |
| $form = new-object Windows.Forms.Form | |
| $form.text = "Calendar" | |
| $form.Size = new-object Drawing.Size @(656,639) | |
| # Make "Hidden" SelectButton to handle Enter Key | |
| $btnSelect = new-object System.Windows.Forms.Button | |
| $btnSelect.Size = "1,1" | |
| $btnSelect.add_Click({ |
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
| function Get-Uninstaller { | |
| [CmdletBinding()] | |
| Param( | |
| $DisplayName = '*', | |
| [ValidateSet('HKLM', 'HKCU')] | |
| [string[]]$Hive = @('HKLM','HKCU') | |
| ) | |
| $keys =@' | |
| :\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall | |
| :\SOFTWARE\WOW6432NODE\Microsoft\Windows\CurrentVersion\Uninstall |