Read-Only license exception to get user and group from API in 2020 version

Read-Only license exception to get user and group from API in 2020 version

Anonymous
Not applicable
1,340 Views
4 Replies
Message 1 of 5

Read-Only license exception to get user and group from API in 2020 version

Anonymous
Not applicable

Hi,

 

I have a development to get Vault groups and users and their roles from the API on read-only mode for the license, but on 2020 version I'm faced with an error, that is : New-Object : Exception calling ".ctor" with "1" argument(s): "Exception of type 'Autodesk.Connectivity.WebServices.VaultLicenseException' was thrown."

 

I tried with read-only = none, read-only = false, but the problem keep seems.

 

I know that the .dll file is not the same in 2020 version (AdskLicensingSDK_2.dll in 2020 version instead of clmloader.dll in 2019 version), but I don't know is there is an influence.

 

The developpement works perfectly in 2019 version with "read-only = false".

 

Has anyone ever faced this problem and found a solution?

 

Thanks and best regards,

Romain

0 Likes
1,341 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

I tested this morning, the AdskLicensingSDK_2.dll must be present in my output directory. Like this, the export works perfectly.

 

During my old test, I did not think about restarting the PowerShell completely, and it did not load the dll file.

0 Likes
Message 3 of 5

xavier_dumont1
Collaborator
Collaborator

On my side, same error with a PS1. I resolve the problem by copying the AdskLicensingSDK_2.dll into the powershell.exe path (C:\Windows\System32\WindowsPowerShell\v1.0).

 

Same question, is there a solution to avoid this workaround ?

0 Likes
Message 4 of 5

Markus.Koechl
Autodesk
Autodesk
I believe, that this workaround is the solution ;).


Markus Koechl

Solutions Engineer PDM, Autodesk Central Europe
0 Likes
Message 5 of 5

xavier_dumont1
Collaborator
Collaborator

I Markus,

 

Ok thanks for the answer. Here is a samples who work now.

 

Have a nice day.

#Install SDK "C:\Program Files\Autodesk\Vault Professional 2020\SDK\setup.exe"
#Copy the DLL AdskLicensingSDK_2.dll into C:\Windows\System32\WindowsPowerShell\v1.0 (variable $PSHOME) to avoid license exception.
Copy-Item "C:\Program Files\Autodesk\Autodesk Vault 2020 SDK\bin\x64\AdskLicensingSDK_2.dll" -Destination $PSHOME
[System.Reflection.Assembly]::LoadFrom("C:\Program Files\Autodesk\Autodesk Vault 2020 SDK\bin\x64\Autodesk.Connectivity.WebServices.dll")

#	Vault Server Name :
$server="localhost"
#	Vault Database :
$vaultName="Vault"
#	Vault UserName :
$username ="administrator"
#	Vault password :
$passw = ""
#	Read-only license or not :?
$readonly = $true

$mServer = New-Object Autodesk.Connectivity.WebServices.ServerIdentities
$mServer.DataServer = $server
$mServer.FileServer = $server
$login = New-Object -type Autodesk.Connectivity.WebservicesTools.UserPasswordCredentials $mServer,$vaultName,$username,$passw,$readonly
$vault = New-Object -type Autodesk.Connectivity.WebServicesTools.WebServiceManager $login

#Samples to test if it's ok (get all Vault Users and send back the first founded user)
$adminSvc = $vault.AdminService
$allUsers = $adminSvc.GetAllUsers()
$firstuser = $allUsers[0].Name
Write-Output $firstuser