[Solved] File conditions: hidden files?

[PDQ Deploy 17.2.0.0 Enterprise]

Hi,

I have a simple 1-step Deploy task, to run command "powercfg.exe /h off" (turn off Windows hibernation). I have a file condition set to

enter image description here

My task fails when I target it at a machine which I can see has this file on the C: drive.

File Condition(s) not satisfied

      Summary : Exists Condition. . . . . . . . . . . . . . . . . . . . . [Fail]
  File Exists : hiberfil.sys. . . . . . . . . . . . . . . . . . . . . . . [Fail]
              : Condition failed because hiberfil.sys was not found.
 File Version : (not set)


Product Version : (not set)
      Description : (not set)
     Product Name : (not set)
     Company Name : (not set)
            [*] means that the condition was not checked because of previous failures

           Directory : C:\


Include Subdirectories : No
              Also match : 
                Filename : hiberfil.sys

Any idea why this fails? The hiberfil.sys file has the hidden attribute set - is this breaking the task?

0

Comments

3 comments
Date Votes
  • I did some digging and it looks like the File Condition supports hidden files, but not system files. I will open an internal ticket about this, but I doubt this will be changed anytime soon. In the meantime, here's a PowerShell script you can use as a workaround:

    $Hiberfil = Get-ChildItem -Path "$env:SystemDrive\" -Force | Where-Object Name -eq "hiberfil.sys"
    
    if ( $Hiberfil ) {
    
        "Found: $($Hiberfil.FullName)"
        "Size : $($Hiberfil.Length)"
        Exit 10
    
    } else {
    
        "Could not find hiberfil.sys"
    
    }
    
    0
  • If File Conditions don't (and won't in future versions) support system files, it would be nice to see that as the reason in the log files - perhaps a feature for a future version?

    Thanks for the Powershell script. That's great. I have just tested that with success, but replaced Exit 10 with powercfg -h off to actually turn off hibernation. We have some machines with a lot of RAM but small SSD's out there, so removing a 6GB hibernation file from the C drive on machines that don't need the feature is a real help.

    0
  • I am using for years only Command step: powercfg.exe -h off and never failed.

    0

Please sign in to leave a comment.

Didn't find what you were looking for?

New post