Advertisement
FakeHumanGuy

UDTable

Sep 25th, 2019
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. New-UDPage -Name "Testing Tabs 2" -Icon table -AuthorizedRole @("Dev") -Content {
  2.  
  3.     New-UDHeading -Size 1 -Text "A|D|U| Management" -Color '#00529b'
  4.     New-UDIcon -Icon users -Size 7x -Color '#00529b'
  5.  
  6.     New-UDCard -Title "User Account Search" -BackgroundColor '#eeeeee' -Content {
  7.         New-UDInput -Title "Search" -Endpoint {
  8.             param(
  9.                 [Parameter(Mandatory=$false)]
  10.                 [ValidateCount(1,20)]
  11.                 [string]$FirstName,
  12.                 [Parameter(Mandatory=$false)]
  13.                 [ValidateCount(1,20)]
  14.                 [string]$LastName
  15.             )
  16.             $Session:FirstName = $FirstName
  17.             $Session:LastName = $LastName
  18.             $Session:RequestingUser = $user
  19.            
  20.             New-UDInputAction -Content {
  21.                     New-UDGrid -NoExport -Title "" -Headers @("Name", "UserName", "Enabled", "Options") -Properties @("Name", "UserName", "Enabled", "Button") -Endpoint {
  22.                         $Cache:ADUser | Where-Object { ($_.GivenName -match $Session:FirstName) -or ($_.SurName -match $Session:LastName) } | ForEach-Object {
  23.                         [PSCustomObject]@{
  24.                             Name = $_.Name
  25.                             UserName = $_.SamAccountName
  26.                             Enabled = $_.Enabled
  27.                             Button = New-UDButton -Text "Select User" -Icon user_edit -OnClick (New-UDEndpoint -Endpoint {
  28.                                 $Session:SelectedUserSAN = $_.SamAccountName
  29.                                 $Session:SelectedUserName = $_.Name
  30.  
  31.                                 $Session:GridData = Invoke-ADUMUEGridData -SamAccountName $Session:SelectedUserSAN
  32.                                
  33.                                 #Sync/update table and cards to show infor for currently selected user
  34.                                 Sync-UDElement -Id 'DivBox2'
  35.  
  36.                             })#end new-udendpoint in pscustomobject
  37.  
  38.                         }#end psobject
  39.  
  40.                         } | Select-Object -Property Name, UserName, Enabled, button | sort Name | Out-UDGridData
  41.                     }#end udgrid endpoint
  42.  
  43.             }#end udinputAction content
  44.  
  45.         }#end udinput endpoint
  46.  
  47.     }#end udcard search
  48.  
  49.         New-UDElement -Tag div -Id 'DivBox2' -Endpoint {
  50.  
  51.             New-UDCard -Title "Account Status" -BackgroundColor '#eeeeee' -Content {
  52.  
  53.                 New-UDRow -Columns {
  54.                     New-UDColumn -size 12 {
  55.                         New-UDColumn -size 1 {
  56.                             New-UDIcon -Icon user_cog -Size 8x -Color "#00529b"
  57.                         }
  58.                         New-UDColumn -size 10 {
  59.                             New-UDHeading -Text "Your currently selected user is: $Session:SelectedUserName - $Session:SelectedUserSAN" -Size 4
  60.                         }
  61.                     }
  62.                 }#end udrow
  63.  
  64.                 New-UDRow -Columns {
  65.                     New-UDColumn -size 12 {
  66.                         New-UDColumn -size 1 {
  67.                             $Session:AccountStatusIcon
  68.                         }
  69.                         New-UDColumn -size 10 {
  70.                             $Session:AccountStatus
  71.                         }
  72.                     }
  73.                 }#end udrow
  74.                 New-UDRow -Columns {
  75.                     New-UDTable -Title "" -AutoRefresh -RefreshInterval 5 -Headers @("DisplayName","UserName","EmployeeID","Email","Title","Department","AccountLocked","AccountExpired","AccountEnabled","PasswordExpired","PasswordLastSet","LastBadPasswordAttempt","LastLogonDate","AccountCreated") -Endpoint {
  76.                        
  77.                         $Session:GridData | Out-UDTableData -Property @("DisplayName","UserName","EmployeeID","Email","Title","Department","AccountLocked","AccountExpired","AccountEnabled","PasswordExpired","PasswordLastSet","LastBadPasswordAttempt","LastLogonDate","AccountCreated")
  78.  
  79.                     }#end udtable    
  80.                 }#end udrow
  81.             }#end udcard
  82.  
  83.         }#end udelement divbox2
  84.  
  85.         New-UDLayout -Columns 3 {
  86.             New-UDCard -Title "Set EmployeeID" -BackgroundColor pink -Content {}
  87.             New-UDCard -Title "Set Department" -BackgroundColor '#9B4900' -Content {}
  88.             New-UDCard -Title "Set Title" -BackgroundColor teal -Content {}
  89.         }
  90.  
  91. }#end udpage
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement