# PowerShell File Checksum Integrity Verifier (PsFCIV)

## PowerShell File Checksum Integrity Verifier is a enhanced PowerShell version of legacy Microsoft FCIV.exe tool. PsFCIV is used to track your files integrity status by calculating cryptographic hashes over a file (or files) and writing them into FCIV-compatible XML database.

4 Star
(17)
33,400 times
Storage
12/12/2013

• Rebuild corrupted files?
1 Posts | Last post June 12, 2014
• so now that I've run the app, created the database, run the app later and found out that one of my files has been corrupted ... Now what?, just delete the file because it's corrupted, re-run the utility with the REBUILD option so I can revise my database to now only include non corrupted files? Is there a utility that would say ... rebuild my corrupted file?
• Filenames with no extension
6 Posts | Last post April 02, 2014
• Hi Vadims

Thanks for providing this script.

On testing the script, I noticed files in my folder structure without a file extension are not included in the generated XML database file.

Example

Photo01.gif - would be included with a checksum
Photo01 - would not be included or picked up.

Is there any change I can make to include files that do not have an extension?

Thanks

Andy
• To answer my own question - I changed entries that contained *.* just for *, these were found on lines 446,488,564 and 606 of the code (may vary slightly if you paste into notepad++ or similar)
Seems to work ok and does not try to checksum folders etc with no file extensions, just files.
Thanks again for such a useful script.
• I originally used one asterisk for wildcard, but it didn't worked as expected in certain scenarios. While it works for you, I'll perform additional tests to determine how to resolve this issue.
• Hi Vadim, any news on this question?

I too find that the current version 2.5 is blind for files without extension. This is a drawback for checksumming a large collection of files in deep directory structures. Imho PsFCIV needs to recognize extensionless files out of the box or else the description should contain an appropriate warning...

Still, I really greatly appreciate you took up where MS failed to continue their own tool! Looking forward to seeing yet another version :-)

Thanks a lot,
j.bo
• Please, use a workaround from previous post (replace *.* with single asterisk). I didn't had enough time to work on this issue.
• Ok, I can fix it, however this will remove -Exclude parameter, so you won't be able to exclude items from checking/creation. It is up to you.
• possible bug: files with MD5 not processed
5 Posts | Last post December 12, 2013
• hello Vadim, when running:
$xml = "C:\Users\Administrator\Downloads\fciv-db_lbx-srv-31v.xml"$path = "C:\Tmp"
Start-PsFCIV -Path $path -XML$xml -HashAlgorithm md5 -show ok, bad -debug

the code complains incorreclty with:
"Specified hash algorithm (or algorithms) is not supported. For native FCIV source, use MD5 and/or SHA1."

the root cause is line 468:
you coded an -or between 2 -notcontains:
if ($HashAlgorithm -and$HashAlgorithm -notcontains "sha1" -or $HashAlgorithm -notcontains "md5") { throw ... and I think you'd better have: if ($HashAlgorithm -and ($HashAlgorithm -notcontains "sha1" -and$HashAlgorithm -notcontains "md5")) { throw ...

bug or feature? :-)
• Really??? I have to take a look and let you know.
• I checked the code, it is a bug.

Just one question: is your XML created by original FCIV.exe tool?
• yes, the correct line is:

