This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$path_ = "C:\" | |
$list = @(Get-ChildItem -Path $path_ -Name "SolarWinds.Orion.Core.BusinessLayer.dll" -Recurse) | |
$list | % { | |
$fullPath = $path_ + $_ | |
Get-FileHash $fullPath -Algorithm SHA256 | Format-List | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Name of module | |
# | |
# Internal | |
# | |
[Array]$Internal = 'NameOfScript', | |
'NameOfScript ' | |
if ($Internal.Count -ge 1) { | |
$Internal | ForEach-Object { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example 1 - Catch the exception that would have been thrown after a method such as connecting to a SQL database / failed network connection | |
$errorRecord = New-Object System.Management.Automation.ErrorRecord( | |
$_.Exception, | |
'SmallOneWordDescriptionOfError', (e.g.ConnectionFailureToDBName) | |
[System.Management.Automation.ErrorCategory]::ConnectionError, | |
$myinvocation | |
) | |
$pscmlet.ThrowTerminatingError($errrorRecord) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get Hash of Current script | |
$script = $MyInvocation.ScriptName | |
$md5 = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider | |
$hash = [System.BitConverter]::ToString($md5.ComputeHash([System.IO.File]::ReadAllBytes($script))) |