Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function New-UdlFromConn #21

Open
cnEUL opened this issue Jul 24, 2023 · 0 comments
Open

Add function New-UdlFromConn #21

cnEUL opened this issue Jul 24, 2023 · 0 comments

Comments

@cnEUL
Copy link
Contributor

cnEUL commented Jul 24, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant