For some workflows it is necessary to know which Vault user created a job. For example when their name or their email address is required within a job.


In order for this function to work powerVault and a Vault connection are needed:

Import-Module powerVault
Open-VaultConnection -Vault "VaultName" -Server "ServerName" -User "UserName" -Password "Password"

You have to get the user's id from the job in the job queue. With that id you can retrieve the matching user object..

function Get-VaultJobCreator {
Returns a Vault user object
This function checks if the current user has permissions to retrieve the user information. If it doesn't the function logs a warning and does nothing. If it does the function returns an Autodesk.Connectivity.WebServices.User object. 
$JobCreator = Get-VaultJobCreator -JobId $job.Id
    if(-not $vault.JobService.CheckRolePermissions(@("GetJobsByDate"))) {
        Write-Host "User needs 'JobQueueRead' permission to execute GetJobsByDate"
    if(-not $vault.AdminService.CheckRolePermissions(@("GetUserByUserId"))) {
        Write-Host "User needs 'AdminUserRead' permission to execute GetUserInfoByUserId"
    [array]$allJobs = $vault.JobService.GetJobsByDate([int]::MaxValue,[DateTime]::MinValue)
    $currentJob = $allJobs | ? { $_.Id -eq $JobId }
    $user = $vault.AdminService.GetUserByUserId($currentJob.CreateUserId)
    return $user