Free disk space check prior to package deploy

Comments

11 comments

  • Stephen Valdinger

    I'd create a collection based on Free Disk space, and then Deploy to that collection. This is of course if you are using PDQ Inventory.

    0
    Comment actions Permalink
  • Support

    Stephen, yes of course, if utilizing PDQ Inventory but I was looking for a method for those who only have PDQ Deploy or are running Deploy independently of Inventory.

     

    Thanks,

    0
    Comment actions Permalink
  • Brandon Bunnelle

    This would be something to add over on the "Feature Request" section.

    If you don't have PDQ Inventory, you can use a Powershell script that's would query your domain PC's and report back "Disk Space" for manual tracking.

    PDQ Inventroy makes this a breeze to manage though.

    0
    Comment actions Permalink
  • Colby Bouma

    You could add a PowerShell step that gathers the FreeSpace,

    $FreeSpace = ( Get-WmiObject Win32_LogicalDisk | Where-Object { $_.DeviceID -eq $env:SystemDrive } ).FreeSpace

    New-ItemProperty -Path "HKLM:\HARDWARE" -Name "System Drive Free Space" -PropertyType "Qword" -Value $FreeSpace -Force

    then use a Registry Condition on your step(s) to check it.

    0
    Comment actions Permalink
  • Support

    I do have inventory and have a collection that distinguishes free space but I have neither been using it as a filter in every collection nor as a higher level of the drill down hierarchy.  I have used many other deployment tools, Landesk, SMS (SCCM), etc. that had this type of feature and did also submit it as a feature request.  I sometimes use PDQ Deploy independently and I imagine there may be some that do not have the Inventory piece so was interested in what people were doing prior to spending too much time attempting to architect my own cobbled together workaround and I believe Colby's proposal  above to be an excellent method to base a temporary solution upon until such time as AA may see fit to include this feature natively.  

     

    Thank you all and Thank you specifically Colby!

    0
    Comment actions Permalink
  • Support

    Colby,

    I wanted to get your input on my findings thusfar attempting to utilize your suggestion.  I added the following line to the powershell since there seems to be a numerical limit on digits type into the number condition to check the registry and the check does find the gb of space but even though I have stop deployment with error enabled and the output log shows the lines below the deployment still continues to the next step and shows as completed successfully.  Is this behavior expected?  Do I need to add this check to every step in the deployment?  And how would I know that the deployment failed if it continues and ends up stating success?

    $Freespace = [Math]::Round($FreeSpace / 1073741824, 2)

     

    Value : > 100. . . . . . . . . . . . . . . . . . . . . . [Fail]
    Value = 96
    : Condition failed because 100 was not found.

    0
    Comment actions Permalink
  • Stephen Valdinger

    Colby didn't do math.

     

    $FreeSpace = ( Get-WmiObject Win32_LogicalDisk | Where-Object { $_.DeviceID -eq $env:SystemDrive } ).FreeSpace

     

    Change it to this: 

    $FreeSpace = ( Get-WmiObject Win32_LogicalDisk | Where-Object { $_.DeviceID -eq $env:SystemDrive } ).FreeSpace / 1MB [or /1GB for gb free]

    You'll notice the number is much smaller, and within the limit.
    0
    Comment actions Permalink
  • Support

    Stephen, thanks for the quick reply.  That should simplify the command well but I am still stuck on the issue of the deployment stating success when the step is failed and stop deployment with error enabled.  So, it seems if I enabled this condition on every step in a deployment all of the steps would be skipped but the deployment would report as successful.  I was hoping to be able to run a condition on the first step or 2 of a deployment and have the deployment fail out immediately on any machine that did not have the entered free space.

    0
    Comment actions Permalink
  • Stephen Valdinger

    Ah, I guess I misinterpreted the crux of the problem here. I apologize about that. That's interesting that it is continuing to report Success.

    Is your first step checking size, and putting it in the registry, and then the Second step checking that registry entry as a condition?

    I believe because the first step succeeds, and the second step is just "Skipped to to registry condition", it will still report success. I believe that is the issue. I'm not sure how to combat that though.

    0
    Comment actions Permalink
  • Colby Bouma

    Hmm, interesting. I think the best way to achieve what you want is to move the Condition logic into the PowerShell step.

    $FreeSpace = ( Get-WmiObject Win32_LogicalDisk | Where-Object { $_.DeviceID -eq $env:SystemDrive } ).FreeSpace / 1GB
    if ( $FreeSpace -lt 100 ) {

    Write-Output $FreeSpace
    Exit 1

    }

    Conditions can't cause a Failed status, they can only skip the step they apply to.

     

    0
    Comment actions Permalink
  • Support

    Colby,

    Just tested and that works well.  I greatly appreciate your assistance.

    Thanks so much

    0
    Comment actions Permalink

Please sign in to leave a comment.