Skip to content

Commit

Permalink
Merge pull request #614 from microsoft/main
Browse files Browse the repository at this point in the history
Release 6-29
  • Loading branch information
dpaulson45 authored Jun 29, 2021
2 parents 0f54181 + a32db81 commit 2189b40
Show file tree
Hide file tree
Showing 233 changed files with 989 additions and 253 deletions.
25 changes: 22 additions & 3 deletions .build/Build.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[CmdletBinding()]
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

[CmdletBinding()]
param (

)
Expand Down Expand Up @@ -68,7 +71,7 @@ if ($nonUnique.Count -gt 0) {

$scriptVersions = @()

$disclaimer = [IO.File]::ReadAllLines("$PSScriptRoot\disclaimer.txt")
$disclaimer = [IO.File]::ReadAllLines("$PSScriptRoot\..\LICENSE")

$scriptFiles | ForEach-Object {
$scriptName = [IO.Path]::GetFileName($_)
Expand All @@ -92,13 +95,29 @@ $scriptFiles | ForEach-Object {
}
}


#Remove common comments
$linesToRemove = @("# Copyright (c) Microsoft Corporation.", "# Licensed under the MIT License.")

foreach ($comment in $linesToRemove) {

while ($expandedScript.Contains($comment)) {
$expandedScript.RemoveAt($expandedScript.IndexOf($comment))
}
}

# Stamp version in comments
$expandedScript.Insert(0, "")
if (-not ([string]::IsNullOrWhiteSpace($expandedScript[0]))) {
$expandedScript.Insert(0, "")
}

$expandedScript.Insert(0, "# Version $buildVersionString")

# Add disclaimer
$expandedScript.Insert(0, "")
$expandedScript.Insert(0, "#>")
$expandedScript.InsertRange(0, $disclaimer)
$expandedScript.Insert(0, "<#")

Set-Content -Path (Join-Path $distFolder $scriptName) -Value $expandedScript -Encoding utf8BOM
$scriptVersions += [PSCustomObject]@{
Expand Down
5 changes: 4 additions & 1 deletion .build/BuildFunctions/Get-DotSourcedScriptName.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

<#
.SYNOPSIS
Returns the dot-sourced script path from this line of PowerShell
script, if any.
Expand Down
5 changes: 4 additions & 1 deletion .build/BuildFunctions/Get-EmbeddedFile.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
. $PSScriptRoot\Get-DotSourcedScriptName.ps1
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

. $PSScriptRoot\Get-DotSourcedScriptName.ps1
. $PSScriptRoot\Get-EmbeddedFileInfo.ps1

<#
Expand Down
5 changes: 4 additions & 1 deletion .build/BuildFunctions/Get-EmbeddedFileInfo.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

<#
.SYNOPSIS
Returns the embedded data file info from this line of PowerShell
script, including the file path and variable name it is assigned to.
Expand Down
5 changes: 4 additions & 1 deletion .build/BuildFunctions/Get-EmbeddedFileList.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
. $PSScriptRoot\Get-EmbeddedFile.ps1
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

. $PSScriptRoot\Get-EmbeddedFile.ps1

<#
.SYNOPSIS
Expand Down
5 changes: 4 additions & 1 deletion .build/BuildFunctions/Get-ExpandedScriptContent.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
. $PSScriptRoot\Get-DotSourcedScriptName.ps1
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

. $PSScriptRoot\Get-DotSourcedScriptName.ps1
. $PSScriptRoot\Get-EmbeddedFileInfo.ps1

<#
Expand Down
5 changes: 4 additions & 1 deletion .build/BuildFunctions/Get-ScriptProjectMostRecentCommit.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
. $PSScriptRoot\Get-EmbeddedFileList.ps1
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

. $PSScriptRoot\Get-EmbeddedFileList.ps1

<#
.SYNOPSIS
Expand Down
28 changes: 27 additions & 1 deletion .build/CodeFormatter.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[CmdletBinding()]
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

[CmdletBinding()]
param(
[Switch]
$Save
Expand Down Expand Up @@ -61,6 +64,29 @@ foreach ($file in $scriptFiles) {
}
}

#Check for compliance
$scriptContent = New-Object 'System.Collections.Generic.List[string]'
$scriptContent.AddRange([IO.File]::ReadAllLines($file))

if (-not ($scriptContent[0].Contains("# Copyright (c) Microsoft Corporation.")) -or
-not ($scriptContent[1].Contains("# Licensed under the MIT License."))) {

Write-Warning "File doesn't have header compliance set: $file"
if ($Save) {
try {
$scriptContent.Insert(0, "")
$scriptContent.Insert(0, "# Licensed under the MIT License.")
$scriptContent.Insert(0, "# Copyright (c) Microsoft Corporation.")
Set-Content -Path $file -Value $scriptContent -Encoding utf8BOM
} catch {
$filesFailed = $true
throw
}
} else {
$filesFailed = $true
}
}

$reloadFile = $false
$before = Get-Content $file -Raw
$after = Invoke-Formatter -ScriptDefinition $before -Settings $repoRoot\PSScriptAnalyzerSettings.psd1
Expand Down
5 changes: 4 additions & 1 deletion .build/Load-Module.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
function Load-Module {
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

function Load-Module {
[CmdletBinding()]
[OutputType([bool])]
param (
Expand Down
5 changes: 4 additions & 1 deletion .build/Pester.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
. $PSScriptRoot\Load-Module.ps1
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

. $PSScriptRoot\Load-Module.ps1

if (-not (Load-Module -Name Pester -MinimumVersion 5.2.0)) {
throw "Pester module could not be loaded"
Expand Down
15 changes: 0 additions & 15 deletions .build/disclaimer.txt

This file was deleted.

5 changes: 4 additions & 1 deletion Admin/Get-SimpleAuditLogReport.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

<#
.SYNOPSIS
Parses the output of Search-AdminAuditlog to produce more readable results.
Expand Down
5 changes: 4 additions & 1 deletion Databases/Analyze-SpaceDump.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# This script reports the space taken up by various tables based on a database space dump.
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

# This script reports the space taken up by various tables based on a database space dump.
# The space dump must be obtained while the database is dismounted, or on a suspended copy
# if the issue is happening there. To obtain the space dump, use the following syntax:
#
Expand Down
5 changes: 4 additions & 1 deletion Databases/Compare-MailboxStatistics.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# This script compares two sets of mailbox statistics from the same database and highlights mailbox growth
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

# This script compares two sets of mailbox statistics from the same database and highlights mailbox growth
# that occurred between the two snapshots.
#
# For a growing database, a typical approach would be to start by exporting the statistics for the database:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
function Invoke-CreateDiskShadowFile {
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

function Invoke-CreateDiskShadowFile {
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWMICmdlet', '', Justification = 'Required to get drives on old systems')]
param()

Expand Down
5 changes: 4 additions & 1 deletion Databases/VSSTester/DiskShadow/Invoke-DiskShadow.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
function Invoke-DiskShadow {
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

function Invoke-DiskShadow {
Write-Host " " $nl
Get-Date
Write-Host "Starting DiskShadow copy of Exchange database: $selDB" -ForegroundColor Green $nl
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
function Invoke-RemoveExposedDrives {
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

function Invoke-RemoveExposedDrives {

function Out-removeDHSFile {
param ([string]$fileline)
Expand Down
5 changes: 4 additions & 1 deletion Databases/VSSTester/ExchangeInformation/Get-CopyStatus.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
function Get-CopyStatus {
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

function Get-CopyStatus {
if ((($databases[$dbToBackup]).IsMailboxDatabase) -eq "True") {
Get-Date
Write-Host "Status of '$selDB' and its replicas (if any)" -ForegroundColor Green $nl
Expand Down
5 changes: 4 additions & 1 deletion Databases/VSSTester/ExchangeInformation/Get-Databases.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
function Get-Databases {
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

function Get-Databases {
Get-Date
Write-Host "Getting databases on server: $serverName" -ForegroundColor Green $nl
Write-Host "--------------------------------------------------------------------------------------------------------------"
Expand Down
5 changes: 4 additions & 1 deletion Databases/VSSTester/ExchangeInformation/Get-DbToBackup.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
function Get-DBtoBackup {
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

function Get-DBtoBackup {
$maxDbIndexRange = $script:databases.length - 1
$matchCondition = "^([0-9]|[1-9][0-9])$"
Write-Debug "matchCondition: $matchCondition"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
function Get-ExchangeVersion {
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

function Get-ExchangeVersion {
Get-Date
Write-Host "Verifying Exchange version..." -ForegroundColor Green $nl
Write-Host "--------------------------------------------------------------------------------------------------------------"
Expand Down
5 changes: 4 additions & 1 deletion Databases/VSSTester/Logging/Get-VSSWritersAfter.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
function Get-VSSWritersAfter {
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

function Get-VSSWritersAfter {
" "
Get-Date
Write-Host "Checking VSS Writer Status: (after backup)" -ForegroundColor Green $nl
Expand Down
5 changes: 4 additions & 1 deletion Databases/VSSTester/Logging/Get-VSSWritersBefore.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
function Get-VSSWritersBefore {
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

function Get-VSSWritersBefore {
" "
Get-Date
Write-Host "Checking VSS Writer Status: (All Writers must be in a Stable state before running this script)" -ForegroundColor Green $nl
Expand Down
5 changes: 4 additions & 1 deletion Databases/VSSTester/Logging/Get-WindowsEventLogs.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.


function Get-WindowsEventLogs {

Function Get-WindowEventsPerServer {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
function Invoke-CreateExTRATracingConfig {
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

function Invoke-CreateExTRATracingConfig {

function Out-ExTRAConfigFile {
param ([string]$fileline)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
function Invoke-DisableDiagnosticsLogging {
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

function Invoke-DisableDiagnosticsLogging {

Write-Host " " $nl
Get-Date
Expand Down
5 changes: 4 additions & 1 deletion Databases/VSSTester/Logging/Invoke-DisableExtraTracing.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
function Invoke-DisableExTRATracing {
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

function Invoke-DisableExTRATracing {
" "
Get-Date
Write-Host "Disabling ExTRA Tracing..." -ForegroundColor Green $nl
Expand Down
5 changes: 4 additions & 1 deletion Databases/VSSTester/Logging/Invoke-DisableVSSTracing.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
function Invoke-DisableVSSTracing {
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

function Invoke-DisableVSSTracing {
" "
Get-Date
Write-Host "Disabling VSS Tracing..." -ForegroundColor Green $nl
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
function Invoke-EnableDiagnosticsLogging {
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

function Invoke-EnableDiagnosticsLogging {
" "
Get-Date
Write-Host "Enabling Diagnostics Logging..." -ForegroundColor green $nl
Expand Down
5 changes: 4 additions & 1 deletion Databases/VSSTester/Logging/Invoke-EnableExtraTracing.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
function Invoke-EnableExTRATracing {
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

function Invoke-EnableExTRATracing {

Function Invoke-ExtraTracingCreate {
param(
Expand Down
5 changes: 4 additions & 1 deletion Databases/VSSTester/Logging/Invoke-EnableVSSTracing.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
function Invoke-EnableVSSTracing {
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

function Invoke-EnableVSSTracing {
" "
Get-Date
Write-Host "Enabling VSS Tracing..." -ForegroundColor Green $nl
Expand Down
5 changes: 4 additions & 1 deletion Databases/VSSTester/VSSTester.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#################################################################################
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

#################################################################################
# Purpose:
# This script will allow you to test VSS functionality on Exchange server using DiskShadow.
# The script will automatically detect active and passive database copies running on the server.
Expand Down
5 changes: 4 additions & 1 deletion Diagnostics/ExTRA/ExTRA.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
$tagFileBytes = Get-Content "$PSScriptRoot\tags2016.txt" -AsByteStream -Raw
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

$tagFileBytes = Get-Content "$PSScriptRoot\tags2016.txt" -AsByteStream -Raw

$htmlFileBytes = Get-Content "$PSScriptRoot\ui.html" -AsByteStream -Raw

Expand Down
5 changes: 4 additions & 1 deletion Diagnostics/ExchangeLogCollector/ExchangeLogCollector.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'All Parameters are used in other functions of the script')]
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'All Parameters are used in other functions of the script')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification = 'Value is used')]
[CmdletBinding()]
Param (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
Function Get-DAGInformation {
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

Function Get-DAGInformation {
param(
[Parameter(Mandatory = $true)][string]$DAGName
)
Expand Down
Loading

0 comments on commit 2189b40

Please sign in to comment.