

Powershell # Import json file and create ps objects $JsonObj = Get-Content -Path C : \ ExampleFile. I'm pasting my MD5 hash generation code below. I can't figure out how I can integrate it here. However, I need to check the source and destination of each object in this case. The same will happen for Samsung and others.įor now, the MD5 hash comparison PS script just generates the CSV files in the two desired directories and compares them.
#POWERSHELL JSON QUERY FULL#
So for instance if the destination path is: `C:\\Destination\\Mobile Phones\\` and the source path is `C:\\Source\\Mobile Phones\\` and `OnePlus` has `6T` as source and `Model\\6T` as destination, that means that the Powershell Installer will have the full path `C:\\Destination\\Mobile Phones\\Model\\6T` as the destination, and `C:\\Source\\Mobile Phones\\6T` as the source. It's supposed to have the destination and source files. For example, the JSON file below is of the similar nature as the one I have. However, I now need to take the path from the JSON configuration files. In my original scripts, the user would type the path of the source and destination which needed to be compared. The installer saves the configurations (path, ports, new files to be made etc etc) in a JSON format. Now, I need to integrate these scripts in another one, which is basically a Powershell Installer. The other compares the MD5 hashes from the two CSV files and generates a new one, showing the result(whether a file is absent from source or destination). One generates the MD5 hashes of two directories (source and destination) and stores them in a csv file.

I have two scripts that I have tested and they work fine.

#POWERSHELL JSON QUERY HOW TO#
I can't figure out how to integrate my current PowerShell script with the JSON file that contains the information (File Name, full path) etc. I want to use the paths in that manner and pipe them into `Get-FileHash` in PowerShell. The paths in the JSON file are written in the format that I have stated below. I need to integrate a JSON file which contains paths of the different objects in a PS script that generates and compares the hash files of source and destination.
