Powershell Scanner in Scan Profile
Evan Gruzlewski
Hello!
I have a question regarding the usage of Powershell in scan profiles. I've been trying to add a script that checks the free space available for only the C: drive, but I can't seem to get it working. The problem is that once I enter into a dynamic collection and go to set said scanner as a filter, the column selection reads NULL.
Here is the script,
$disk = Get-WmiObject Win32_LogicalDisk -Filter "DeviceID='C:'"
[PSCustomObject]@{
DiskLetter = $disk.DeviceID
FreePercent = [math]::Round(($disk.freespace / 1GB) / ($disk.Size / 1GB) * 100)
FreeSpace = [math]::Round($disk.FreeSpace / 1GB)
DiskSize = [math]::Round($disk.size / 1GB)
}
And here is the error that I receive:

Thanks!
Evan
1
Comments
You have to run that Scan Profile against a computer and get data back before you can create a Collection. The columns are built dynamically based on the object that the script emits when you run it on a target.
That was definitely the case. Thanks!