Skip to content

"SetPropertyValue $Dsn.PropertyValue" doesn't work if ClientCertificate is set to null. #3211

Open
@CoyoteProd

Description

@CoyoteProd

in the code here :

$DsnArray = Get-OdbcDsn -DriverName 'SQL Server Native Client 10.0'
ForEach ($Dsn in $ DsnArr) {
          Remove-OdbcDsn -InputObject $Dsn 
          # You can change the property array as well, 
          # if DSN attributes have been changed in the new driver version

Add-OdbcDsn -Name $Dsn.Name -DsnType $Dsn.DsnType -Platform $Dsn.Platform -DriverName 'SQL Server Native Client 12.0' -SetPropertyValue $Dsn.PropertyValue
}

The properties SetPropertyValue $Dsn.PropertyValue doesn't work if ClientCertificate is set to null.
In this case an error is poped:

dd-OdbcDsn : Erreur de syntaxe dans le paramètre SetPropertyValue {ClientCertificate=}. Le paramètre doit être au
format "MyKey=MyValue".
Au caractère Ligne:1 : 1
+ Add-OdbcDsn -name $dsn.Name -DriverName $dsn.DriverName -SetPropertyV ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (MSFT_OdbcDsnTask:Root/Microsoft/...SFT_OdbcDsnTask) [Add-OdbcDsn], CimExc
   eption
    + FullyQualifiedErrorId : MI RESULT 1,Add-OdbcDsn

Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

Metadata

Metadata

Assignees

Labels

area-wdacIssues for wdac moduleissue-doc-bugSomething is out of date, unclear, confusing, or broken in the article. Blocks customer success.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions