File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -2,15 +2,15 @@ Function Get-TimeStampServer {
22[CmdletBinding ()]
33Param (
44[Parameter (HelpMessage = " List of known good timestamp servers" )]
5- $TimeStampServers = @ (" http://ca.signfiles .com/tsa/get.aspx " , " http://timestamp.globalsign .com/scripts/timstamp.dll " )
5+ $TimeStampServers = @ (" http://timestamp.globalsign .com/scripts/timstamp.dll " , " http://ca.signfiles .com/tsa/get.aspx " )
66)
77$TimeStampHostnames = $TimeStampServers -Replace (" ^http:\/\/" , " " ) -Replace (" \/.*" , " " ) # Isolate hostnames for Test-NetConnection
88$Count = ($TimeStampHostnames.Count - 1 )
99For ($i = 0 ; $i -le $Count ; $i ++ ) {
1010Try {
1111If ([bool ](Test-NetConnection $TimeStampHostnames [$i ] - Port 80 | Select-Object - ExpandProperty TcpTestSucceeded)) {
1212Write-Verbose " $ ( $TimeStampHostnames [$i ]) selected"
13- $TimeStampServer = $TimeStampServers [$i ]
13+ $script : TimeStampServer = $TimeStampServers [$i ]
1414Break # Once we find a valid server, stop looking.
1515}
1616}
@@ -46,6 +46,12 @@ Param(
4646$CertFriendlyName = $PSBoundParameters.CodeSigningCertName
4747}
4848Process {
49+ Try {
50+ Get-TimeStampServer
51+ }
52+ Catch {
53+ Write-Error " TimeStampServer could not be reached"
54+ }
4955Write-Verbose $CertFriendlyName
5056$CodeSigningCert = Get-ChildItem Cert:\CurrentUser\My | Where-Object FriendlyName -like $CertFriendlyName
5157Set-AuthenticodeSignature - Certificate $CodeSigningCert - TimestampServer $TimeStampServer - HashAlgorithm SHA256 - FilePath $BinPath
You can’t perform that action at this time.
0 commit comments