Skip to content

Instantly share code, notes, and snippets.

@sirsql
sirsql / Get-NewPassword.ps1
Created May 4, 2022 17:15
Creates a new password of specified length
#Creates a new password of specified length using characters within the random character set
function Get-NewPassword ([int32]$PasswordLength) {
if (!$PasswordLength) { $PasswordLength = 42 }
[string]$CharacterSet = 'abcdefghijklmnoprstuvwxyzABCDEFGHIJKLMONPQRSTUVWXYZ!@#$%^&*()[]{},.<>/?'
$RandomChar = 1..$PasswordLength | ForEach-Object { Get-Random -Maximum $CharacterSet.length }
$ofs = ""
[string]$CharacterSet[$RandomChar]
}
/********************************************************************************************************** *
* *
* Name: Backup Test Harness.sql (version 1.0 2012-12-11) *
* *
* Author: Nicholas Cain, http://sirsql.net *
* *
* Purpose: This script is written for the purposes of performing multiple backups of a database using *
* different MAXTRANSFERSIZE & BUFFERCOUNT values as well as different numbers of backup files. *
* This is done in an attempt to identify the optimal settings that can be used to minimize backup *
* times. *