Scan Freespace of Physical Disk
Hi there,
We have about 2'000 imaged Computers (with Virtual disks).
With the Basic scan profiles in PDQ Inventory, we are only able to analyze the freespace of Logical Drive (eg. Drive C:). But we have to check the freespace of the physical drive.
Powershell example:
Get-WMIObject Win32_Volume -filter “DriveType=3” | Select SystemName,Caption,Label,@{Name=”DiskSize(GB)”;Expression={[decimal](“{0:N1}” -f($_.capacity/1gb))}},@{Name=”freespace(GB)”;Expression={[decimal](“{0:N1}” -f($_.freespace/1gb))}},@{Name=”PercentFree”;Expression={“{0:P2}” -f(($_.freespace/1gb)/($_.capacity/1gb))}} | Where {$_.Caption -eq “C:\”} | sort-object -Property PercentFree | ft -autosize
Is it possible, to run this script above as a Scan and safe the result of "PercentFree" in a variable (eg. for further use in a Report)?
Thank you for your help.
Best regards,
Andreas
Comments
I think your best bet would be to use "PDQInventory.exe ImportCustomFields". You will need to save the data to a CSV file and import it into a Custom Field with that command.
Thank you for your idea.
If I have understood correctly, we have to scan our computers by running the mentioned Powershell command (outside of PDQ Inventory) and after this, we have to import the results to PDQ Inventory?
Hmm, I had rather hoped, that we can use the "custom Tools" in PDQ Inventory (http://documentation.adminarsenal.com/PDQInventory/10.1.0.0/index.html?using-custom-tools.htm) . But I don't know how to save eg. PercentFree in a Custom Field of PDQ Inventory.
Best regards,
Andreas
This likely *could* be done with a custom tool, but you'll still be leveraging pdqinventory.exe and not a scanner to complete the task.
What you'd want to do is create a new object for each machine you are running the code against which 2 NoteProperties: ComputerName and FreeSpace.
Next you would pipe the values of that object to a CSV file
(Think:
)
Then you would create another block of code that leverages pdqinventory.exe to bring that custom field data back into Inventory.
Custom Fields are setup in Preferences in Inventory here:
This documentation should get you started with understanding how custom fields work:
https://www.adminarsenal.com/blog/adding-your-own-custom-data-to-pdq-inventory/
And here is some further documentation on Importing through the PDQ interface:
http://documentation.adminarsenal.com/PDQInventory/12.2.0.0/
I'm not up to speed on the pdqinventory sql tables, so maybe Colby or Shane could be of better help as far as building out the query and or use of the ImportCustomFields command line tool. I'd hate to take an untested guess at it and be wrong.
@Bohren
I'm a little confused about what you're looking for. The PowerShell example you provided seems to grab the same information PDQ does. Are you looking for unpartitioned space on the disks? Once I understand exactly what you're looking for I will put together a Tool for Inventory.
This is what I have so far based on what I think you're asking for. It's a SQL report. The biggest flaw is that Inventory doesn't scan special partitions like System Reserved, so this will always report Free Space > 0 for the system drive of computers >= Vista. I will put in a feature request for that.
Physical Disk Free Space.xml
It's a little easier to read with some syntax highlighting:
Hi there
Thank you, Stephen and Colby, for your informations and your efforts! That's really kind of you!
@Colby: Sorry for confusing. My english is really bad - I know :-( - but I try to explain our problem again :-)
We have several computers with SSD Harddisks (size of 112 GB) inside. With an Imaging tool, we have created a Master image and deployed this on these computers.
This basic image comes standard with an approx. size of 36 GB. Because of the Snapshot technology, each change on the imaged Computer (ex. creating of user profiles, installation of applications etc.) will increase (or grow up) the basic image.
The size of the Logical Drive does not change, but the snapshot components creates additional files and saves these also on the harddisk.
In fact, not only the image file is stored on the harddisk, but also the snapshot files. Therefore, the free space on the hard disk shrinks and shrinks.
The next deployment of master images, we will do without this snapshot technology. Until this deployment, the existing imaged computers have to been monitored. When the hard disk is full, a start of the computer is no more possible. So I have to act proactively.
In your SQL query, Colby, you create (if I have understood correctly) a difference between the size of the physical and the logical drive. Because the logical drive size of 110 GB does not change, this report shows me for the most of the concerned systems a value (free size) of 125 MB.
I will also try the solution from Stephen and let you know, if I have found a solution.
Thank you again!
Best regards,
Andreas
Your English isn't bad at all! You just have an unusual situation and I wasn't sure what you were trying to ask for :)
What is the name of this imaging software? If we understand how it works we will be more capable of helping you. When you said Virtual Disks in your original post I thought you were talking about virtual machines :) This sounds way more interesting.