if ($HashAlgorithm -and$HashAlgorithm -notcontains "sha1" -and $HashAlgorithm -notcontains "md5") {... • fixed in 2.5 • Why is the old fciv.exe creates xml faster and have smaller file? 3 Posts | Last post December 12, 2013 • I am trying to retire the old fciv.exe with this new script but it seems that this script takes a much longer time in creating the xml file and it also has a much bigger file size. This is what I am running (FCIV.exe) D:\RM\CVT_PS\Test_PSFCIV\OldFCIV\fciv.exe "D:\Golden Copy\Program Files\Folder" -r -bp "D:\Golden Copy\Program Files\Folder" -XML "D:\RM\CVT_PS\Test_PSFCIV\OLDFCIV\text.xml" (PsFCIV) Start-PsFCIV -path "D:\Golden Copy\Program Files\Folder" -HashAlgorithm MD5 -xml "D:\RM\CVT_PS\Test_PSFCIV\test.xml" -recurse The xml file size for the old fciv is about 8MB but the one in PSFCIV is 32MB and takes so much longer. Is there any work around on this? I would like to have the PSFCIV to be at least at similar speed or better. Thanks  • 1) XML is larger because FCIV adds only file name and hash value, while I add additional fields like file size and last modification timestamp. Also, PsFCIV supports modern hashing algorithms. I made these changes for performance reasons, because if file size is different, we can skip hash recalculation, because it won't match anymore. 2) it takes longer because of PowerShell. Original fciv was written, I gueess in C++ wich is times faster than c# and C# is times faster than PowerShell, because PowerShell is high-level scripting language. I can't do anything here. Of course, I can revisit the code and try to improve performance by using C# wrappers as much as possible, but in any way PsFCIV will never be faster than fciv.exe, unfortunately. If performance is critical for you, then you should stay with fciv.exe or other tools. • I just uploaded a new version, which generates a smaller XML file and which should be a bit faster than previous version. This is all I can do. If it is not enough fast for you, then use my previous recommendation -- stay with original FCIV tool. • Why am I getting multple runtime exceptions errors on my screen? 11 Posts | Last post November 18, 2013 • Hi! I am fairly new to Powershell and I am trying to figure out how to use your fciv but I get this error when I run a simple script function. It works fine and I see if they are good files or bad files but why do these errors appear? I am running powershell 2.0. Thanks start-PsFCIV -path C:\temp -XML test.xml -recurse Exception setting "VerboseForegroundColor": "Cannot convert value "Black" to type "System.Windows.Media.Color". Err or: "Invalid cast from 'System.ConsoleColor' to 'System.Windows.Media.Color'."" At C:\Users\JocsonJo\Desktop\MyFiles\CVT_PS\PsFCIV.ps1:537 char:23 +$host.PrivateData. <<<< VerboseForegroundColor = $host.UI.RawUI.ForegroundColor + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : PropertyAssignmentException Method invocation failed because [System.Security.Cryptography.SHA1CryptoServiceProvider] doesn't contain a method named 'Dispose'. At C:\Users\JocsonJo\Desktop\MyFiles\CVT_PS\PsFCIV.ps1:241 char:18 +$hasher.Dispose <<<< ()
+ CategoryInfo          : InvalidOperation: (Dispose:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
• I only see the exception error if I run it in PS ISE but the method still shows when I run it in just PS.

Method invocation failed because [System.Security.Cryptography.SHA1CryptoServiceProvider] doesn't contain a method
named 'Dispose'.
At C:\Users\JocsonJo\Desktop\MyFiles\CVT_PS\PsFCIV.ps1:241 char:18
+         $hasher.Dispose <<<< () + CategoryInfo : InvalidOperation: (Dispose:String) [], RuntimeException + FullyQualifiedErrorId : MethodNotFound Method invocation failed because [System.Security.Cryptography.SHA1CryptoServiceProvider] doesn't contain a method named 'Dispose'. At C:\Users\JocsonJo\Desktop\MyFiles\CVT_PS\PsFCIV.ps1:241 char:18 +$hasher.Dispose <<<< ()
+ CategoryInfo          : InvalidOperation: (Dispose:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound

Method invocation failed because [System.Security.Cryptography.SHA1CryptoServiceProvider] doesn't contain a method
named 'Dispose'.
At C:\Users\JocsonJo\Desktop\MyFiles\CVT_PS\PsFCIV.ps1:241 char:18
+         $hasher.Dispose <<<< () + CategoryInfo : InvalidOperation: (Dispose:String) [], RuntimeException + FullyQualifiedErrorId : MethodNotFound Method invocation failed because [System.Security.Cryptography.SHA1CryptoServiceProvider] doesn't contain a method named 'Dispose'. At C:\Users\JocsonJo\Desktop\MyFiles\CVT_PS\PsFCIV.ps1:241 char:18 +$hasher.Dispose <<<< ()
+ CategoryInfo          : InvalidOperation: (Dispose:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
• 1) I do not support PowerShell ISE and there are no plans to support ISE.
2) You need .NET 4.0 installed, because Dispose() method exist there only starting with .NET 4.0
• Will this be a problem at some point if I do not have .NET 4.0 installed? OR can this be ignored and the script function will still run perfectly at any circumstances.
• yes, when you install .NET 4.0 errors should disappear. And, of course, run the command in PowerShell console.
• Vadims,

So if I do not have .NET 4.0 it means that I will not be able to use this? I see that it still works and spits out the xml and compares it but I am worried that this could cause problems on the servers when the script is running or can this errors be ignored?

My situation in the meantime is that the servers that I want to run the script do not have .NET 4.0 yet and it might take sometime to actually install the version since I do not have control over it in my workplace.

Thanks
• Right now in the box that I am running I see that in C:\Windows\Microsoft.NET\Framework64 folder
I have v4.0.30319 but and if I look at my control panel add/remove programs it does say I have Microsoft .NET Framework 4.5 so I am quite puzzled why I still see these errors on my own box.
• Can you tell what errors you experience now?
• The same thing. I mean it does work but I am just confused on why the errors still comes up even though I checked that I have .NET 4.0 framework. This is not urgent so you can take your time in answering. Thank You

Method invocation failed because [System.Security.Cryptography.SHA1CryptoServic
eProvider] doesn't contain a method named 'Dispose'.
At C:\Users\JocsonJo\Desktop\MyFiles\CVT_PS_Copy\PsFCIV.ps1:241 char:18
+         $hasher.Dispose <<<< () + CategoryInfo : InvalidOperation: (Dispose:String) [], RuntimeEx ception + FullyQualifiedErrorId : MethodNotFound Method invocation failed because [System.Security.Cryptography.SHA1CryptoServic eProvider] doesn't contain a method named 'Dispose'. At C:\Users\JocsonJo\Desktop\MyFiles\CVT_PS_Copy\PsFCIV.ps1:241 char:18 +$hasher.Dispose <<<< ()
+ CategoryInfo          : InvalidOperation: (Dispose:String) [], RuntimeEx
ception
+ FullyQualifiedErrorId : MethodNotFound
• I updated the download code. Can you canfirm whether new version Works for you?
• Vadims,

Yes it does not show any errors anymore. Thank you very much :)
• How can I log the bad files?
2 Posts | Last post October 24, 2013
• Sorry for bothering you but I would like to know how can I log the bad files to a text file?

