Users

All Posts (6)

avatar

michaelhellebrandt

PSU 2026.3.4 – Permission denied when accessing script/job history from within a PSU App

avatar
avatar
avatar
avatar

Hi Michel,

Thank you for your detailed explanation. It was very helpful!

I have made some progress, and the permission issue appears to be resolved for our use case.

Here is what I found:

1. Changing the path separator alone did not resolve the issue.

Initially, I changed the call to:

Get-PSUScript -Name 'Skripte/CCMS-HomeProbe.ps1' -Integrated

This still resulted in:

Permission denied. The role specified does not have access to this resource.

2. Removing -Integrated resolved the first error.

The following call now works from within the App:

Get-PSUScript -Name 'Skripte/CCMS-HomeProbe.ps1'

The next operation, Get-PSUJob, initially produced the same permission error.

3. Removing -Integrated from the other PSU cmdlets resolved the remaining permission errors as well.

We now use:

$script = Get-PSUScript -Name 'Skripte/CCMS-HomeProbe.ps1'

$jobs = Get-PSUJob -Script $script -First 20 -OrderBy Id -OrderDirection Descending

$output = Get-PSUJobPipelineOutput -JobId $completedJob.Id

The App can now successfully retrieve completed jobs and their pipeline output.

We have also confirmed that the collection script runs successfully and that its results are displayed in the App.

Our implementation currently uses the PSU job history directly, without an additional cache.

One interesting observation: The forward slash alone did not fix the permission error. Removing -Integrated was the decisive change in our tests.

I would be interested to know whether this behavior is expected when using the default Strict security model or whether it indicates an issue with -Integrated in PSU 2026.3.4.

For now, the original permission issue appears to be resolved, and we can continue developing our monitoring dashboard.

Thank you again for your assistance!

Best regards,
Michael

PSU 2026.3.4 – Permission denied when accessing script/job history from within a PSU App

avatar
avatar
avatar
avatar

Hi,

I'm currently migrating an existing PowerShell Universal v4 dashboard to PSU v5 and running into permission issues when trying to access automation scripts and their job history from within a PSU App.


Environment

  • PowerShell Universal: 2026.3.4

  • App environment: Windows PowerShell 5.1

  • Authentication: Windows Authentication (Active Directory)

  • App roles: User, Administrator

  • App definition: Code

  • App URL: /ccms-admin


What I'm trying to achieve

In PSU v4, we used automation scripts to collect monitoring data from Exchange, SCOM, and DSC.

The dashboard periodically checked the latest completed and running PSU jobs. If the latest results were too old and no job was running, a new job was started.

The dashboard then displayed the pipeline output of the latest completed job.

This allowed multiple administrators to use the same dashboard without triggering redundant data collection jobs.

I'm trying to implement the same concept in PSU v5.


The problem

I created a simple test automation script:

New-PSUScript -Name 'CCMS-HomeProbe.ps1' `
    -Description 'Test job for monitoring data collection' `
    -Path 'Skripte\CCMS-HomeProbe.ps1'

The script runs successfully when executed manually from the PSU administration interface and produces the expected pipeline output.

However, when my PSU App tries to retrieve the script and its jobs using Get-PSUScript and Get-PSUJob, the request fails.

The current error is:

Test failed: Get-PSUScript failed:
Permission denied. The role specified does not have access to this resource.

The error occurs already at Get-PSUScript, so the subsequent Get-PSUJob and Get-PSUJobPipelineOutput calls are never reached.

The calls are made from a PowerShell function invoked by a New-UDDynamic component in the App.


What I've tried

  1. Verified that the automation script is registered in PSU and executes successfully when started manually.

  2. Verified that the App is configured with the User and Administrator roles.

  3. Configured explicit resource permissions using the new PSU permissions interface:

Identity | Resource | Access

