I have a fairly simple function that I want to convert to a report in Adaxes that others can use
The PowerShell function as it currently exists
function Get-Groups {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true,
Position = 0)]
[String]
$Username,
[switch]
$IncludeDefault,
[switch]
$IncludeDescription
)
$OmitList = 'Authenticated Users', 'Certificate Service DCOM Access', 'Domain Users', 'Everyone', 'Medium Plus Mandatory Level', 'Pre-Windows 2000 Compatible Access', 'Service asserted identity', 'This Organization', 'Users'
$GroupList = Get-ADAccountAuthorizationGroup $Username | Sort-Object SamAccountName
if (-not $IncludeDefault) {
$GroupList = $GroupList | Where-Object { $_.SamAccountName -notin $OmitList }
}
if ($IncludeDescription) {
$GroupList = $GroupList | ForEach-Object { Get-ADGroup $_.SamAccountName -Properties Description | Select-Object SamAccountName, Description }
}
else {
$GroupList = $GroupList | Select-Object -ExpandProperty SamAccountName
}
$GroupList
}
But I'm struggling with just getting the data to the report.
I created the report with two parameters
and the following script (for now, really just trying to figure out how to properly get the data over)
$OmitList = 'Authenticated Users', 'Certificate Service DCOM Access', 'Domain Users', 'Everyone', 'Medium Plus Mandatory Level', 'Pre-Windows 2000 Compatible Access', 'Service asserted identity', 'This Organization', 'Users'
$Username = $Context.GetParameterValue('param-User')
$IncludeDefault = $Context.GetParameterValue('param-IncludeDefault')
$GroupList = Get-ADAccountAuthorizationGroup $Username | Sort-Object SamAccountName
#if (-not $IncludeDefault) {
$GroupList = $GroupList | Where-Object { $_.SamAccountName -notin $OmitList }
#}
$objectList = $GroupList | ForEach-Object { Get-ADGroup $_.SamAccountName -Properties Description | Select-Object SamAccountName, Description }
$Context.Items.Add($objectList)
This obviously doesn't work and I've been trying different methods but I either end up with errors or a blank report.
So how can I just add values to the report?