Skip to content

Add function New-UdlFromConn #21

@cnEUL

Description

@cnEUL

Add a function that creates a connItems from an ADO connection and creates a UDL file from it.

$connItems = @{}
        $filteredContent -split ';' | ForEach-Object {
            $keyValue = $_ -split '='
            if ($keyValue.Count -eq 2) {
                $key = $keyValue[0].Trim()
                $value = $keyValue[1].Trim()
                if ($key -ne '') {
                    $connItems [$key] = $value
                }
            }
        }

        $connStr = ($masterConnItems.GetEnumerator() | ForEach-Object {
            "$($_.Key)=$($_.Value)"
        }) -join ';'

        $udlContent = @"
        [oledb]
        ; Everything after this line is an OLE DB initstring
        $connStr
        "@
        
        $udlContent | Out-File -FilePath $udlFilePath -Encoding Unicode

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions