0 votes

Hi

Can you lead us to what we are doing wrong with this report?

`$CID ="{ed8afa99-e34d-4531-b69a-0bd0785f4d3a}"

$folders = gci -force '\server\Kunden'-ErrorAction SilentlyContinue | ? { $_ -is [io.directoryinfo] }

ForEach ($folder in $folders) { $customer = $folder $len = 0 gci -recurse -force $folder.fullname -ErrorAction SilentlyContinue | ForEach-Object { $len += $_.length } $item = ($len / 1Gb)

$columnValues = @{ $CID = $item;} $Context.Items.Add(1, $customer, $columnValues) $Context.LogMessage($item, "Warning") Write-Host $customer, $item

}`

The report shows all folder correctly, in the log we can see the correct values for the size but the column which should contain these number is shown as "empty": image.png

Column FolderSize ($CID)= Report specific column, Value generation = Template, empty. ColumnID is double checked an is the right one.

Thanks

by (100 points)

1 Answer

0 votes
by (289k points)

Hello,

The thing is that when you are using the $Context.Items.Add method for items with an icon and column values, it should contain 4 parameters. Where the third parameter specifies the object type and the fourth one specifies column values. For details, have a look at the following SDK article: http://adaxes.com/sdk/?AdmListItems.html.

Also, there is no need to use pipeline when obtaining folders, you can just use the Directory parameter of the Get-ChildItem cmdlet.

Finally, your script should look like the following:

$CID ="{ed8afa99-e34d-4531-b69a-0bd0785f4d3a}"

$folders = gci -force '\server\Kunden'-ErrorAction SilentlyContinue -Directory

ForEach ($folder in $folders)
{
    $customer = $folder
    $len = 0
    gci -recurse -force $folder.fullname -ErrorAction SilentlyContinue | ForEach-Object { $len += $_.length }
    $item = ($len / 1Gb)

    $columnValues = @{ $CID = $item }
    $Context.Items.Add(1, $customer, "Folder", $columnValues)

    $Context.LogMessage($item, "Warning")    
}

Related questions

0 votes
1 answer

I am modifying the 'Inactive Computers' report so we can see a calculation of the days since the computer was active. I added a script column, and have this script. It ... use Adaxes to make my team more efficient so thanks for your help on my recent tickets.

asked Aug 6, 2019 by jbadry (430 points)
0 votes
1 answer

Hello I have tried several ways to create a report but cannot achieve what I want. The situation is that we have groups and all members of this group can manage some groups in ... be added to group xxx (only requests that have not yet been treated by IT). Thx

asked Aug 28 by DRiVSSi (300 points)
0 votes
1 answer

Is there a report that I can run that shows everyone with a specific job title

asked Apr 20, 2023 by sra98a (120 points)
0 votes
1 answer

For security purposes, we need to audit the objects that are capable of replicating the directory. As we have a number of individuals that need this report, I would like to ... four domains and would like to see any objects with this permission in any of them

asked May 20, 2022 by jiambor (1.2k points)
0 votes
1 answer

Hi, I copied report "recently created users" and added a parameter to check for specific value in extensionAttribute3. If this attributes starts with e.g. value "startdate" , only those users ... $null, * , %%, ? , ...) Any idea how to build the report?

asked Jul 7, 2023 by wintec01 (1.5k points)
3,547 questions
3,238 answers
8,232 comments
547,809 users