Skip to content

Retrieves EXIF data properties from digital image files and saves the info to a CSV-file in a defined directory (a Windows PowerShell script).

License

Notifications You must be signed in to change notification settings

auberginehill/get-exif-data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Get-ExifData.ps1

OS: Windows
Type: A Windows PowerShell script
Language: Windows PowerShell
Description:

Get-ExifData reads digital image files and tries to retrieve EXIF data from them and write that info to a CSV-file (exif_log.csv). The console displays rudimentary info about the gathering process, a reduced list is displayed in a pop-up window (Out-GridView, about 30 categories) and the CSV-file is written/updated with over 350 categories, including the GPS tags.

The list of image files to be read is constructed in the command launching Get-ExifData by adding a full path of a folder (after -Path parameter) or by adding a full path of individual files (after -File parameter, multiple entries separated with a comma). The search for image files may also be done recursively by adding the -Recurse parameter the command launching Get-ExifData. If -Path and -File parameters are not defined, Get-ExifData reads non-recursively the image files, which reside in the "$($env:USERPROFILE)\Pictures" folder.

By default the CSV-file (exif_log.csv) is created into the User's own picture folder "$($env:USERPROFILE)\Pictures" and the default CSV-file destination may be changed with the -Output parameter. Shall the CSV-file already exist, Get-ExifData tries to add new info to the bottom of the CSV-file rather than overwrite the CSV-file. If the user wishes not to create any logs (exif_log.csv) or update any existing (exif_log.csv) files, the -SuppressLog parameter may be added to the command launching Get-ExifData.

The other available parameters (-Force, -Open and -Audio) are discussed in greater detail below. Please note, that if any of the individual parameter values include space characters, the individual value should be enclosed in quotation marks (single or double), so that PowerShell can interpret the command correctly.

Homepage: https://github.com/auberginehill/get-exif-data
Short URL: http://tinyurl.com/ycbhtpba
Version: 1.0
Sources: Emojis: Emoji Table
clayman2: Disk Space (or one of the archive.org versions)
Franck Richard: Use PowerShell to Remove Metadata and Resize Images
lamaar75: Creating a Menu (or one of the archive.org versions)
Twon of An: Get the SHA1,SHA256,SHA384,SHA512,MD5 or RIPEMD160 hash of a file
Gisli: Unable to read an open file with binary reader
Fred: select-object | where
Downloads: For instance Get-ExifData.ps1. Or everything as a .zip-file.

Screenshot

screenshot

Parameters

