简体   繁体   English

PowerShell导入的dll无法正常工作:使用“ 0”参数调用“ ReadLookupTables”的异常:“对象引用未设置为对象的实例

[英]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.

相关问题 Azure PowerShell-对象引用未设置为对象的实例 - Azure PowerShell - Object reference not set to an instance of an object powershell 位传输 object 引用未设置为 object 的实例 - powershell bitstransfer object reference not set to an instance of an object Powershell对象引用未设置为对象的实例 - Powershell Object reference not set to an instance of an object Powershell Core中的“对象引用未设置为对象的实例” - "Object reference not set to an instance of an object" in Powershell Core Powershell Set-Item 返回未设置为实例对象的对象引用 - Powershell Set-Item returns Object reference not set to an object of an instance Powershell“X509Certificate2Collection”使用“3”参数调用“导入”时出现异常:“找不到请求的对象 - Powershell "X509Certificate2Collection" Exception calling "Import" with "3" argument(s): "Cannot find the requested object PowerShell新项目-对象引用未设置为对象的实例 - PowerShell New-item - Object reference not set to an instance of an object PowerShell 给出错误“对象引用未设置到实例对象” - PowerShell giving an error "Object reference not set to an instance object" Powershell从自定义DLL中调用构造函数,“异常调用” .ctor”的参数为“ 1”:“索引1超出范围。” - Powershell calling a constructor from custom DLL “Exception calling ”.ctor“ with ”1“ argument(s): ”Index 1 is out of range.“” Function 从 Powershell 5 移植到 Powershell 7 失败,并显示“对象引用未设置为对象的实例” - Function ported from Powershell 5 to Powershell 7 fails with “object reference not set to an instance of an object”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM