Skip to content
Permalink
Browse files

Merge branch 'prerelease' into pr/5686

  • Loading branch information...
potatoqualitee committed Jun 7, 2019
2 parents 1ec92d9 + f02ed8f commit 4c4df7240740f5581c71e6265e14bbfc89bf43fb
Showing 1,100 changed files with 388,000 additions and 6,637 deletions.
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<!-- Change #1: Register the new SqlAuthenticationProvider configuration section -->
<section name="SqlAuthenticationProviders" type="System.Data.SqlClient.SqlAuthenticationProviderConfigurationSection, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<!-- Change #3: Add the new SqlAuthenticationProvider configuration section, registering the built-in authentication provider in AppAuth library -->
<SqlAuthenticationProviders>
<providers>
<add name="Active Directory Interactive" type="Microsoft.Azure.Services.AppAuthentication.SqlAppAuthenticationProvider, Microsoft.Azure.Services.AppAuthentication" />
</providers>
</SqlAuthenticationProviders>
</configuration>

Some generated files are not rendered by default. Learn more.

@@ -34,32 +34,22 @@ Mostly for developers working on the library.
#>

#region Test whether the module had already been imported
if (([System.Management.Automation.PSTypeName]'Sqlcollaborative.Dbatools.Configuration.Config').Type) {
# No need to load the library again, if the module was once already imported.
Write-Verbose -Message "Library already loaded, will not load again"
$ImportLibrary = $false
} else {
Write-Verbose -Message "Library not present already, will import"
$ImportLibrary = $true
}
#endregion Test whether the module had already been imported

$libraryBase = (Resolve-Path -Path ($ExecutionContext.SessionState.Module.ModuleBase + "\bin"))

$dll =
if ($PSVersionTable.PSVersion.Major -ge 6) {
$dll = (Resolve-Path -Path "$libraryBase\netcoreapp2.1\dbatools.dll" -ErrorAction Ignore).ProviderPath
Join-Path $psModuleRoot "bin\netcoreapp2.1\dbatools.dll"
} else {
$dll = (Resolve-Path -Path "$libraryBase\net452\dbatools.dll" -ErrorAction Ignore).ProviderPath
Join-Path $psModuleRoot "bin\net452\dbatools.dll"
}

$ImportLibrary = $true # Always import the library, because it contains some internal cmdlets.

