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 (850 points)

1 Answer

0 votes
by (182k 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 (1.7k points)
0 votes
1 answer

Hi! I need a report of user accounts with empty attributes. Is there a possibility to make such report? Thanks in advance.

asked Sep 11, 2009 by philip (250 points)
0 votes
1 answer

I'm trying to retrive the Microsoft 365 License product name in a report as the 'Office 365 License' attribute in Adaxes shows each individual licensed product e.g. ... 365 F3"} } $productnames = $productnames -join ", " $Context.Value = $productnames

asked Jul 27 by richarddewis (1.5k points)
0 votes
1 answer

Adaxes version is 2018.2. I have build a custom report, and I don't want the 'Name' column with the pictures to appear in it. But it seem to be mandatory, it is greyed ... . Is there a way to remove / hide / or change the mandatory attribute or column ? Thanks

asked Jan 9 by Isabelle (280 points)
0 votes
1 answer

Hi, I'm currently facing a problem where I want to set up a powershell script that should report all accounts (enabled, disabled, expired) matching a specific employeeType ... something else, just the plain Info Can you help me with this? kind regards Ingemar

asked Sep 4, 2015 by ijacob (6.1k points)
2,251 questions
2,011 answers
5,506 comments
24,803 users