PowerShell - Bis an die Zähne

Einfach den unteren Kasten kopieren und lachen. Kann auch ins Profil integriert werden.

$global:dash_line = "──────────────────────────────────────────────────────────────────"

function global:Prompt {

    $unc = (gwmi Win32_LogicalDisk -filter "DeviceID = '$((Get-Location).Drive.Name):'").ProviderName

    If ($Host.Name -like "*ISE*")
        {
        $windowtitle_host = "ISE"
        }
    else
        {
        $windowtitle_host = "PS"
        }

    $currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
    if ($currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
        {
        $window_elevation = "#"
        }
    else
        {
        $window_elevation = "$"
        }

    write-host $dash_line

    # brackets
    write-host "[" -nonewline -foregroundcolor white

    # Print the current time:
    write-host (Get-Date -format u) -nonewline -foregroundcolor green

    # brackets
    write-host ("] - [") -nonewline -foregroundcolor white

    # Print the working directory:
    write-host $PWD -nonewline -foregroundcolor Red
    write-host "|" -nonewline -foregroundcolor white
    write-host $unc -NoNewline -ForegroundColor Red
    write-host "|" -nonewline -foregroundcolor white

    # Print the number of objects inside the current directory:
    write-host (Get-Childitem $PWD -Force).Length -nonewline -foregroundcolor Red

    write-host "]" -foregroundcolor white

    # Print the prompt symbol:
    write-host (" $window_elevation") -nonewline -foregroundcolor white

    # Check for Principal and Set Window Title

    $Host.UI.RawUI.WindowTitle = $windowtitle_host + " " + $window_elevation + " - " + $env:USERNAME + "@" + $env:COMPUTERNAME + " - " + $PWD
    return " ";
    }

function logexec
    {
    param (
        $command
        )
    Invoke-Expression $command | foreach {
        $timestamp = (get-date -Format "yyyy-MM-dd__HH_mm_ss")
        $output = $_
        write-host "$timestamp - $output"
        }
    }

function logping
    {
    param (
        $address
        )

    $filedate = (get-date -Format "yyyy-MM-dd__HH_mm_ss")
    $filename = "$filedate - $address.csv"

    Write-Host "Starting Log: $filename"
    Write-Output """Date"",""Time"",""Response""" | Out-File $filename -Append

    $command = "ping -t -w 1000 $address"

    Invoke-Expression $command | foreach {
        $date = (get-date -Format "yyyy-MM-dd")
        $timestamp = (get-date -Format "HH:mm:ss")
        $output = $_

        if (Select-String -InputObject $_ "TTL=")
            {
            $splitoutput = $output.split(" ")

            foreach ($block in $splitoutput)
                {
                if (Select-String -InputObject $block "ms")
                    {
                    $block_split = $block.split("=")
                    foreach ($block_element in $block_split)
                        {
                        if (Select-String -InputObject $block_element "ms")
                            {
                            if (Select-String -InputObject $block_element "<")
                                {                               
                                $miliseconds = $block_element.replace("ms","").split("<")[1]
                                }
                            else
                                {
                                $miliseconds = $block_element.replace("ms","")
                                }
                            Write-Host "Logging - Date: $date - Timestamp: $timestamp - Miliseconds: $miliseconds"
                            Write-Output """$date"",""$timestamp"",""$miliseconds""" | Out-File $filename -Append

                            }
                        }
                    }
                }

            }
        else
            {
            if ($_ -ne "" -and (-not (Select-String -InputObject $_ ":")))
                {
                Write-Host "Logging - Date: $date - Timestamp: $timestamp - Miliseconds: -1"
                Write-Output """$date"",""$timestamp"",""-1""" | Out-File $filename -Append
                }
            }
        }
    }

function passgen
    {
    $passw = ""
    $rand_chars = 33,35,36,37,38,40,41,43,45,46,47
    48..57 | foreach {$rand_chars += $_}
    65..90 | foreach {$rand_chars += $_}
    97..122 | foreach {$rand_chars += $_}

    1..50 | foreach {
    $this_char_index = ($rand_chars | Get-Random)

    $this_char = [char]$this_char_index
    $passw += $this_char
        }
    return $passw
    }

function global:Set-Title
    {
    param(
    [parameter(Mandatory=$false, ParameterSetName="title",Position=0)]$title
     )
    $Host.UI.RawUI.WindowTitle = $title
    }

function global:Check-Host
    {
    param
        (
        [Parameter(Mandatory=$true, ParameterSetName="hostname", Position=0)]$hostname,
        [Parameter(Mandatory=$false, ParameterSetName="port", Position=1)]$port
        )

    $this_ping_result = (Test-NetConnection -ComputerName $hostname)

    if ($port -ne $null)
        {
        $this_tcp_result = (Test-NetConnection -ComputerName $hostname -Port $port)
        }
    else
        {
        $port = "---"
        }

    write-host "Host: $hostname Ping: " -NoNewline

    if ($this_ping_result.PingSucceeded -eq $true)
        {
        Write-Host "UP   " -NoNewline -ForegroundColor Green
        }
    else
        {
        Write-Host "DOWN " -NoNewline -ForegroundColor Red
        }

    Write-Host "Lookup: " -NoNewline

    if ($this_ping_result.NameResolutionSucceeded -eq $true)
        {
        Write-Host "UP   " -NoNewline -ForegroundColor Green
        }
    else
        {
        Write-Host "DOWN " -NoNewline -ForegroundColor Red
        }

    if ($port -ne "---")
        {
        Write-Host "TCP port $port : " -NoNewline

        if ($this_tcp_result.TcpTestSucceeded -eq $true)
            {
            Write-Host "UP   " -ForegroundColor Green
            }
        else
            {
            Write-Host "DOWN " -ForegroundColor Red
            }
        }
    else
        {
        Write-Host "TCP not checked."
        }
    }

function global:Find-File
    {
     param(
            [parameter(Mandatory=$true, ParameterSetName="filter",Position=0)]$filter
            )
     (Get-ChildItem -Filter $filter -Force -Recurse -ErrorAction SilentlyContinue -Attributes ReadOnly,Hidden,System,Directory,Archive,Device,Normal,Temporary,SparseFile,ReparsePoint,Compressed,Offline,NotContentIndexed,Encrypted,IntegrityStream,NoScrubData | Select-Object Fullname).Fullname
    }

function global:Get-FileLinks
    {
    get-childitem | ?{$_.LinkType} | select FullName,LinkType,Target
    }

function global:Display-ADObjects
    {
    [CmdletBinding()]
    param(
        [parameter(ValueFromPipeline)]$pipeobjects,
        [parameter(Mandatory=$false, ParameterSetName="adobjects",Position=0)]$adobjects

        )
        # Write-Host "DEBUG: $pipeobjects"
        if ($pipeobjects -eq $null -and $adobjects -eq $null)
            {
            Write-Error "No value given"
            return
            }
        if (($pipeobjects) -and ($adobjects))
            {
            Write-Error "Got value from pipe and as parameter. Please pick one of them."
            return
            }
        if ($pipeobjects)
            {
            # Write-Host "DEBUG: Using pipe."
            $adobjects = $pipeobjects
            }

            foreach ($adobject in $adobjects)
                {
                Write-Host "########## OBJECT - ObjectClass:" $adobject.ObjectClass
                $adobject | select $propertylist | Format-List
                Write-Host "Memberships:"
                Write-Host ""
                foreach ($membership in $adobject.memberof)
                    {
                    ($membership | Get-ADGroup).name
                    }
                Write-Host ""
                }
    }

function global:Find-ADName
    {
    param(
        [parameter(Mandatory=$true, ParameterSetName="searchstring",Position=0)]$searchstring
        )
    $foundobjects = Get-ADObject -LDAPFilter "(|(name=$searchstring)(samaccountname=$searchstring))" -properties *
    if ($foundobjects)
        {
        Display-ADObjects $foundobjects
        }
    else
        {
        Write-Host "Nothing was found."
        }
    }

function global:Find-ADLDAP
    {
    param(
        [parameter(Mandatory=$true, ParameterSetName="searchstring",Position=0)]$searchstring
        )
    $foundobjects = Get-ADObject -LDAPFilter "$searchstring" -properties *
    if ($foundobjects)
        {
        Display-ADObjects $foundobjects
        }
    else
        {
        Write-Host "Nothing was found."
        }
    }

function global:Rename-AllToDate
    {
    param(
        [parameter(Mandatory=$false)][switch]$recurse,
        [parameter(Mandatory=$false)][switch]$folders
        )

    if ($recurse.IsPresent -eq $false -and $folders.IsPresent -eq $false)
        {
        Write-Host "Files, no recurse."
        $filelist = (Get-ChildItem -File)
        }
    elseif ($recurse.IsPresent -ne $false -and $folders.IsPresent -eq $false)
        {
        Write-Host "Files, recurse."
        $filelist = (Get-ChildItem -File -Recurse)
        }
    elseif ($recurse.IsPresent -eq $false -and $folders.IsPresent -ne $false)
        {
        Write-Host "Folders, no recurse."
        $filelist = (Get-ChildItem -Directory)
        }
    elseif ($recurse.IsPresent -ne $false -and $folders.IsPresent -ne $false)
        {
        Write-Host "ERROR: Renaming Folders in Folders not possible."
        return
        }

    $filecount = $filelist.Count
    $filenumber=0

    foreach ($file in $filelist)
        {
        $fyear = "{0:d4}" -f $file.LastWriteTime.Year
        $fmonth = "{0:d2}" -f $file.LastWriteTime.Month
        $fday = "{0:d2}" -f $file.LastWriteTime.Day
        $fhour = "{0:d2}" -f $file.LastWriteTime.Hour
        $fmin = "{0:d2}" -f $file.LastWriteTime.Minute
        $fsec = "{0:d2}" -f $file.LastWriteTime.Second

        if ($folders.IsPresent -ne $false)
            {
            $this_path = ($file.Parent | select fullname).fullname
            }
        else
            {
            $this_path = $file.Directoryname
            }

        $oldname = $file.Name
        $newname = $fyear + "-" + $fmonth + "-" + $fday + "__" + $fhour + "_" + $fmin + "_" + $fsec + $file.Extension

        $newfullname = $this_path + "\" + $newname

        $status = "[" + $filenumber + " / " + $filecount + "] - " + $newname + " <- " + $oldname
        $percentcomplete = ( ($filenumber / $filecount ) * 100 )

        $filenumber++

        # "This Path: " + $this_path
        # "Oldname: " + $oldname
        # "Newname:" + $newname
        # "Fullname: " + $file.Fullname
        # "NewFullname: " + $newfullname

        if ($oldname -eq $newname)
            {
            $status = "[" + $filenumber + " / " + $filecount + "] - SKIPPED (already done) - " + $newname + " <- " + $oldname
            Write-Progress -Activity "Renaming..." -Status $status -PercentComplete $percentcomplete
            # Write-Host "Skipped $oldname"
            }
        else
            {
            if (Test-Path -Path $newfullname)
                {
                # $status = "[" + $filenumber + " / " + $filecount + "] - Finding suffix - " + $newname + " <- " + $oldname
                # "--- Finding Suffix."
                # Write-Progress -Activity "Renaming..." -Status $status -PercentComplete $percentcomplete
                for (($suffix = 1), ($found = $false); $found -eq $false; $suffix++ )
                    {
                    $testname = $fyear + "-" + $fmonth + "-" + $fday + "__" + $fhour + "_" + $fmin + "_" + $fsec + "_" + $suffix + $file.Extension
                    $testfullname = $this_path + "\" + $testname

                    if (Test-Path -Path $testfullname)
                        {
                        # file exists. skip name.
                        }
                    else
                        {
                        $found = $true
                        $newfullname = $testfullname
                        # $status = "[" + $filenumber + " / " + $filecount + "] - Found Suffix - " + $testname + " <- " + $oldname
                        # "--- Found Name: " + $newfullname
                        # Write-Progress -Activity "Renaming..." -Status $status -PercentComplete $percentcomplete
                        }
                    }
                }
            Write-Progress -Activity "Renaming..." -Status $status -PercentComplete $percentcomplete
            Rename-Item -Path $file.Fullname -NewName $newfullname
            }

        }
   

    }

# ----------------------------------------------------------------
$ascii_char_a_1 = '░█████╗░░'
$ascii_char_a_2 = '██╔══██╗░'
$ascii_char_a_3 = '███████║░'
$ascii_char_a_4 = '██╔══██║░'
$ascii_char_a_5 = '██║░░██║░'
$ascii_char_a_6 = '╚═╝░░╚═╝░'
$ascii_char_a_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_b_1 = '██████╗░░'
$ascii_char_b_2 = '██╔══██╗░'
$ascii_char_b_3 = '██████╔╝░'
$ascii_char_b_4 = '██╔══██╗░'
$ascii_char_b_5 = '██████╔╝░'
$ascii_char_b_6 = '╚═════╝░░'
$ascii_char_b_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_c_1 = '░██████╗░'
$ascii_char_c_2 = '██╔════╝░'
$ascii_char_c_3 = '██║░░░░░░'
$ascii_char_c_4 = '██║░░░░░░'
$ascii_char_c_5 = '╚██████╗░'
$ascii_char_c_6 = '░╚═════╝░'
$ascii_char_c_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_d_1 = '██████╗░░'
$ascii_char_d_2 = '██╔══██╗░'
$ascii_char_d_3 = '██║░░██║░'
$ascii_char_d_4 = '██║░░██║░'
$ascii_char_d_5 = '██████╔╝░'
$ascii_char_d_6 = '╚═════╝░░'
$ascii_char_d_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_e_1 = '███████╗░'
$ascii_char_e_2 = '██╔════╝░'
$ascii_char_e_3 = '█████╗░░░'
$ascii_char_e_4 = '██╔══╝░░░'
$ascii_char_e_5 = '███████╗░'
$ascii_char_e_6 = '╚══════╝░'
$ascii_char_e_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_f_1 = '███████╗░'
$ascii_char_f_2 = '██╔════╝░'
$ascii_char_f_3 = '█████╗░░░'
$ascii_char_f_4 = '██╔══╝░░░'
$ascii_char_f_5 = '██║░░░░░░'
$ascii_char_f_6 = '╚═╝░░░░░░'
$ascii_char_f_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_g_1 = '░██████╗░░'
$ascii_char_g_2 = '██╔════╝░░'
$ascii_char_g_3 = '██║░░███╗░'
$ascii_char_g_4 = '██║░░░██║░'
$ascii_char_g_5 = '╚██████╔╝░'
$ascii_char_g_6 = '░╚═════╝░░'
$ascii_char_g_width = '░░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_h_1 = '██╗░░██╗░░'
$ascii_char_h_2 = '██║░░██║░░'
$ascii_char_h_3 = '███████║░░'
$ascii_char_h_4 = '██╔══██║░░'
$ascii_char_h_5 = '██║░░██║░░'
$ascii_char_h_6 = '╚═╝░░╚═╝░░'
$ascii_char_h_width = '░░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_i_1 = '██╗░'
$ascii_char_i_2 = '██║░'
$ascii_char_i_3 = '██║░'
$ascii_char_i_4 = '██║░'
$ascii_char_i_5 = '██║░'
$ascii_char_i_6 = '╚═╝░'
$ascii_char_i_width = '░░░░'
# ----------------------------------------------------------------
$ascii_char_j_1 = '░░░░░██╗░'
$ascii_char_j_2 = '░░░░░██║░'
$ascii_char_j_3 = '░░░░░██║░'
$ascii_char_j_4 = '██░░░██║░'
$ascii_char_j_5 = '╚█████╔╝░'
$ascii_char_j_6 = '░╚════╝░░'
$ascii_char_j_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_k_1 = '██╗░░██╗░'
$ascii_char_k_2 = '██║░██╔╝░'
$ascii_char_k_3 = '█████╔╝░░'
$ascii_char_k_4 = '██╔═██╗░░'
$ascii_char_k_5 = '██║░░██╗░'
$ascii_char_k_6 = '╚═╝░░╚═╝░'
$ascii_char_k_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_l_1 = '██╗░░░░░░'
$ascii_char_l_2 = '██║░░░░░░'
$ascii_char_l_3 = '██║░░░░░░'
$ascii_char_l_4 = '██║░░░░░░'
$ascii_char_l_5 = '███████╗░'
$ascii_char_l_6 = '╚══════╝░'
$ascii_char_l_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_m_1 = '███╗░░░███╗░'
$ascii_char_m_2 = '████╗░████║░'
$ascii_char_m_3 = '██╔████╔██║░'
$ascii_char_m_4 = '██║╚██╔╝██║░'
$ascii_char_m_5 = '██║░╚═╝░██║░'
$ascii_char_m_6 = '╚═╝░░░░░╚═╝░'
$ascii_char_m_width = '░░░░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_n_1 = '███╗░░░██╗░'
$ascii_char_n_2 = '████╗░░██║░'
$ascii_char_n_3 = '██╔██╗░██║░'
$ascii_char_n_4 = '██║╚██╗██║░'
$ascii_char_n_5 = '██║░╚████║░'
$ascii_char_n_6 = '╚═╝░░╚═══╝░'
$ascii_char_n_width = '░░░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_o_1 = '░██████╗░░'
$ascii_char_o_2 = '██╔═══██╗░'
$ascii_char_o_3 = '██║░░░██║░'
$ascii_char_o_4 = '██║░░░██║░'
$ascii_char_o_5 = '╚██████╔╝░'
$ascii_char_o_6 = '░╚═════╝░░'
$ascii_char_o_width = '░░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_p_1 = '██████╗░░'
$ascii_char_p_2 = '██╔══██╗░'
$ascii_char_p_3 = '██████╔╝░'
$ascii_char_p_4 = '██╔═══╝░░'
$ascii_char_p_5 = '██║░░░░░░'
$ascii_char_p_6 = '╚═╝░░░░░░'
$ascii_char_p_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_q_1 = '░██████╗░░'
$ascii_char_q_2 = '██╔═══██╗░'
$ascii_char_q_3 = '██║░░░██║░'
$ascii_char_q_4 = '██║▄▄░██║░'
$ascii_char_q_5 = '╚██████╔╝░'
$ascii_char_q_6 = '░╚══▀▀═╝░░'
$ascii_char_q_width = '░░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_r_1 = '██████╗░░'
$ascii_char_r_2 = '██╔══██╗░'
$ascii_char_r_3 = '██████╔╝░'
$ascii_char_r_4 = '██╔══██╗░'
$ascii_char_r_5 = '██║░░██║░'
$ascii_char_r_6 = '╚═╝░░╚═╝░'
$ascii_char_r_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_s_1 = '███████╗░'
$ascii_char_s_2 = '██╔════╝░'
$ascii_char_s_3 = '███████╗░'
$ascii_char_s_4 = '╚════██║░'
$ascii_char_s_5 = '███████║░'
$ascii_char_s_6 = '╚══════╝░'
$ascii_char_s_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_t_1 = '████████╗░'
$ascii_char_t_2 = '╚══██╔══╝░'
$ascii_char_t_3 = '░░░██║░░░░'
$ascii_char_t_4 = '░░░██║░░░░'
$ascii_char_t_5 = '░░░██║░░░░'
$ascii_char_t_6 = '░░░╚═╝░░░░'
$ascii_char_t_width = '░░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_u_1 = '██╗░░░██╗░'
$ascii_char_u_2 = '██║░░░██║░'
$ascii_char_u_3 = '██║░░░██║░'
$ascii_char_u_4 = '██║░░░██║░'
$ascii_char_u_5 = '╚██████╔╝░'
$ascii_char_u_6 = '░╚═════╝░░'
$ascii_char_u_width = '░░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_v_1 = '██╗░░░██╗░'
$ascii_char_v_2 = '██║░░░██║░'
$ascii_char_v_3 = '██║░░░██║░'
$ascii_char_v_4 = '╚██╗░██╔╝░'
$ascii_char_v_5 = '░╚████╔╝░░'
$ascii_char_v_6 = '░░╚═══╝░░░'
$ascii_char_v_width = '░░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_w_1 = '██╗░░░░██╗░'
$ascii_char_w_2 = '██║░░░░██║░'
$ascii_char_w_3 = '██║░█╗░██║░'
$ascii_char_w_4 = '██║███╗██║░'
$ascii_char_w_5 = '╚███╔███╔╝░'
$ascii_char_w_6 = '░╚══╝╚══╝░░'
$ascii_char_w_width = '░░░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_x_1 = '██╗░░██╗░'
$ascii_char_x_2 = '╚██╗██╔╝░'
$ascii_char_x_3 = '░╚███╔╝░░'
$ascii_char_x_4 = '░██╔██╗░░'
$ascii_char_x_5 = '██╔╝░██╗░'
$ascii_char_x_6 = '╚═╝░░╚═╝░'
$ascii_char_x_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_y_1 = '██╗░░░██╗░'
$ascii_char_y_2 = '╚██╗░██╔╝░'
$ascii_char_y_3 = '░╚████╔╝░░'
$ascii_char_y_4 = '░░╚██╔╝░░░'
$ascii_char_y_5 = '░░░██║░░░░'
$ascii_char_y_6 = '░░░╚═╝░░░░'
$ascii_char_y_width = '░░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_z_1 = '███████╗░'
$ascii_char_z_2 = '╚══███╔╝░'
$ascii_char_z_3 = '░░███╔╝░░'
$ascii_char_z_4 = '░███╔╝░░░'
$ascii_char_z_5 = '███████╗░'
$ascii_char_z_6 = '╚══════╝░'
$ascii_char_z_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_1_1 = '░██╗░'
$ascii_char_1_2 = '███║░'
$ascii_char_1_3 = '╚██║░'
$ascii_char_1_4 = '░██║░'
$ascii_char_1_5 = '░██║░'
$ascii_char_1_6 = '░╚═╝░'
$ascii_char_1_width = '░░░░░'
# ----------------------------------------------------------------
$ascii_char_2_1 = '██████╗░░'
$ascii_char_2_2 = '╚════██╗░'
$ascii_char_2_3 = '░█████╔╝░'
$ascii_char_2_4 = '██╔═══╝░░'
$ascii_char_2_5 = '███████╗░'
$ascii_char_2_6 = '╚══════╝░'
$ascii_char_2_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_3_1 = '██████╗░░'
$ascii_char_3_2 = '╚════██╗░'
$ascii_char_3_3 = '░█████╔╝░'
$ascii_char_3_4 = '░╚═══██╗░'
$ascii_char_3_5 = '██████╔╝░'
$ascii_char_3_6 = '╚═════╝░░'
$ascii_char_3_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_4_1 = '██╗░░██╗░'
$ascii_char_4_2 = '██║░░██║░'
$ascii_char_4_3 = '███████║░'
$ascii_char_4_4 = '╚════██║░'
$ascii_char_4_5 = '░░░░░██║░'
$ascii_char_4_6 = '░░░░░╚═╝░'
$ascii_char_4_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_5_1 = '███████╗░'
$ascii_char_5_2 = '██╔════╝░'
$ascii_char_5_3 = '███████╗░'
$ascii_char_5_4 = '╚════██║░'
$ascii_char_5_5 = '███████║░'
$ascii_char_5_6 = '╚══════╝░'
$ascii_char_5_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_6_1 = '░██████╗░'
$ascii_char_6_2 = '██╔════╝░'
$ascii_char_6_3 = '███████╗░'
$ascii_char_6_4 = '██╔═══██╗'
$ascii_char_6_5 = '╚██████╔╝'
$ascii_char_6_6 = '░╚═════╝░'
$ascii_char_6_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_7_1 = '███████╗░'
$ascii_char_7_2 = '╚════██║░'
$ascii_char_7_3 = '░░░░██╔╝░'
$ascii_char_7_4 = '░░░██╔╝░░'
$ascii_char_7_5 = '░░░██║░░░'
$ascii_char_7_6 = '░░░╚═╝░░░'
$ascii_char_7_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_8_1 = '░█████╗░░'
$ascii_char_8_2 = '██╔══██╗░'
$ascii_char_8_3 = '╚█████╔╝░'
$ascii_char_8_4 = '██╔══██╗░'
$ascii_char_8_5 = '╚█████╔╝░'
$ascii_char_8_6 = '░╚════╝░░'
$ascii_char_8_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_9_1 = '░█████╗░░'
$ascii_char_9_2 = '██╔══██╗░'
$ascii_char_9_3 = '╚██████║░'
$ascii_char_9_4 = '░╚═══██║░'
$ascii_char_9_5 = '░█████╔╝░'
$ascii_char_9_6 = '░╚════╝░░'
$ascii_char_9_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_0_1 = '░██████╗░░'
$ascii_char_0_2 = '██╔═████╗░'
$ascii_char_0_3 = '██║██╔██║░'
$ascii_char_0_4 = '████╔╝██║░'
$ascii_char_0_5 = '╚██████╔╝░'
$ascii_char_0_6 = '░╚═════╝░░'
$ascii_char_0_width = '░░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_excl_1 = '██╗░'
$ascii_char_excl_2 = '██║░'
$ascii_char_excl_3 = '██║░'
$ascii_char_excl_4 = '╚═╝░'
$ascii_char_excl_5 = '██╗░'
$ascii_char_excl_6 = '╚═╝░'
$ascii_char_excl_width = '░░░░'
# ----------------------------------------------------------------
$ascii_char_slash_1 = '░░░░██╗░'
$ascii_char_slash_2 = '░░░██╔╝░'
$ascii_char_slash_3 = '░░██╔╝░░'
$ascii_char_slash_4 = '░██╔╝░░░'
$ascii_char_slash_5 = '██╔╝░░░░'
$ascii_char_slash_6 = '╚═╝░░░░░'
$ascii_char_slash_width = '░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_bracko_1 = '░██╗░'
$ascii_char_bracko_2 = '██╔╝░'
$ascii_char_bracko_3 = '██║░░'
$ascii_char_bracko_4 = '██║░░'
$ascii_char_bracko_5 = '╚██╗░'
$ascii_char_bracko_6 = '░╚═╝░'
$ascii_char_bracko_width = '░░░░░'
# ----------------------------------------------------------------
$ascii_char_brackc_1 = '██╗░░'
$ascii_char_brackc_2 = '╚██╗░'
$ascii_char_brackc_3 = '░██║░'
$ascii_char_brackc_4 = '░██║░'
$ascii_char_brackc_5 = '██╔╝░'
$ascii_char_brackc_6 = '╚═╝░░'
$ascii_char_brackc_width = '░░░░░'
# ----------------------------------------------------------------
$ascii_char_quest_1 = '██████╗░░'
$ascii_char_quest_2 = '╚════██╗░'
$ascii_char_quest_3 = '░░▄███╔╝░'
$ascii_char_quest_4 = '░░▀▀══╝░░'
$ascii_char_quest_5 = '░░██╗░░░░'
$ascii_char_quest_6 = '░░╚═╝░░░░'
$ascii_char_quest_width = '░░░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_space_1 = '░░░░░'
$ascii_char_space_2 = '░░░░░'
$ascii_char_space_3 = '░░░░░'
$ascii_char_space_4 = '░░░░░'
$ascii_char_space_5 = '░░░░░'
$ascii_char_space_6 = '░░░░░'
$ascii_char_space_width = '░░░░░'
# ----------------------------------------------------------------
$ascii_char_dash_1 = '░░░░░░░'
$ascii_char_dash_2 = '░░░░░░░'
$ascii_char_dash_3 = '█████╗░'
$ascii_char_dash_4 = '╚════╝░'
$ascii_char_dash_5 = '░░░░░░░'
$ascii_char_dash_6 = '░░░░░░░'
$ascii_char_dash_width = '░░░░░░░'
# ----------------------------------------------------------------
$ascii_char_fulls_1 = '░░░░'
$ascii_char_fulls_2 = '░░░░'
$ascii_char_fulls_3 = '░░░░'
$ascii_char_fulls_4 = '░░░░'
$ascii_char_fulls_5 = '██╗░'
$ascii_char_fulls_6 = '╚═╝░'
$ascii_char_fulls_width = '░░░░'

function global:Fat-Message
    {
    param(
        [parameter(Mandatory=$true, ParameterSetName="message",Position=0)]$message
        )

    $arraylength = $message.length - 1

    $header_line = $ascii_char_space_width
    $line_1 = $ascii_char_space_1
    $line_2 = $ascii_char_space_2
    $line_3 = $ascii_char_space_3
    $line_4 = $ascii_char_space_4
    $line_5 = $ascii_char_space_5
    $line_6 = $ascii_char_space_6
    $footer_line = $ascii_char_space_width

    for ($charnum = 0; $charnum -le $arraylength ; $charnum++ )
        {
        $char = $message[$charnum]
        # $char

         if ( $char -eq " " )
             {
             $char = "space"
             }

         if ( $char -eq "-" )
             {
             $char = "dash"
             }

         if ( $char -eq "/" )
             {
             $char = "slash"
             }

         if ( $char -eq "!" )
             {
             $char = "excl"
             }

         if ( $char -eq "." )
             {
             $char = "fulls"
             }

         if ( $char -eq "?" )
             {
             $char = "quest"
             }

         if ( $char -eq "(" )
             {
             $char = "bracko"
             }

         if ( $char -eq ")" )
             {
             $char = "brackc"
             }

        # Create Variable Name Table
        # $() evaluate with Pipe

        1..6 | ? { New-Variable -Force -Name $("charvar_name_" + $_) -Value $("ascii_char_" + $char + "_" + $_)}
        New-Variable -Force -Name "charvar_name_width" -Value $("ascii_char_" + $char + "_width")

        # Fill Variables with Content
        # Get-Variable in Get-Variable

        1..6 | ? { New-Variable -Force -Name $("line_" + $_ + "_add") -Value $(Get-Variable -Name $(Get-Variable -Name $("charvar_name_" + $_ )).value -ErrorAction SilentlyContinue ).Value -ErrorAction SilentlyContinue}
        New-Variable -Force -Name "width_add" -Value $(Get-Variable -Name $(Get-Variable -Name $("charvar_name_" + "width" )).value  -ErrorAction SilentlyContinue ).Value  -ErrorAction SilentlyContinue

        $header_line = $header_line + $width_add
        $line_1 = $line_1 + $line_1_add
        $line_2 = $line_2 + $line_2_add
        $line_3 = $line_3 + $line_3_add
        $line_4 = $line_4 + $line_4_add
        $line_5 = $line_5 + $line_5_add
        $line_6 = $line_6 + $line_6_add
        $footer_line = $footer_line + $width_add

        }

    $header_line = $header_line + $ascii_char_space_width
    $line_1 = $line_1 + $ascii_char_space_1
    $line_2 = $line_2 + $ascii_char_space_2
    $line_3 = $line_3 + $ascii_char_space_3
    $line_4 = $line_4 + $ascii_char_space_4
    $line_5 = $line_5 + $ascii_char_space_5
    $line_6 = $line_6 + $ascii_char_space_6
    $footer_line = $footer_line + $ascii_char_space_width

    $header_line
    $line_1
    $line_2
    $line_3
    $line_4
    $line_5
    $line_6
    $footer_line
    }