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 New-DataTableFromSqlTable{ | |
<# | |
.SYNOPSIS | |
Create a new (empty) DataTable object based on a SQL Table. | |
.DESCRIPTION | |
Create a new (empty) DataTable object based on a SQL Table. | |
.PARAMETER DatabaseServer | |
The Hostname of the database server. |
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-FolderSize{ | |
<# | |
.SYNOPSIS | |
Get the total size of a folder. | |
.DESCRIPTION | |
Get the total size of a folder. | |
.PARAMETER Path | |
Path to target folder. |
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 ConvertTo-ScriptBlock{ | |
<# | |
.SYNOPSIS | |
Convert to ScriptBlock. | |
.DESCRIPTION | |
Convert input to ScriptBlock. | |
.EXAMPLE | |
Get-Content '.\scriptFile.ps1' -raw | ConvertTo-ScriptBlock |
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-ChildItemRecurse{ | |
<# | |
.SYNOPSIS | |
Wrapper for Get-ChildItem to be able to define how deep you want to search in a directory structure. | |
.DESCRIPTION | |
Wrapper for Get-ChildItem to be able to define how deep you want to search in a directory structure. | |
.PARAMETER Path | |
One or more paths you want to start searching from. Defaults to '.' (Current location). |
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 Out-ClipboardText { | |
[CmdletBinding()] | |
param ( | |
[Parameter(ValueFromPipeline,Mandatory, Position = 0)] | |
[string] $Text | |
) | |
Add-Type -AssemblyName 'PresentationCore' | |
[System.Windows.Clipboard]::SetText($Text) | |
} |
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-ClipboardText{ | |
Add-Type -AssemblyName 'PresentationCore' | |
Write-Output ([System.Windows.Clipboard]::GetText()) | |
} |
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-SpecialFolder { | |
param ([string]$Name) | |
foreach ($folder in (([Enum]::GetValues([System.Environment+SpecialFolder])) | Where-Object {$_ -like $Name})) { | |
Write-Output (,([PSCustomObject] @{ | |
Name = $folder.ToString() | |
Path = [System.Environment]::GetFolderPath($folder) | |
})) | |
} | |
} |
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-WebFile { | |
<# | |
.SYNOPSIS | |
Download a file from the internet. | |
.DESCRIPTION | |
Download a file from the internet. | |
.PARAMETER Url | |
URL of file being downloaded |
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 Write-PluralString{ | |
<# | |
.SYNOPSIS | |
Write string with built-in handling of plural-s for variable integer. | |
.DESCRIPTION | |
Write string with built-in handling of plural-s for variable integer. | |
.EXAMPLE | |
Write-PluralString "$($computer): " $num 'file' 'processed' |
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 Test-Connection { | |
[CmdletBinding(DefaultParameterSetName='Default', HelpUri='http://go.microsoft.com/fwlink/?LinkID=135266', RemotingCapability='OwnedByCommand')] | |
param( | |
[Parameter(ParameterSetName='Default')] | |
[Parameter(ParameterSetName='Source')] | |
[switch] | |
${AsJob}, | |
[System.Management.AuthenticationLevel] | |
${Authentication}, |
OlderNewer