简体   繁体   中英

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. 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:

Exception calling "ReadLookupTables" with "0" argument(s): "Object reference not set to an instance of an object.

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.

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

now it's working...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM