added func Get-StringHash

This commit is contained in:
2024-07-15 13:30:29 -04:00
parent 659f03bf3a
commit 2885d975f4
+8
View File
@@ -1106,6 +1106,14 @@ Function New-TicketTimerEntry () {
Create-Syncro-Ticket-TimerEntry -TicketIdOrNumber $TicketID -StartTime $StartAt -DurationMinutes $BillableMinutes -Notes $Comment -UserIdOrEmail $BillableUser -ChargeTime $ChargeTime
}
# Function to get the SHA256 hash of a string
Function Get-StringHash() {
param([Parameter(Mandatory=$true,ValueFromPipeline=$true)][string]$String)
$stream = [IO.MemoryStream]::new([byte[]][char[]]$String)
$hashObj = Get-FileHash -InputStream $stream -Algorithm SHA256
$hashObj.Hash
}
# Initial setup of the MSP management directories and log file
Setup-MSPDirectories
Setup-LogFile