Posted On February 4, 2020

PowerShell: An Exercise in Calculating Checksums

kimconnect 0 comments
blog.KimConnect.com >> Codes >> PowerShell: An Exercise in Calculating Checksums
$out = new-object byte[] 1073741824; #1GB
(new-object Random).NextBytes($out);
[IO.File]::WriteAllBytes($dummyFile, $out);

Measure-command{$hash=jacksum -a crc8 -x $dummyFile}
write-host $hash

# New Server
PS C:\Windows\system32> measure-command{$hash=jacksum -a crc8 -x $dummyFile}
Days : 0
Hours : 0
Minutes : 0
Seconds : 4
Milliseconds : 140
Ticks : 41406433
TotalDays : 4.79241122685185E-05
TotalHours : 0.00115017869444444
TotalMinutes : 0.0690107216666667
TotalSeconds : 4.1406433
TotalMilliseconds : 4140.6433
PS C:\Windows\system32> write-host $hash
eb 1073741824 D:\Test\dummyFile.txt

# Old Server
Days : 0
Hours : 0
Minutes : 0
Seconds : 3
Milliseconds : 725
Ticks : 37256354
TotalDays : 4.31207800925926E-05
TotalHours : 0.00103489872222222
TotalMinutes : 0.0620939233333333
TotalSeconds : 3.7256354
TotalMilliseconds : 3725.6354
PS C:\Users\176233> write-host $hash
a3 1073741824 E:\Test\dummyFile.txt

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

PowerShell: Microsoft Exchange Active Directory Integration

Assuming that Exchange is already set and in production, it's often advisable to record its…

PowerShell: Add New Virtual Disk to Existing Guest VM in Hyper-V

# Adding disks (optional) $newVMNames='TestWindows2019' $extraDiskSize='200GB' if($extraDiskSize){ foreach($newVmName in $newVMNames){ STOP-VM -vmname $newVmName $diskFile=(join-path $destinationFolder…

PowerShell: Check if a HostName is Resolvable on All Internal DNS Servers

# Check if servername is resolvable at all DCs$serverName="MIGRATED-SHERVER" function checkDns{ param( $serverName, $dnsServers=(Get-ADDomainController -Filter…