在 Windows Server 2012 上编写 PowerDesigner 脚本时遇到问题。我们在 Windows 10 和 Windows 7 上没有问题(我们在多台机器上尝试过)。
我们从 PowerShell 启动 PowerDesigner,如下所示:
$PowerDesigner = New-Object -com powerdesigner.application
Add-Type -path “C:\Program Files (x86)\Sybase\PowerDesigner 16\Interop.PdCommon.dll”
Add-Type -path “C:\Program Files (x86)\Sybase\PowerDesigner 16\Add-ins\Microsoft SQL Server 2005 Analysis Service\Interop.PdPDM.dll”
在 Windows Server 2012 R2 上,$PowerDesigner 对象的所有属性都设置为 $null。如果我们尝试将属性设置为其他值,则会出现错误。例如,声明
$PowerDesigner.InteractiveMode = 1
失败并出现以下错误:
Exception setting "InteractiveMode": "Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))"
PowerDesigner 版本是 16.1.0.3637。