[英]PowerShell imported dll not working: Exception calling “ReadLookupTables” with “0” argument(s): "Object reference not set to an instance of an object
i have currently an issue with a powershell script i have developed. 我目前已开发的Powershell脚本存在问题。 The following script runs on my system and on another developer machine but not on any other system... I have tested it on a virtual Win10 hyper v but it's always the same error: 以下脚本在我的系统和另一台开发人员计算机上运行,但不在任何其他系统上运行...我已经在虚拟Win10 hyper v上对其进行了测试,但始终是相同的错误:
Exception calling "ReadLookupTables" with "0" argument(s): "Object reference not set to an instance of an object. 使用“ 0”参数调用“ ReadLookupTables”的异常:“对象引用未设置为对象的实例。
The script code: 脚本代码:
$pwaUrl = "https://xyz.co"
$userName = "xyz"
$password = "xyz"
Import-Module "$PSScriptRoot\ProjectHelper\Microsoft.ProjectServer.dll"
$projHelper = New-Object Microsoft.ProjectServer.MsProject($pwaUrl, $username, $password, $true)
$secSvc = $projHelper.GetSecuritySvc();
$secGroups = $secSvc.readGroupList();
$secGroups
On the developer machines Visual Studio Enterprise is installed... I have added all the SDK's and .Net Runtime environments on my virtual machine but it does not work. 在开发人员机器上安装了Visual Studio Enterprise ...我在虚拟机上添加了所有SDK和.Net Runtime环境,但是它不起作用。
Thanks for help 感谢帮助
I have found a solution for my issue. 我已经找到解决问题的方法。
I've opened the dll with the Microsoft dll disassembler and checked on the Manifest the required dll for this dll... Than i compared the dlls on my system with the other system and copied the missing files into the "$PSScriptRoot\\ProjectHelper\\Microsoft.ProjectServer.dll" folder 我已经使用Microsoft dll反汇编程序打开了dll,并在清单上检查了该dll所需的dll ...比起我将我的系统上的dll与其他系统进行比较,然后将丢失的文件复制到“ $ PSScriptRoot \\ ProjectHelper \\ Microsoft.ProjectServer.dll”文件夹
now it's working... 现在正在工作...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.