Version: 9



GetHash (deprecated)


Returns the hash of a file or directory.


Path (string; optional): The full path of the file or a directory.

The Path parameter name is only available from v3.0.100 onwards.

Prior to v3.0.100, FileName must be used instead.  While the earlier name will still work, we recommend that, from v3.0.100 onwards, Path is used instead.

Algorithm (string): Which algorithm to use to perform the hashing. Possible values: 

    • SHA1
    • SHA256
    • MD5
Return values

If a directory is named, the following are returned:

    • DirectoryName (string): The full path of the directory
    • DirectorySizeBytes (int): The total size of the all files in the directory
    • DirectoryHash (string): The SCCM2012 folder hash, as there is no standard method of calculating folder hashes. On non-Windows machines, this returns a hash that is different to those calculated on a Windows machine for the same data, but the result is consistent. This is typically intended to be used to check a folder's contents against another's.

Otherwise, if a file is named, the following are returned:

    • FileName (string): The full path of the file
    • FileSizeBytes (int): The size of the file in bytes
    • FileHash (string): The hash of the file
This uses the newer Path parameter name. Replace with FileName for v3.0.100 and older.
 FileSystem.GetHash(Path:"C:\\tmp\\ips.txt", Algorithm:"MD5");
 FileSystem.GetHash(Path:"C:\\tmp\\ips.txt", Algorithm:"SHA1");
 FileSystem.GetHash(Path:"C:\\tmp", Algorithm:"SHA256");
  • Windows
  • Linux
  • MacOS
  • Solaris Intel
  • Solaris Sparc
  • Android

 This method is deprecated; use GetFileHash and GetDirectoryHash instead.