I tried using the "-show bad" and it works but I do not want to see it in grid view. I want to be able to log the fullpath and name of all the bad files similar to the old fciv.exe where it outputs the files.

If you can give me a simple example that would great. Thank you very much!


• Yeah this Parameter is named a bit misleading ;)
But while the script is processing it also writes each category to a global variable $Global:Stats that you can use for further processing. [10:54:38 C:\\Temp2]>$global:Stats

Total   :
New     :
Ok      :
Missed  :
Locked  :
Unknown :
Del     : 0

[10:54:49 C:\\Temp2]> $global:Stats.Bad httpd.conf Here only my apache config has changed since last copy Hope that helps :) • Hi 2 Posts | Last post August 30, 2013 • Hash Signing Creation using : Start-PsFCIV -Path “C:\packagedfolder” –XML packagedfolder.XML –HashAlgorithm SHA1, SHA256, SHA512 –Recurse. Hash Signing Validation using : Start-PsFCIV -Path “C:\packagedfolder” –XML packagedfolder.XML –HashAlgorithm SHA1, SHA256, SHA512 –Recurse –show Ok,Bad. Ever-thing Works Perfect. But for few files While Validation time difference is one hour difference due to Day Light Savings. File Time in India is : November ‎01, ‎2011, ‏‎1:32:14 PM File Time in France is : November 01,2011 , 2:32:14 PM Could you please help me to fix this issue.  • Sorry for the delay. I never received a notification of your question. It easy to fix. Just find all instances of "LastWriteTime" and replace them with "LastWriteTime.ToUniversalTime()". You can use any editor that supports find/replace. There are 3 places where you need to replace them. • Can't get it to work 4 Posts | Last post May 10, 2013 • Method invocation failed because [System.Security.Cryptography.SHA1CryptoServiceProvider] doesn't contain a method nam d 'Dispose'. At C:\Users\multifront-build\Desktop\PsFCIV_2.1.ps1:241 char:18 +$hasher.Dispose <<<< ()
+ CategoryInfo          : InvalidOperation: (Dispose:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound

• make sure if you have .NET framework 4.0 installed.
• It is installed
• Can't tell what the problem is. I never heard about this error. Also, the method exist: http://msdn.microsoft.com/en-us/library/dd289076(v=vs.100).aspx
what OS you are running?
• Found a bug..?
2 Posts | Last post February 06, 2013
• Hello Vadims Podans,

First of, appreciate your great effort in putting this to shape. Like you said, Microsoft is no longer interested in the checksum utility. That is where your script is standing as a blessing!

I was looking for a hashing mechanism which supports SHA256 algorithm and finally google took you to your post.

When I started analysing your tool, I found an a defect (?) in the functionality. Where in when I follow the steps below,

1. Run PsFCIV against a folder containing 2 files
2. Add a 3rd file to the folder.
3. Verify the hash against the hash xml created in step 1 with -show OK, Bad switch.

I expected the script to tell me that there is 1 file newly added.
But the script says 0 files added newly.

Is this something which you have noticed...?
Or is there anything wrong in my steps or in my understanding of the total functionality of the script.

PS: All my other test cases works like charm on this script :)
• This is expected behavior. By default, if there already is XML file, only entries from tha XML are processed. In order to refresh the XML, you have to use -Rebuild switch. In this case, new files will be added to XML and entries for non-existent files are removed from XML. This is by design.
21 - 29 of 29 Items