📐
  • Parameter -Path

    with aliases -Directory, -DirectoryPath, -Folder and -FolderPath. Specifies the primary folder, from which the image files are checked for their EXIF data. The default -Path parameter is "$($env:USERPROFILE)\Pictures", which will be used, if no value for the -Path or the -File parameters is included in the command launching Get-ExifData.

    The value for the -Path parameter should be a valid file system path pointing to a directory (a full path of a folder such as C:\Users\Dropbox\). Furthermore, if the path includes space characters, please enclose the path in quotation marks (single or double). Multiple entries may be entered, if they are separated with a comma.

  • Parameter -File

    with aliases -SourceFile, -FilePath and -Files. Specifies, which image files are checked for their EXIF data. The value for the -File parameter should be a valid full file system path pointing to a file (with a full path name of a folder such as C:\Windows\explorer.exe). Furthermore, if the path includes space characters, please enclose the path in quotation marks (single or double). Multiple entries may be entered, if they are separated with a comma.

  • Parameter -Output

    with aliases -OutputFolder and -LogFileFolder. Defines the folder/directory, where the CSV-file is created or updated. The default -Output parameter is "$($env:USERPROFILE)\Pictures", which will be used, if no value for the -Output is included in the command launching Get-ExifData.

    The value for the -Output parameter should be a valid file system path pointing to a directory (a full path of a folder such as C:\Users\Dropbox\). Furthermore, if the path includes space characters, please enclose the path in quotation marks (single or double).

    The log file file name (exif_log.csv) is defined on row 78 with $log_filename variable and is thus "hard coded" into the script. The produced log file is UTF-8 encoded CSV-file with semi-colon as the separator.

  • Parameter -Recurse

    The search for image files is done recursively, i.e. if a folder/directory is found, all the subsequent subfolders and the image files that reside within those subfolders (and in the subfolders of the subfolders' subfolders, and their subfolders and so forth...) are included in the EXIF data gathering process. Please note, that with great many image files, Get-ExifData may take some time to process each and every file.

  • Parameter -SuppressLog

    with aliases -Silent, -Suppress, -NoLog and -DoNotCreateALog. By adding -SuppressLog to the command launching Get-ExifData, the CSV-file (exif_log.csv) is not created, touched nor updated.

  • Parameter -Open

    If the -Open parameter is used in the command launching Get-ExifData and new EXIF data is found, the CSV-file destination folder (which is defined with the -Output parameter) is opened in the default File Manager.

  • Parameter -Force

    The -Force parameter affects the behaviour of Get-ExifData in two ways. If the -Force parameter is used with the...

    1. -Output parameter, the CSV-file destination folder (defined with the -Output parameter) is created, without asking any further confirmations from the end-user. The new folder is created with the command New-Item "$Output" -ItemType Directory -Force which may not be powerfull enough to create a new folder inside an arbitrary (system) folder. The Get-ExifData may gain additional rights, if it's run in an elevated PowerShell window (but for the most cases that is not needed at all).
    2. -Open parameter, the CSV-file destination folder (defined with the -Output parameter) is opened in the default File Manager regardless whether any new EXIF data was found or not.

  • Parameter -Audio

    If the -Audio parameter is used in the command launching Get-ExifData and new EXIF data is found, an audible beep will occur.

Outputs

➡️
  • Displays a summary of the actions in console. Displays a reduced EXIF data list in a pop-up window (Out-GridView). Writes or updates a CSV log file at the path defined with the -Output parameter, if the -SuppressLog parameter is not used.

      Default values:

      Path Parameter Type
      "$($env:USERPROFILE)\Pictures\exif_log.csv" -Output (concerning the folder) CSV log file containing EXIF data
      "$($env:USERPROFILE)\Pictures" -Path The folder where the image files are searched for their EXIF data, if no -Path or -File parameter is used (a non-recursive search).

Notes

⚠️
  • Please note that all the parameters can be used in one get EXIF data command, and that each of the parameters can be "tab completed" before typing them fully (by pressing the [tab] key).

  • The MakerNote EXIF tag is not included, since that's camera maker specific information. For more information, please see for instance the Tag ID 0x927c at EXIF Tags.

Examples

📖 To open this code in Windows PowerShell, for instance:

  1. ./Get-ExifData.ps1
    Runs the script. Please notice to insert ./ or .\ before the script name. Tries to read the EXIF data from image files that reside in the "$($env:USERPROFILE)\Pictures\" folder, since no values for the -Path or -File parameters were defined. Saves or updates the CSV log file (exif_log.csv) at the default -Output folder ("$($env:USERPROFILE)\Pictures\exif_log.csv") - a file that contains all the gathered EXIF info columns/data types. A pop-up window listing a partial list of the EXIF info will open, if image files were read. The console will show rudimentary stats about the EXIF data gathering procedure.
  2. help ./Get-ExifData -Full
    Displays the help file.
  3. .\Get-ExifData.ps1 -Path "C:\Users\Dropbox\" -Output "C:\Users\Dropbox\dc01" -Audio -Open -Recurse -Force
    Runs the script and tries to recursively search for image files at "C:\Users\Dropbox\" and read the EXIF info of the found image files and either (1) update or create the CSV log file (exif_log.csv) at the C:\Users\Dropbox\dc01 folder if the folder exists or (2) create the C:\Users\Dropbox\dc01 folder (and exif_log.csv) without asking any further questions, if the -Output directory doesn't exist (since the -Force was used). Also, since the -Force and -Open parameters were used, the default File Manager will be opened at C:\Users\Dropbox\dc01 regardless whether any image files were read or not. Furthermore, if new image files were indeed read, an audible beep will occur. Also, a pop-up window listing a partial list of the EXIF info will open, if image files were read, and the console will show rudimentary stats about the EXIF data gathering procedure.
  4. Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
    This command is altering the Windows PowerShell rights to enable script execution in the default (LocalMachine) scope, and defines the conditions under which Windows PowerShell loads configuration files and runs scripts in general. In Windows Vista and later versions of Windows, for running commands that change the execution policy of the LocalMachine scope, Windows PowerShell has to be run with elevated rights (Run as Administrator). The default policy of the default (LocalMachine) scope is "Restricted", and a command "Set-ExecutionPolicy Restricted" will "undo" the changes made with the original example above (had the policy not been changed before...). Execution policies for the local computer (LocalMachine) and for the current user (CurrentUser) are stored in the registry (at for instance the HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ExecutionPolicy key), and remain effective until they are changed again. The execution policy for a particular session (Process) is stored only in memory, and is discarded when the session is closed.

    Parameters:

      Restricted Does not load configuration files or run scripts, but permits individual commands. Restricted is the default execution policy.
      AllSigned Scripts can run. Requires that all scripts and configuration files be signed by a trusted publisher, including the scripts that have been written on the local computer. Risks running signed, but malicious, scripts.
      RemoteSigned Requires a digital signature from a trusted publisher on scripts and configuration files that are downloaded from the Internet (including e-mail and instant messaging programs). Does not require digital signatures on scripts that have been written on the local computer. Permits running unsigned scripts that are downloaded from the Internet, if the scripts are unblocked by using the Unblock-File cmdlet. Risks running unsigned scripts from sources other than the Internet and signed, but malicious, scripts.
      Unrestricted Loads all configuration files and runs all scripts. Warns the user before running scripts and configuration files that are downloaded from the Internet. Not only risks, but actually permits, eventually, running any unsigned scripts from any source. Risks running malicious scripts.
      Bypass Nothing is blocked and there are no warnings or prompts. Not only risks, but actually permits running any unsigned scripts from any source. Risks running malicious scripts.
      Undefined Removes the currently assigned execution policy from the current scope. If the execution policy in all scopes is set to Undefined, the effective execution policy is Restricted, which is the default execution policy. This parameter will not alter or remove the ("master") execution policy that is set with a Group Policy setting.
      Notes:
      • Please note that the Group Policy setting "Turn on Script Execution" overrides the execution policies set in Windows PowerShell in all scopes. To find this ("master") setting, please, for example, open the Local Group Policy Editor (gpedit.msc) and navigate to Computer Configuration → Administrative Templates → Windows Components → Windows PowerShell.
      • The Local Group Policy Editor (gpedit.msc) is not available in any Home or Starter edition of Windows.
        1. Group Policy Setting "Turn on Script Execution" PowerShell Equivalent (concerning all scopes)
          Not configured No effect, the default value of this setting
          Disabled Restricted
          Enabled – Allow only signed scripts AllSigned
          Enabled – Allow local scripts and remote signed scripts RemoteSigned
          Enabled – Allow all scripts Unrestricted

    For more information, please type "Get-ExecutionPolicy -List", "help Set-ExecutionPolicy -Full", "help about_Execution_Policies" or visit Set-ExecutionPolicy or about_Execution_Policies.

  5. New-Item -ItemType File -Path C:\Temp\Get-ExifData.ps1
    Creates an empty ps1-file to the C:\Temp directory. The New-Item cmdlet has an inherent -NoClobber mode built into it, so that the procedure will halt, if overwriting (replacing the contents) of an existing file is about to happen. Overwriting a file with the New-Item cmdlet requires using the Force. If the path name and/or the filename includes space characters, please enclose the whole -Path parameter value in quotation marks (single or double):

      New-Item -ItemType File -Path "C:\Folder Name\Get-ExifData.ps1"

    For more information, please type "help New-Item -Full".

Contributing

contributing Bugs: Bugs can be reported by creating a new issue.
Feature Requests: Feature request can be submitted by creating a new issue.
Editing Source Files: New features, fixes and other potential changes can be discussed in further detail by opening a pull request.

www

🌐 Script Homepage
clayman2: Disk Space (or one of the archive.org versions)
Franck Richard: Use PowerShell to Remove Metadata and Resize Images
lamaar75: Creating a Menu (or one of the archive.org versions)
Twon of An: Get the SHA1,SHA256,SHA384,SHA512,MD5 or RIPEMD160 hash of a file
Gisli: Unable to read an open file with binary reader
Fred: select-object | where
Powershell v2 - remove last x characters from a string
EXIF Quick Reference
Shared Samples
EXIF Tags
Read EXIF and determine if the flash has fired
Adding a Simple Menu to a Windows PowerShell Script
The String's the Thing
Snap and Share on Windows Server
ImageFile object
Image Manipulation in PowerShell
Get startup type of Windows service using PowerShell
Get-WmiObject
Using Powershell as a photoshop replacement
Display Detailed Image Information
Get-FileHash
How do I get PowerShell 4 cmdlets such as Test-NetConnection to work on Windows 7?
SHA256CryptoServiceProvider Class
Send the details of a jpg file to an array
Attribute seems to give byte array. How to convert to string?
Handy routine for getting file metadata
Standard Exif Tags
GPS Tags
PowerTip: Use PowerShell to Send Beep to Console
How can I append files using export-csv for PowerShell 2
Remove Unwanted Quotation Marks from CSV Files by Using PowerShell

Related scripts

www Disable-Defrag
Emoji Table
Firefox Customization Files
Get-AsciiTable
Get-BatteryInfo
Get-BingBackgroundImages
Get-ComputerInfo
Get-CultureTables
Get-DirectorySize
Get-HashValue
Get-InstalledPrograms
Get-InstalledWindowsUpdates
Get-PowerShellAliasesTable
Get-PowerShellSpecialFolders
Get-RAMInfo
Get-TimeDifference
Get-TimeZoneTable
Get-UnusedDriveLetters
Get-Windows10LockScreenWallpapers
Java-Update
Remove-DuplicateFiles
Remove-EmptyFolders
Remove-EmptyFoldersLite
Rename-Files
Rock-Paper-Scissors
Toss-a-Coin
Unzip-Silently
Update-AdobeFlashPlayer
Update-MozillaFirefox

About

Retrieves EXIF data properties from digital image files and saves the info to a CSV-file in a defined directory (a Windows PowerShell script).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published