AzStackHciExternalActiveDirectory/AzStackHci.ExternalActiveDirectory.Helpers.psm1

Import-LocalizedData -BindingVariable lcAdTxt -FileName AzStackHci.ExternalActiveDirectory.Strings.psd1

function Get-ParamFromCommandLineOrConfigFile {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory=$false)]
        [string]
        $ConfigurationJsonPath,

        [Parameter(Mandatory=$true)]
        [string]
        $ParameterName,

        [Parameter(Mandatory=$false)]
        [string]
        $CommandLineParameterValue,

        [Parameter(Mandatory=$true)]
        [string]
        $ParameterDescription,

        [Parameter(Mandatory=$true)]
        [string]
        $ValidationRegex
    )

    # If CommandLineParameterValue is set, then use it and the config file doesn't matter
    if ([string]::IsNullOrEmpty($CommandLineParameterValue))
    {
        # If the configuration file is present, check to see if the value exists under the DeploymentData object
        # If we can find it, we'll overwrite $CommandLineParameterValue (so we can check for that later to see if it worked)
        if (-not [string]::IsNullOrEmpty($ConfigurationJsonPath))
        {
            $configData = Get-Content -Path $ConfigurationJsonPath -ErrorAction SilentlyContinue | ConvertFrom-Json

            $deployData = $configData.ScaleUnits.DeploymentData | Select-Object -First 1

            if ($deployData)
            {
                if ($deployData.PSobject.Properties.name -eq $ParameterName)
                {
                    $CommandLineParameterValue = $deployData.PSobject.Properties.Item($ParameterName).Value
                }
            }
        }

        if ([string]::IsNullOrEmpty($ConfigurationJsonPath))
        {
            throw ($lcAdTxt.MissingRequiredParameter -f $ParameterName,$ParameterDescription)
        }
    }

    if (-not ($CommandLineParameterValue -match $ValidationRegex))
    {
        throw ($lcAdTxt.MalformedRequiredParameter -f $ParameterName,$CommandLineParameterValue,$ValidationRegex)
    }

    return $CommandLineParameterValue
}

function Get-ClusterNameFromCommandLineOrConfigFile {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory=$false)]
        [string]
        $ConfigurationJsonPath,

        [Parameter(Mandatory=$false)]
        [string]
        $CommandLineParameterValue,

        [Parameter(Mandatory=$true)]
        [string]
        $ParameterDescription,

        [Parameter(Mandatory=$true)]
        [string]
        $ValidationRegex
    )

    # If CommandLineParameterValue is set, then use it and the config file doesn't matter
    if ([string]::IsNullOrEmpty($CommandLineParameterValue))
    {
        # If the configuration file is present, check to see if the value exists under the DeploymentData object
        # If we can find it, we'll overwrite $CommandLineParameterValue (so we can check for that later to see if it worked)
        if (-not [string]::IsNullOrEmpty($ConfigurationJsonPath))
        {
            $configData = Get-Content -Path $ConfigurationJsonPath -ErrorAction SilentlyContinue | ConvertFrom-Json

            $deployData = $configData.ScaleUnits.DeploymentData | Select-Object -First 1

            if ($deployData)
            {
                $clusterEntry = $deployData.Cluster
                $CommandLineParameterValue = if ($clusterEntry) { $clusterEntry.Name } else { "" }
            }
        }

        if ([string]::IsNullOrEmpty($ConfigurationJsonPath))
        {
            throw ($lcAdTxt.MissingRequiredParameter -f "ClusterName",$ParameterDescription)
        }
    }

    if (-not ($CommandLineParameterValue -match $ValidationRegex))
    {
        throw ($lcAdTxt.MalformedRequiredParameter -f "ClusterName",$CommandLineParameterValue,$ValidationRegex)
    }

    return $CommandLineParameterValue
}

