Skip to content

Instantly share code, notes, and snippets.

$path = "\\path\to\file\msoidcli_64bit.msi"
$comObjWI = New-Object -ComObject WindowsInstaller.Installer
$MSIDatabase = $comObjWI.GetType().InvokeMember("OpenDatabase","InvokeMethod",$Null,$comObjWI,@($Path,0))
$Query = "SELECT Value FROM Property WHERE Property = 'ProductCode'"
$View = $MSIDatabase.GetType().InvokeMember("OpenView","InvokeMethod",$null,$MSIDatabase,($Query))
$View.GetType().InvokeMember("Execute", "InvokeMethod", $null, $View, $null)
$Record = $View.GetType().InvokeMember("Fetch","InvokeMethod",$null,$View,$null)
This file has been truncated, but you can view the full file.
Function Install-ADAuthenticationLibraryforSQLServer {
$workingFolder = Join-Path $env:temp ([System.IO.Path]::GetRandomFileName())
New-Item -ItemType Directory -Force -Path $workingFolder
$fileName = 'adalsql.msi'
$Installer = Join-Path -Path $WorkingFolder -ChildPath $fileName
@bjh1977
bjh1977 / Install-NugetFromNugetOrg.ps1
Created October 3, 2018 11:27
Gets nuget from nuget.org. Either the latest or a sprecific version
function Install-NugetFromNugetOrg {
<#
.Synopsis
Gets nuget from nuget.org
.Description
Gets nuget from nuget.org. Either the latest or a sprecific version
.Parameter RequiredVersion
The version as seen on www.nuget.org
.Parameter RootFolder
The root folder where nuget will be copied to
@bjh1977
bjh1977 / Install_Nuget_exe_to_temp_folder.ps1
Created March 26, 2018 15:00
Install the latest version of Nuget to current user's temp folder
$InstallDir = join-path $env:temp 'Nuget'
if (Test-Path $InstallDir) {
Remove-Item -Path $InstallDir -Recurse -Force
}
New-Item -Path $InstallDir -ItemType Directory -Force | Out-Null
# grab nuget commandline from internet
@bjh1977
bjh1977 / CreateAADApplication.ps1
Last active October 25, 2020 05:33
Create AAD Application, Azure Key Vault, Azure Key Vault Key, Rights to Vault from Application (created for use with Extensible Key Management Using Azure Key Vault (SQL Server))
param (
[string]$Version = $( Read-Host "Input version" ),
[string]$DomainName = $( Read-Host "Input domain name" ),
[string]$ApplicationName = $( Read-Host "Input application name" )
)
$ApplicationURI = $("https://$DomainName/$ApplicationName")