Skip to content

Instantly share code, notes, and snippets.

View huyttq's full-sized avatar

Huy Thái huyttq

  • Perth, Australia
View GitHub Profile
@huyttq
huyttq / RestoreDbWithReplace.sql
Last active July 11, 2018 06:26
Restore MS SQL Server DB with replace
use [master]
Declare @BackupFileLocation varchar(max)
Declare @BackupMDFFileName varchar(max)
Declare @BackupLogFileName varchar(max)
Declare @ImportTesterMDFFileName varchar(max)
Declare @ImportTesterLogFileName varchar(max)
set @BackupFileLocation =
N'\\file-path\bk.bak'
@huyttq
huyttq / Import-PfxCertificate.ps1
Created October 2, 2019 08:04 — forked from deadlydog/Import-PfxCertificate.ps1
PowerShell script that imports a .pfx certificate file. Useful to do before building the solution on a build server.
param($PfxFilePath, $Password)
$absolutePfxFilePath = Resolve-Path -Path $PfxFilePath
Write-Output "Importing store certificate '$absolutePfxFilePath'..."
Add-Type -AssemblyName System.Security
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$cert.Import($absolutePfxFilePath, $Password, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]"PersistKeySet")
$store = new-object system.security.cryptography.X509Certificates.X509Store -argumentlist "MY", CurrentUser
$store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::"ReadWrite")