function Get-PhysicalHostNamesFromCommandLineOrConfigFile {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory=$false)]
        [string]
        $ConfigurationJsonPath,

        [Parameter(Mandatory=$false)]
        [array]
        $CommandLineParameterValue,

        [Parameter(Mandatory=$true)]
        [string]
        $ParameterDescription,

        [Parameter(Mandatory=$true)]
        [string]
        $ValidationRegex
    )

    try {
        # If the command line argument is specified, always use it
        if (-not $CommandLineParameterValue -or $CommandLineParameterValue.Length -eq 0)
        {
            # If the command line argument is not specified, check the unattend
            $configData = Get-Content -Path $ConfigurationJsonPath -ErrorAction SilentlyContinue | ConvertFrom-Json

            $deployData = $configData.ScaleUnits.DeploymentData | Select-Object -First 1

            if ($deployData)
            {
                $clusterEntry = $deployData.PhysicalNodesV2 | ForEach-Object {$_.Name}
                if ($clusterEntry -and $clusterEntry.Length -gt 0)
                {
                    # No command line argument, but we found it in unattend, so overwrite command line value
                    $CommandLineParameterValue = $clusterEntry
                }
            }
        }
    }
    catch {}

    if (-not $CommandLineParameterValue -or $CommandLineParameterValue.Length -eq 0)
    {
        throw ($lcAdTxt.MissingRequiredParameter -f "PhysicalMachineNames",$ParameterDescription)
    }

    $failedValidationRegexItems = $CommandLineParameterValue | Where-Object {$_ -notmatch $ValidationRegex}

    if ($failedValidationRegexItems -and $failedValidationRegexItems.Length -gt 0)
    {
        throw ($lcAdTxt.MalformedRequiredParameter -f "PhysicalMachineNames",$failedValidationRegexItems -join ", ",$ValidationRegex)
    }

    return $CommandLineParameterValue
}


function Install-GroupPolicyModule
{
    $modulePresent = $false

    try
    {
        $result = Get-Module -All | Where-Object { $_.Name -eq 'GroupPolicy' }
        if (-not $result)
        {
            # Module is not already imported. See if it's available.
            $result = Get-Module -Refresh -ListAvailable | Where-Object { $_.Name -eq 'GroupPolicy' }

            if ($result)
            {
                $result | Import-Module -WarningAction Ignore
                $modulePresent = $true
            }
        }
        else
        {
            $modulePresent = $true
        }
    }
    catch
    {
        # Module not present and not importable.
    }

    if (-not $modulePresent)
    {
        if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
        {
            throw $lcAdTxt.NotRunningElevated
        }

        try
        {
            $capability = $null

            try
            {
                # See if we're on Windows 10 Oct 2018 update or later where it's a windows capability
                $capability = Get-WindowsCapability -Online | Where-Object {$_.Name -like 'Rsat.GroupPolicy*'}
            }
            catch {}

            if ($capability)
            {
                # Yes, Windows 10 Oct 2018 or later. Check if it's present and add it if not
                if ($capability.State -ne 'Installed')
                {
                    ($capability | Add-WindowsCapability -Online)
                }
                else
                {
                    # The capability is present and installed, but the Get-Module above failed, so we should just bail
                    throw ($lcAdTxt.RsatCapabilityPresentButCantImport -f $capability.Name)
                }
            }
            else
            {
                # We're not on Windows 10 Oct 2018 or later. If we're on a server sku (or a client with RSAT installed), we
                # may be able to find the optional feature to install
                $optionalFeature = Get-WindowsOptionalFeature -Online | Where-Object {$_.FeatureName -eq 'Microsoft-Windows-GroupPolicy-ServerAdminTools-Update'}

                if ($optionalFeature)
                {
                    # Feature is known, so see if it's enabled or enable-able
                    if ($optionalFeature.State -eq 'Enabled')
                    {
                        # Feature is known, and enabled, but still the previous efforts didn't find the module. We should just bail.
                        throw ($lcAdTxt.RsatOptionalFeaturePresentButCantImport -f 'Microsoft-Windows-GroupPolicy-ServerAdminTools-Update')
                    }
                    else
                    {
                        # Feature is known, but not enabled
                        $result = ($optionalFeature | Enable-WindowsOptionalFeature -Online)
                    }
                }
                else
                {
                    # We cannot find the module from WindowsCapability or from WindowsOptionalFeature, and it wasn't in the available modules
                    # Not much we can do here except prompt the user to install RSAT
                    throw $lcAdTxt.MissingModuleAndRsat
                }
            }
        }
        catch
        {
            throw ($lcAdTxt.FailedToInstallRsat -f $_)
        }
    }

    if (-not $modulePresent)
    {
        # If we're here, it's because the module wasn't originally present, and our attempt at installing it seemed to be successful. Try to find it again
        try
        {
            $result = Get-Module -Refresh -ListAvailable | Where-Object { $_.Name -eq 'GroupPolicy' }
            if ($result)
            {
                # AD module warns about finding a default server, but we'll specify everything later
                $result | Import-Module -WarningAction Ignore
            }
            else
            {
                throw $lcAdTxt.ModuleStillMissingAfterRsatInstall
            }
        }
        catch
        {
            throw ($lcAdTxt.FailToLoadModuleAfterRsatInstall -f $_)
        }
    }
}

