This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Create LoginAccount with PowerShell

I'm trying to write a powershell script that create a LoginAccount for a windows user.
That script will run directly on the server using the current user credential, which is a Vault Administrator.

Somehow, the call to AddLoginAccount never ends. Using the "same" code in a c# apps works fine.
I'm wondering what is the problem here.

# Load M-Files API
$null = [System.Reflection.Assembly]::LoadWithPartialName("Interop.MFilesAPI")

# Connect to M-Files Server
Write-Host "Connecting to Server 'localhost' ..."
$server = new-object MFilesAPI.MFilesServerApplicationClass
$serverConnection = $server.Connect()


# Read user info
Write-Host "Read user info"
$userInfo = $server.LoginAccountOperations.GetPersonalInformationFromDomain("MYDOMAIN\MYUSER")

$loginAccount = new-object MFilesAPI.LoginAccountClass
$loginAccount.Set([MFilesAPI.MFLoginAccountType]::MFLoginAccountTypeWindows, "MYDOMAIN", "MYUSER", [MFilesAPI.MFLoginServerRole]::MFLoginServerRoleLogIn, $userInfo.FullName, $userInfo.Email, [MFilesAPI.MFLicenseType]::MFLicenseTypeNamedUserLicense)

Write-Host "Create Login"
$server.LoginAccountOperations.AddLoginAccount( $loginAccount )