if ($ImportLibrary) {
#region Add Code
try {
# In strict security mode, only load from the already pre-compiled binary within the module
if ($script:strictSecurityMode) {
if (Test-Path -Path $dll) {
Add-Type -Path $dll -ErrorAction Stop
$dbaToolsAssembly = Import-Module "$dll"
} else {
throw "Library not found, terminating"
}
@@ -86,11 +76,11 @@ if ($ImportLibrary) {

try {
Write-Verbose -Message "Found library, trying to copy & import"
Add-Type -Path (Resolve-Path -Path "$dll") -ErrorAction Stop
$dbaToolsAssembly = Import-Module -Name "$dll"
} catch {
Write-Verbose -Message "Failed to copy and import, attempting to import straight from the module directory"
$script:DllRoot = Resolve-Path -Path $script:DllRoot
Add-Type -Path "$(Join-Path -Path $script:DllRoot -ChildPath dbatools.dll)" -ErrorAction Stop
Import-Module -Name "$(Join-Path -Path $script:DllRoot -ChildPath dbatools.dll)" -ErrorAction Stop
}
Write-Verbose -Message "Total duration: $((Get-Date) - $start)"
} elseif ($hasProject) {
@@ -101,8 +91,8 @@ if ($ImportLibrary) {
}

#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
#Update-TypeData -TypeName "Sqlcollaborative.Dbatools.dbaSystem.DbatoolsException" -SerializationDepth 2 -ErrorAction Ignore
#Update-TypeData -TypeName "Sqlcollaborative.Dbatools.dbaSystem.DbatoolsExceptionRecord" -SerializationDepth 2 -ErrorAction Ignore
#endregion PowerShell TypeData
} catch {
#region Warning
@@ -140,7 +130,15 @@ aka "The guy who made most of The Library that Failed to import"
}

#region Version Warning
if ($currentLibraryVersion -ne ([version](([AppDomain]::CurrentDomain.GetAssemblies() | Where-Object ManifestModule -like "dbatools.dll").CustomAttributes | Where-Object AttributeType -like "System.Reflection.AssemblyFileVersionAttribute").ConstructorArguments.Value)) {

$dbaToolsVersion =
@(foreach ($_ in $dbaToolsAssembly.CustomAttributes) {
if ($_ -is [Reflection.AssemblyFileVersionAttribute]) {
$_.ConstructorArguments.Value
break
}
}) -ne $null -as [Version]
if ($currentLibraryVersion -ne $dbaToolsVersion) {
Write-Verbose @"
A version missmatch between the dbatools library loaded and the one expected by
this module. This usually happens when you update the dbatools module and use
BIN +0 Bytes (100%) bin/net452/dbatools.dll
Binary file not shown.
BIN +0 Bytes (100%) bin/net452/dbatools.pdb
Binary file not shown.

Some generated files are not rendered by default. Learn more.

@@ -782,7 +782,7 @@
"Microsoft.Management.Infrastructure/1.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-EhQ4sbjNu4rL39YVhRSKMzCaMNBSwSJi17t8LtAOW94WQTkhQCEhlMukFU2AtWOBW3zGIrvg85XRS+w0nuGxKw==",
"sha512": "sha512-op0A4si0j0nB06sY1dkyu5UdQYIcHTHfWbvWlJFzN/UZgQqA52o85G9Hs9XJiBkT20Jy9Kj66dTaNbmjiuxykQ==",
"path": "microsoft.management.infrastructure/1.0.0",
"hashPath": "microsoft.management.infrastructure.1.0.0.nupkg.sha512"
},
@@ -838,7 +838,7 @@
"System.Data.SqlClient/4.5.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-cTPUCClr34EGBnyazUeciMD6sNm9aiE/li3uGvJ7z5dGup9QxKwysUeKXIrCO0E5KtQQAzGORFEYmowyEpcL2A==",
"sha512": "sha512-qXTvTFkBds7bnN+ntBMHGvmH3pCAkfT4TE1z2Xvfqo4wKMQC77O4aXsYCc7dzCESC+/Gom6l0GLuebpFx7MDvg==",
"path": "system.data.sqlclient/4.5.1",
"hashPath": "system.data.sqlclient.4.5.1.nupkg.sha512"
},
BIN +512 Bytes (100%) bin/netcoreapp2.1/dbatools.dll
Binary file not shown.
BIN +0 Bytes (100%) bin/netcoreapp2.1/dbatools.pdb
Binary file not shown.

Some generated files are not rendered by default. Learn more.

@@ -123,6 +123,14 @@ public class SetDbatoolsConfigCommand : PSCmdlet
[Parameter()]
public SwitchParameter PassThru;

/// <summary>
/// Registers the configuration setting into the user scope.
/// As if running Register-PSFConfig.
/// Only applies when updating an existing setting.
/// </summary>
[Parameter()]
public SwitchParameter Register;

/// <summary>
/// Enable throwing exceptions.
/// </summary>
@@ -415,6 +423,15 @@ private void ApplyValue(object Value)
#endregion Handler

_Config.Value = tempValue;

if (Register.ToBool())
{
ScriptBlock registerCodeblock = ScriptBlock.Create(@"
param ($Config)
$Config | Register-DbatoolsConfig
");
registerCodeblock.Invoke(_Config);
}
}

/// <summary>
@@ -13,6 +13,11 @@ public enum DbaInstanceDiscoveryType
/// </summary>
IPRange = 1,

/// <summary>
/// We shall search for SQL SPNs in active directory
/// </summary>
DomainSPN = 2,

/// <summary>
/// We shall search for SQL SPNs in active directory
/// </summary>
@@ -23,9 +28,14 @@ public enum DbaInstanceDiscoveryType
/// </summary>
DataSourceEnumeration = 4,

/// <summary>
/// We shall search all enabled Windows Server Objects in active directory
/// </summary>
DomainServer = 8,

/// <summary>
/// We shall use all tools in our control to find stuff
/// </summary>
All = 7
All = 15
}
}
BIN +1.83 MB bin/smo/Bogus.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 4c4df72

Please sign in to comment.
You can’t perform that action at this time.