function Install-ActiveDirectoryModule
{
    $modulePresent = $false

    try
    {
        $result = Get-Module -All | Where-Object { $_.Name -eq 'ActiveDirectory' }
        if (-not $result)
        {
            # Module is not already imported. See if it's available.
            $result = Get-Module -Refresh -ListAvailable | Where-Object { $_.Name -eq 'ActiveDirectory' }

            if ($result)
            {
                # AD module warns about finding a default server, but we'll specify everything later
                $result | Import-Module -WarningAction Ignore
                $modulePresent = $true
            }
        }
        else
        {
            $modulePresent = $true
        }
    }
    catch
    {
        # Module not present and not importable.
    }

    if (-not $modulePresent)
    {
        if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
        {
            throw $lcAdTxt.NotRunningElevated
        }

        $windowsFeature = $null

        # See if we're on a server version that installs AD Powershell with Add-WindowsFeature
        try {
            $windowsFeature = Get-WindowsFeature -Name "RSAT-AD-PowerShell"
        }
        catch {
        }

        if ($windowsFeature -and $windowsFeature.InstallState -ne [Microsoft.Windows.ServerManager.Commands.InstallState]::Installed)
        {
            Add-WindowsFeature -Name "RSAT-AD-PowerShell" -IncludeAllSubFeature
        }

        $result = Get-Module -Refresh -ListAvailable | Where-Object { $_.Name -eq 'ActiveDirectory' }

        $modulePresent = ($null -ne $result)
    }

    if (-not $modulePresent)
    {
        try
        {
            $capability = $null

            try
            {
                # See if we're on Windows 10 Oct 2018 update or later where it's a windows capability
                $capability = Get-WindowsCapability -Online | Where-Object {$_.Name -like 'Rsat.ActiveDirectory*'}
            }
            catch {}

            if ($capability)
            {
                # Yes, Windows 10 Oct 2018 or later. Check if it's present and add it if not
                if ($capability.State -ne 'Installed')
                {
                    ($capability | Add-WindowsCapability -Online)
                }
                else
                {
                    # The capability is present and installed, but the Get-Module above failed, so we should just bail
                    throw ($lcAdTxt.RsatCapabilityPresentButCantImport -f $capability.Name)
                }
            }
            else
            {
                # We're not on Windows 10 Oct 2018 or later. If we're on a server sku (or a client with RSAT installed), we
                # may be able to find the optional feature to install
                $optionalFeature = Get-WindowsOptionalFeature -Online | Where-Object {$_.FeatureName -eq 'RSAT-ADDS-Tools-Feature'}

                if ($optionalFeature)
                {
                    # Feature is known, so see if it's enabled or enable-able
                    if ($optionalFeature.State -eq 'Enabled')
                    {
                        # Feature is known, and enabled, but still the previous efforts didn't find the module. We should just bail.
                        throw ($lcAdTxt.RsatOptionalFeaturePresentButCantImport -f 'RSAT-ADDS-Tools-Feature')
                    }
                    else
                    {
                        # Feature is known, but not enabled
                        $result = ($optionalFeature | Enable-WindowsOptionalFeature -Online)
                    }
                }
                else
                {
                    # We cannot find the module from WindowsCapability or from WindowsOptionalFeature, and it wasn't in the available modules
                    # Not much we can do here except prompt the user to install RSAT
                    throw $lcAdTxt.MissingModuleAndRsat
                }
            }
        }
        catch
        {
            throw ($lcAdTxt.FailedToInstallRsat -f $_)
        }
    }

    if (-not $modulePresent)
    {
        # If we're here, it's because the module wasn't originally present, and our attempt at installing it seemed to be successful. Try to find it again
        try
        {
            $result = Get-Module -Refresh -ListAvailable | Where-Object { $_.Name -eq 'ActiveDirectory' }
            if ($result)
            {
                # AD module warns about finding a default server, but we'll specify everything later
                $result | Import-Module -WarningAction Ignore
            }
            else
            {
                throw $lcAdTxt.ModuleStillMissingAfterRsatInstall
            }
        }
        catch
        {
            throw ($lcAdTxt.FailToLoadModuleAfterRsatInstall -f $_)
        }
    }

    # Sometimes we seem to import the module, but don't get the PS provider as well. Should be safe to just import again here to see
    if (-not (Get-PSProvider -PSProvider ActiveDirectory -ErrorAction SilentlyContinue))
    {
        Import-Module 'ActiveDirectory' -Force
    }
    if (-not (Get-PSProvider -PSProvider ActiveDirectory -ErrorAction SilentlyContinue))
    {
        throw ("Can't find ActiveDirectory PSProvider!")
    }
}
# SIG # Begin signature block
# MIInpAYJKoZIhvcNAQcCoIInlTCCJ5ECAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCBEKnzkisn2Tg4q
# HD9TaBvG08+zK3iazEUgm4LusZASL6CCDYUwggYDMIID66ADAgECAhMzAAADTU6R
# phoosHiPAAAAAANNMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD
# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy
# b3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jvc29m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