Permalink
Browse files

trailing spaces

  • Loading branch information...
niphlod committed Jan 2, 2018
1 parent 309d854 commit 29d0cb0398cd2587c9eaafe7cf513bcc7f08a1a0
Showing 426 changed files with 5,498 additions and 5,498 deletions.
@@ -63,7 +63,7 @@ if ($ImportLibrary) {
else {
$hasProject = Test-Path -Path "$libraryBase\projects\dbatools\dbatools.sln"
$hasCompiledDll = Test-Path -Path "$libraryBase\dbatools.dll"
if ((-not $script:alwaysBuildLibrary) -and $hasCompiledDll -and ([System.Diagnostics.FileVersionInfo]::GetVersionInfo("$libraryBase\dbatools.dll").FileVersion -eq $currentLibraryVersion)) {
$start = Get-Date
try {
@@ -91,19 +91,19 @@ if ($ImportLibrary) {
# This doesn't seem to work. Keep it here for now
$msbuildOptions = '/logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"'
$msbuildConfiguration = '/p:Configuration=Debug'
if (-not (Test-Path "C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll")) {
throw "msbuild logger not found, cannot compile library! Check your .NET installation health, then try again. Path checked: $msbuild"
}
}
if (-not (Test-Path $msbuild)) {
throw "msbuild not found, cannot compile library! Check your .NET installation health, then try again. Path checked: $msbuild"
}
Write-Verbose -Message "Building the library"
& $msbuild "$libraryBase\projects\dbatools\dbatools.sln" $msbuildConfiguration $msbuildOptions
try {
Write-Verbose -Message "Found library, trying to copy & import"
if ($script:alwaysBuildLibrary) { Move-Item -Path "$libraryBase\dbatools.dll" -Destination $script:DllRoot -Force -ErrorAction Stop }
@@ -120,7 +120,7 @@ if ($ImportLibrary) {
throw "No valid dbatools library found! Check your module integrity"
}
}
#region PowerShell TypeData
Update-TypeData -TypeName "Sqlcollaborative.Dbatools.dbaSystem.DbatoolsException" -SerializationDepth 2 -ErrorAction Ignore
Update-TypeData -TypeName "Sqlcollaborative.Dbatools.dbaSystem.DbatoolsExceptionRecord" -SerializationDepth 2 -ErrorAction Ignore
@@ -140,7 +140,7 @@ we have failed.
Please, in order to help us prevent this from happening again, visit us at:
https://github.com/sqlcollaborative/dbatools/issues
and tell us about this failure. All information will be appreciated, but
and tell us about this failure. All information will be appreciated, but
especially valuable are:
- Exports of the exception: $Error | Export-Clixml error.xml -Depth 4
- Screenshots
@@ -21,9 +21,9 @@ $TypeAliasTable = @{
# Add all type aliases
foreach ($TypeAlias in $TypeAliasTable.Keys) {
try {
$TAType::Add($TypeAlias, $TypeAliasTable[$TypeAlias])
try {
$TAType::Add($TypeAlias, $TypeAliasTable[$TypeAlias])
}
catch {
catch {
}
}
@@ -5,24 +5,24 @@ function Import-ModuleFile {
<#
.SYNOPSIS
Helps import dbatools files according to configuration
.DESCRIPTION
Helps import dbatools files according to configuration
Always dotsource this function!
.PARAMETER Path
The full path to the file to import
.EXAMPLE
PS C:\> Import-ModuleFile -Path $function.FullName
Imports the file stored at '$function.FullName'
#>
[CmdletBinding()]
Param (
$Path
)
if ($script:doDotSource) { . $Path }
else { $ExecutionContext.InvokeCommand.InvokeScript($false, ([scriptblock]::Create([io.file]::ReadAllText($Path))), $null, $null) }
}
@@ -31,36 +31,36 @@ function Write-ImportTime {
<#
.SYNOPSIS
Writes an entry to the import module time debug list
.DESCRIPTION
Writes an entry to the import module time debug list
.PARAMETER Text
The message to write
.EXAMPLE
PS C:\> Write-ImportTime -Text "Starting SMO Import"
Adds the message "Starting SMO Import" to the debug list
#>
[CmdletBinding()]
Param (
[string]$Text,
$Timestamp = (Get-Date)
)
if ($dbatools_disableTimeMeasurements) { return }
if (-not $script:dbatools_ImportPerformance) { $script:dbatools_ImportPerformance = @() }
if (([System.Management.Automation.PSTypeName]'Sqlcollaborative.Dbatools.Configuration.Config').Type -eq $null) {
$script:dbatools_ImportPerformance += New-Object PSObject -Property @{ Time = $timestamp; Action = $Text }
}
else {
if ([Sqlcollaborative.Dbatools.dbaSystem.DebugHost]::ImportTimeEntries.Count -eq 0) {
foreach ($entry in $script:dbatools_ImportPerformance) { [Sqlcollaborative.Dbatools.dbaSystem.DebugHost]::ImportTimeEntries.Add((New-Object Sqlcollaborative.Dbatools.dbaSystem.StartTimeEntry($entry.Action, $entry.Time, ([System.Management.Automation.Runspaces.Runspace]::DefaultRunspace.InstanceId)))) }
}
[Sqlcollaborative.Dbatools.dbaSystem.DebugHost]::ImportTimeEntries.Add((New-Object Sqlcollaborative.Dbatools.dbaSystem.StartTimeEntry($Text, $timestamp, ([System.Management.Automation.Runspaces.Runspace]::DefaultRunspace.InstanceId))))
}
}
@@ -133,9 +133,9 @@ if (-not ([System.Management.Automation.PSTypeName]'Microsoft.SqlServer.Manageme
Write-ImportTime -Text "Starting import SMO libraries"
}
<#
<#
Do the rest of the loading
Do the rest of the loading
#>
@@ -545,7 +545,7 @@ $timeSpent = 0
while (($script:smoRunspace.Runspace.RunspaceAvailability -eq 'Busy') -or ($script:dbatoolsConfigRunspace.Runspace.RunspaceAvailability -eq 'Busy')) {
Start-Sleep -Milliseconds 50
$timeSpent = $timeSpent + 50
if ($timeSpent -ge $timeout) {
Write-Warning @"
The module import has hit a timeout while waiting for some background tasks to finish.
@@ -2,118 +2,118 @@ function Backup-DbaDatabase {
<#
.SYNOPSIS
Backup one or more SQL Sever databases from a single SQL Server SqlInstance.
.DESCRIPTION
Performs a backup of a specified type of 1 or more databases on a single SQL Server Instance. These backups may be Full, Differential or Transaction log backups.
.PARAMETER SqlInstance
The SQL Server instance hosting the databases to be backed up.
.PARAMETER SqlCredential
Credentials to connect to the SQL Server instance if the calling user doesn't have permission.
.PARAMETER Database
The database(s) to process. This list is auto-populated from the server. If unspecified, all databases will be processed.
.PARAMETER ExcludeDatabase
The database(s) to exclude. This list is auto-populated from the server.
.PARAMETER BackupFileName
The name of the file to backup to. This is only accepted for single database backups.
If no name is specified then the backup files will be named DatabaseName_yyyyMMddHHmm (i.e. "Database1_201714022131") with the appropriate extension.
If the same name is used repeatedly, SQL Server will add backups to the same file at an incrementing position.
SQL Server needs permissions to write to the specified location. Path names are based on the SQL Server (C:\ is the C drive on the SQL Server, not the machine running the script).
.PARAMETER BackupDirectory
Path in which to place the backup files. If not specified, the backups will be placed in the default backup location for SqlInstance.
If multiple paths are specified, the backups will be striped across these locations. This will overwrite the FileCount option.
If the path does not exist, Sql Server will attempt to create it. Folders are created by the Sql Instance, and checks will be made for write permissions.
File Names with be suffixed with x-of-y to enable identifying striped sets, where y is the number of files in the set and x ranges from 1 to y.
.PARAMETER CopyOnly
If this switch is enabled, CopyOnly backups will be taken. By default function performs a normal backup, these backups interfere with the restore chain of the database. CopyOnly backups will not interfere with the restore chain of the database.
For more details please refer to this MSDN article - https://msdn.microsoft.com/en-us/library/ms191495.aspx
For more details please refer to this MSDN article - https://msdn.microsoft.com/en-us/library/ms191495.aspx
.PARAMETER Type
The type of SQL Server backup to perform. Accepted values are "Full", "Log", "Differential", "Diff", "Database"
.PARAMETER FileCount
This is the number of striped copies of the backups you wish to create. This value is overwritten if you specify multiple Backup Directories.
.PARAMETER CreateFolder
If this switch is enabled, each database will be backed up into a separate folder on each of the paths specified by BackupDirectory.
.PARAMETER CompressBackup
If this switch is enabled, the function will try to perform a compressed backup if supported by the version and edition of SQL Server. Otherwise, this function will use the server's default setting for compression.
.PARAMETER MaxTransferSize
Sets the size of the unit of transfer. Values must be a multiple of 64kb.
.PARAMETER Blocksize
Specifies the block size to use. Must be one of 0.5KB, 1KB, 2KB, 4KB, 8KB, 16KB, 32KB or 64KB. This can be specified in bytes.
Refer to https://msdn.microsoft.com/en-us/library/ms178615.aspx for more detail
.PARAMETER BufferCount
Number of I/O buffers to use to perform the operation.
Refer to https://msdn.microsoft.com/en-us/library/ms178615.aspx for more detail
.PARAMETER Checksum
If this switch is enabled, the backup checksum will be calculated.
.PARAMETER Verify
If this switch is enabled, the backup will be verified by running a RESTORE VERIFYONLY against the SqlInstance
.PARAMETER DatabaseCollection
Internal parameter
.PARAMETER AzureBaseUrl
The URL to the basecontainer of an Azure storage account to write backups to.
If specified, the only other parameters than can be used are "NoCopyOnly", "Type", "CompressBackup", "Checksum", "Verify", "AzureCredential", "CreateFolder".
.PARAMETER AzureCredential
The name of the credential on the SQL instance that can write to the AzureBaseUrl.
.PARAMETER NoRecovery
This is passed in to perform a tail log backup if needed
.PARAMETER EnableException
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
.PARAMETER WhatIf
If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.
.PARAMETER Confirm
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
.NOTES
Tags: DisasterRecovery, Backup, Restore
Author: Stuart Moore (@napalmgram), stuart-moore.com
Website: https://dbatools.io
Copyright: (C) Chrissy LeMaire, clemaire@gmail.com
License: GNU GPL v3 https://opensource.org/licenses/GPL-3.0
.EXAMPLE
.EXAMPLE
Backup-DbaDatabase -SqlInstance Server1 -Database HR, Finance
This will perform a full database backup on the databases HR and Finance on SQL Server Instance Server1 to Server1's default backup directory.
.EXAMPLE
Backup-DbaDatabase -SqlInstance sql2016 -BackupDirectory C:\temp -Database AdventureWorks2014 -Type Full
Backs up AdventureWorks2014 to sql2016's C:\temp folder.
.EXAMPLE
Backup-DbaDatabase -SqlInstance sql2016 -AzureBaseUrl https://dbatoolsaz.blob.core.windows.net/azbackups/ -AzureCredential dbatoolscred -Type Full -CreateFolder
Performs a full backup of all databases on the sql2016 instance to their own containers under the https://dbatoolsaz.blob.core.windows.net/azbackups/ container on Azure blog storage using the sql credential "dbatoolscred" registered on the sql2016 instance.
#>
[CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)]
@@ -236,7 +236,7 @@ function Backup-DbaDatabase {
Write-Message -Level Verbose -Message "$dbname is in $($Database.RecoveryModel) recovery model"
}
# Fixes one-off cases of StackOverflowException crashes, see issue 1481
# Fixes one-off cases of StackOverflowException crashes, see issue 1481
$dbRecovery = $Database.RecoveryModel.ToString()
if ($dbRecovery -eq 'Simple' -and $Type -eq 'Log') {
$failreason = "$database is in simple recovery mode, cannot take log backup"
@@ -448,7 +448,7 @@ function Backup-DbaDatabase {
Write-Progress -id 1 -activity "Backing up database $dbname to $backupfile" -status "Complete" -Completed
$BackupComplete = $true
if ($server.VersionMajor -eq '8') {
$HeaderInfo = Get-BackupAncientHistory -SqlInstance $server -Database $dbname
$HeaderInfo = Get-BackupAncientHistory -SqlInstance $server -Database $dbname
}
else {
$HeaderInfo = Get-DbaBackupHistory -SqlInstance $server -Database $dbname -Last -IncludeCopyOnly | Sort-Object -Property End -Descending | Select-Object -First 1
@@ -475,7 +475,7 @@ function Backup-DbaDatabase {
LastLsn = $HeaderInfo.LastLsn
BackupSetId = $HeaderInfo.BackupSetId
LastRecoveryForkGUID = $HeaderInfo.LastRecoveryForkGUID
} | Restore-DbaDatabase -SqlInstance $server -SqlCredential $SqlCredential -DatabaseName DbaVerifyOnly -VerifyOnly -TrustDbBackupHistory -DestinationFilePrefix DbaVerifyOnly
} | Restore-DbaDatabase -SqlInstance $server -SqlCredential $SqlCredential -DatabaseName DbaVerifyOnly -VerifyOnly -TrustDbBackupHistory -DestinationFilePrefix DbaVerifyOnly
if ($verifiedResult[0] -eq "Verify successful") {
$failures += $verifiedResult[0]
$Verified = $true
Oops, something went wrong.

0 comments on commit 29d0cb0

Please sign in to comment.