Integrate PSU (IIS) app into a page

Product: PowerShell Universal
Version: 5.4.2

Hello everyone,
I am currently facing the challenge of integrating existing apps into pages. Unfortunately, I couldn’t find any way to integrate them in the documentation. We are using PSU with IIS. I would be grateful for any help.

$Theme = get-UDTheme -name 'Afterglow'

$Navigation = @(
    New-UDListItem -Label "Home" -
    New-UDListItem -Label "AD" -Children {
        New-UDListItem -Label "Create" -Children {
            New-UDListItem -Label "Groups" -Icon (New-UDIcon -Icon layer-group) -Href '/groups'
            New-UDListItem -Label "User" -Icon (New-UDIcon -Icon user) -Href '/users'
        }
        New-UDListItem -Label "Reports" -Children {
            New-UDListItem -Label "Groupmember" -Icon (New-UDIcon -Icon users-viewfinder) -Href '/groupmembership'
        }
    }
)

$Pages = @()
$Pages += New-UDPage -Name 'groups' -Title 'Group' -Content {}
$Pages += New-UDPage -Name 'users' -Title 'User' -Content {}
$Pages += New-UDPage -Name 'groupmembership' -Title 'Groupmember' -Content {}

New-UDApp -Theme $theme -Title "Helpdesk" -Pages $Pages -NavigationLayout permanent -Navigation $Navigation

I had a quick look, but this bit in the code example looks like it is missing an attribute or value

Can you share what you see with the code and what your hoping to see?

Hi @TriggerAu ,

I am basically trying to integrate an app, but I don’t know how to proceed in terms of code. For example: I have a separate app that creates a reporting of AD group members. I am currently trying, unsuccessfully due to a lack of knowledge, to integrate this app.

However, if I place the entire code on the aforementioned page, it works. Nevertheless, I would prefer to keep it separate.

When i use Invoke-UDRedirect -Url "applink", i can start the app via new window. But i prefer to include the app on the page.

heya, Im not 100% sure on the integration bit, but Ill give you one example we use for some things that might be in the right area

Using the example of having a report of AD members, If I wanted to have that show on two pages in one or more apps then the way I have been doing this is:

  • Place the AD code in a module with a function - something like Get-ADGroupMemberData and it returns a list of the members and any data you want about them
  • Create a function in a module that creates the UD-Table. like
function New-UDTableOfADGroupMembers() 
{
   $members = Get-ADGroupMemberData -Identity "DavesMagicalAdGroup" -Server "DavesDomain.local"

   $columns = @(
       New-UDTableColumn -Property "Name" -Title "Name" -ShowFilter -DefaultSortColumn
       New-UDTableColumn -Property "Enabled" -Title "Enabled" -ShowFilter
       New-UDTableColumn -Property "SAMAccountName" -Title "SAMAccountName" -ShowFilter
   )
   
   New-UDTable -Data $members -Columns $columns -ShowSort -ShowFilter -ShowSearch -PageSize 50 -dense -ShowPagination
}
  • On any page that I want to display this table i can then put a single call to New-UDTableOfADGroupMembers

In reality of you did it this way you’d probs add some params to the call so you could specify the group, or use a search to add to it,

Im sure theres other ways too - eg the Get-ADMemberData method could be a script so it can be used from the portal directly or scheduled for some purpose, etc.

1 Like

Thank you, Trigger, this is exactly what I was looking for. I also found another solution, which I will post at the end, but it does not adopt the design of the dashboard. Therefore, I took the liberty of incorporating and adapting your code. It works wonderfully, thank you very much for that. Here is another alternative I used:

New-UDElement -Tag “iframe” -Attributes @{
src = “https://psuniversal:port/applink”;
style = @{
width = ‘100%’
border = ‘none’
Height = ‘100%’
}
}

1 Like