If I put CollectionDetails into
New-UdGrid -Title "($CollectionID) $CollectionDetails Device Details"
I can see my data
Also if I look at the CSV file
Now this one works
function New-SCCMDeploymentCollectionDeviceDetailsPage {
Param
(
[Parameter(Mandatory=$true,
ValueFromPipelineByPropertyName=$true)]
[String]$CollectionID,
[Parameter(Mandatory=$true,
ValueFromPipelineByPropertyName=$true)]
[String]$CollectionName
)
New-UDPage -Name "DeviceDetails$($CollectionID)" -Content {
#Declare any variables that will be used as content inside cmdlets i.e. anything inside {} in a cmdlet
#Then explicitly declare it as a Script Scope
$Script:CollectionID = $CollectionID
$Script:CollectionName = $CollectionName
#Set current directory to SCCM site
Push-Location
Set-Location -Path $SCCMSiteCodePath
#If a variable is going to be used that will be used as content inside cmdlet i.e. anything inside {} in a cmdlet
#Then explicitly declare it as a Script Scope
$Script:CollectionDetails = Get-CMCollectionDirectMembershipRule -Id $CollectionID
pop-location
$CollectionDetails | export-csv -path "c:\temp\$CollectionID.CSV" -NoTypeInformation
New-UdGrid -Title "Details of Devices in Collection $CollectionName ($($CollectionID) )" -Endpoint {
$CollectionDetails| Select-Object -Property RuleName| Out-UDGridData }
}
}
What found was I had to declare the variables I wanted to use in the content with scope of Script to get it to work
Sorry about the formatting of the post, still trying to figure out how this forum works