Skip to main content

1E 23.7 (SaaS)

FileSystem.GetHash (deprecated)

Method

GetHash (deprecated)

Module

FileSystem

Library

Core

Action

Returns the hash of a file or directory.

Parameters

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

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

Example

 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");

Platforms

  • Windows

  • Linux

  • MacOS

Notes

This method was deprecated in 3.1. Use GetFileHash and GetDirectoryHash instead.