Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Verify If File Changes by Computing Hash

$
0
0

Summary: Use Windows PowerShell and compute a hash to verify if a file changes.

Hey, Scripting Guy! Question How can I use Windows PowerShell in Windows 8.1 to ensure that my Windows PowerShell profile
          does not change without me knowing it?

Hey, Scripting Guy! Answer Use the Get-FileHash cmdlet and store the returned object somewhere (for example, export it
          to an XML file, or store the hash in a file or in the registry). When you suspect changes, use the 
          Get-FileHash cmdlet again, and compare the two objects by using the Compare-Object cmdlet:

$hash = Get-FileHash $profile

$hash1 = Get-FileHash $profile

Compare-Object $hash $hash1 -Property hash

Note  If nothing has changed, nothing returns.


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>