Administrator | automation.scripts.Skripte/* | All

User | automation.scripts.Skripte/* | All

  1. Confirmed that the test script is located under Skripte\CCMS-HomeProbe.ps1, matching the configured resource path.

  2. Retested the App after changing these permissions.

Unfortunately, the error remains unchanged.

We also experimented with the PSU server cache in an earlier prototype, but encountered permission errors there as well. We therefore removed the cache entirely and switched to reading the job history directly. The current problem concerns access to automation scripts and their jobs.


Expected behavior

An authenticated administrator using the PSU App should be able to:

  • Retrieve an existing automation script.

  • Check its latest completed and running jobs.

  • Read the pipeline output of a completed job.

  • Start a new job when necessary, provided the user has the appropriate permissions.

This worked in our previous PSU v4 implementation.


Questions

  1. Is this a known issue with integrated PSU cmdlets in version 2026.3.4?

  2. Which resource permissions are required for an App to access automation scripts and job history?

  3. Are the permissions for reading job history different from those for managing or executing scripts?

  4. Is there a recommended way to implement this monitoring pattern in PSU v5 without granting unnecessarily broad permissions?


I'd prefer to keep using the native PSU cmdlets rather than implementing direct REST API calls or managing additional API tokens.

Any guidance would be appreciated.

Thanks!

Michael

Failed to add license from environment variable

avatar
avatar
avatar

Hallo zusammen,


der Support hat mir eine aktuelle Lizenzdatei zukommen lassen.

Damit hat das Einspielen über die Umgebungsvariable einwandfrei geklappt

Die vorhandene war noch im alten Format und diese wird durch die aktuelle 2026.2-Version von PSU abgewiesen.


$license = Get-Content -LiteralPath $licenseFile -Raw
[Environment]::SetEnvironmentVariable(
     'PSULICENSE',
     $license,
     [EnvironmentVariableTarget]::Machine
)

Invoke-RestMethod 'http://localhost:5000/api/v1/license/status' -Headers @{ Authorization = "Bearer $($token.token)" }
True


Vielen Dank an dieser Stelle auch nochmal an die schnelle und kompetente Hilfe durch den Support.


Gruß

Michael

Failed to add license from environment variable

avatar
avatar
avatar

Hallo,


ich muss offline lizensieren und habe, nachdem ich alle Wege


  • Upload der Lizenzdatei über die Weboberfläche

  • Set-PSULicense

  • Setzen der Umgebungsvariable PSULICENSE

  • direkter Aufruf der REST-API über POST /api/v1/license

  • Upload der Datei über POST /api/v1/license/upload


ausprobiert habe, einen Supportcase bei euch aufgemacht.

Dem habe ich schon alle Informationen zukommen lassen und nun harre ich der Dinge ;)

Ich denke mal, es liegt an einer mit eurer neusten Version nicht kompatiblen Lizenzdatei.


Ich kann den Forumsbeitrag auch schließen, da die Kommunikation ja nun über den Support direkt läuft.

Trotzdem danke für die schnelle Rückmeldung hier im Forum ;)



Gruß

Michael

Failed to add license from environment variable

avatar
avatar
avatar

Hallo zusammen,


ich versuche PSU (2026.2.5.0) automatisiert zu installieren und scheitere bisher an dem Punkt der Lizensierung.

Laut docs:

You can use the PSULICENSE environment variable to set a license. The value of this environment variable needs to be the contents of the license file.


da habe ich versucht:

$licenseFile = 'E:\Install\bin\PowerShell Universal\PSULizenz.txt'
$license = (Get-Content -LiteralPath $licenseFile -Raw).Trim() 
[Environment]::SetEnvironmentVariable( 'PSULICENSE', $license, [EnvironmentVariableTarget]::Machine ) 
----
[Environment]::GetEnvironmentVariable('PSULICENSE',[EnvironmentVariableTarget]::Machine)
<License>GANZZVIELLLLDAZWISCHENNNNNN</License>


Nach erneutem Start steht im Log aber :

[ERR][UniversalAutomation.StartupService] Failed to add license from environment variable.

System.ArgumentException: Invalid license specified. (Parameter 'license')

at Universal.Server.Services.LicenseService.Add(License license, Boolean ignoreExisting) in D:\a\powershell-universal\powershell-universal\src\Universal.Server\Services\LicenseService.cs:line 306

at UniversalAutomation.StartupService.LoadAuthenticationMethodsFromConfig() in D:\a\powershell-universal\powershell-universal\src\Universal.Server\Services\StartupService.cs:line 127


Wo ist mein Fehler oder kennt jemand einen anderen Weg der Lizensierung?


Gruß

Michael

Apps to query exchange message tracking

avatar
avatar
avatar
avatar

Hi,


I hope my English is sufficient.


In my setup, PSU runs as a Windows service on a server where the Exchange Management Tools are installed. The PSU service runs under a service account that has the required Exchange permissions.


When Exchange cmdlets need to be executed directly from a dashboard, I load a dedicated PSU environment that runs a standard Windows PowerShell 5.1 session. As the startup script for this environment, I execute the following code:


. "E:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1" # adjust path as needed
Connect-ExchangeServer -ServerFqdn EXCHANGESERVERNAME # adjust server name as needed


This approach has worked best for me. When using PSSession directly, I ran into similar issues as you described.


I solved message tracking differently. Since a large number of servers (>50) need to be queried, the workload is parallelized using jobs. The frontend is similar to what was described earlier; when the form is submitted, the script is triggered:


-OnSubmit {
    # build htParameter hashtable
    ...
    ...

    $job = Invoke-PSUScript -Script 'Get-CCMSMessageTracking.ps1' -htParameter $htParameter
    $page:JobID = $job.Id

    Sync-UDElement -Id 'dynJobsRunning'
    Sync-UDElement -Id 'dynResultTable'
}


Get-CCMSMessageTracking.ps1:


param([hashtable]$htParameter)

Import-Module CCMS-ScriptModule

foreach ($server in $alleExchangeServer.Name) {
    $null = Invoke-Command -ComputerName $server -AsJob -ScriptBlock {
        $s = New-PSSession `
            -Name "Session_$($using:server)" `
            -ConfigurationName Microsoft.Exchange `
            -ConnectionUri http://$($using:server)/PowerShell/ `
            -Authentication Kerberos `
            -Credential $using:credCCMS

        $null = Import-PSSession $s -CommandName Get-MessageTrackingLog
        Get-MessageTrackingLog -Server $using:server @using:htParameter
        Remove-PSSession -Name "Session_$($using:server)"
    } -JobName "Job_MessagingTracking_$server" -Authentication Kerberos
}

$results = Get-Job -Name "Job_MessagingTracking_*" |
           Wait-Job |
           Receive-Job |
           Select-Object TimeStamp, Sender, Recipients, MessageSubject, EventID,
                         ServerHostname, MessageID, Source, SourceContext

Get-Job -Name "Job_MessagingTracking_*" | Remove-Job

$results


Within the script module, the Exchange server names are stored as a global variable ($alleExchangeServer.Name), and the service account credentials are stored as a credential object ($credCCMS). Each mailbox server returns its own message tracking results.


Once the PSU job has completed, the results can be retrieved and displayed as a table in the dashboard.


Since other Exchange scripts are also executed as PSU jobs, I implemented a dedicated job overview page for our admins. This page allows previous jobs to be reviewed, displayed, or re-run. For long-running scripts, users can leave the page and later return via the job page once execution has completed. A job badge in the menu bar indicates whether jobs are still running in the context of the current admin user.


I hope this helps.

1 - 6 of 6 items