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
$String = 'testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestt |
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
$SourceSirectory = '\\APP2\D$\Logs' | |
$DestinationDirectory = '\\APP4\D$\Logs' | |
Get-ChildItem -Path $DestinationDirectory -Directory -Recurse ` | |
| ForEach-Object { | |
$DestinationPath = $_.FullName | |
$SourcePath = $DestinationPath.Replace($DestinationDirectory, $SourceSirectory) | |
if (Test-Path -Path $SourcePath -PathType Container) |
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
Get-CimInstance -Namespace 'root/Microsoft/SqlServer/ComputerManagement10' -ClassName 'SqlService' -Filter 'SQLServiceType = 1' -Property 'ServiceName' -ErrorAction Stop ` | |
| Select-Object -ExpandProperty 'ServiceName' ` | |
| ForEach-Object { | |
$Instance = $_ | |
$SqlDatabaseClassName = 'Win32_PerfFormattedData_{0}_SQLServerDatabases' -f $Instance | |
Get-CimInstance -ClassName $SqlDatabaseClassName -Filter 'NOT Name = "_Total"' -Property 'Name' -ErrorAction Stop | |
} ` | |
| Select-Object -ExpandProperty 'Name' ` | |
| ForEach-Object { | |
New-Object -TypeName PSObject -Property @{ 'Instance' = $Instance; 'Database' = $_ } |
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
$TestVariable = 'Test value.' | |
$RunspaceScript = { | |
param | |
( | |
[Parameter(Mandatory = $true)] | |
[System.Object] $ObservableCollection | |
) | |
if ($TestVariable -eq $null) |
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
SELECT | |
j.[name] [job_name], | |
s.[step_id] [step_number], | |
s.[step_name] [step_name], | |
s.[command] [step_query], | |
s.[database_name] [step_database] | |
FROM | |
[msdb].[dbo].[SysJobs] j | |
INNER JOIN [msdb].[dbo].[sysjobsteps] s ON s.[job_id] = j.[job_id] | |
WHERE |
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
apt-mark showmanual | while read -r package; do size=$(apt-cache --no-all-versions show $package | grep '^Installed-Size: ' | cut -f2 -d':' | xargs) && echo "$package $size"; done | sort -rnk2 |
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 Send-Datagram | |
{ | |
[CmdletBinding(SupportsShouldProcess = $true)] | |
param | |
( | |
[Parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)] | |
[AllowEmptyCollection()] | |
[AllowEmptyString()] | |
[AllowNull()] | |
[Alias('Data')] |
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-RandomString | |
{ | |
[CmdletBinding()] | |
param | |
( | |
[Parameter(Position = 0, Mandatory = $true)] | |
[UInt32] $Length, | |
[Parameter()] | |
[String] $Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' |
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-PerfomanceCounterHash | |
{ | |
[CmdletBinding()] | |
param | |
( | |
[Parameter()] | |
[Switch] $NotLocalized | |
) | |
$KeyName = 'Counter' |
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
$Server = 'SQL-APPS' | |
$ConnectionTimeout = 15 | |
$MaxConnections = 500 | |
$ConnectionStringFormat = 'Server = {0}; Connection Timeout = {1}; Max Pool Size = {2}; Integrated Security = True;' | |
$CommandQuery = 'SELECT 1' | |
$ConnectionString = $ConnectionStringFormat -f $Server, $ConnectionTimeout, $MaxConnections | |
$Connections = [System.Collections.ArrayList] @() |
OlderNewer