Skip to content

Instantly share code, notes, and snippets.

View RichieBzzzt's full-sized avatar

Richie Lee RichieBzzzt

View GitHub Profile
$my_variable = "this is the value of my_variable"
if (Test-Path variable:my_variable) {
Write-Host $my_variable -ForegroundColor Magenta -BackgroundColor Yellow
else {
Write-Host 'Variable $my_variable does not exist.' -ForegroundColor Yellow -BackgroundColor Magenta
#note: my_non_existent_variable doesn't exist, so will go to else statement
$msbuild = "C:\Windows\Microsoft.Net\Framework\v4.0.30319\MSBuild.exe"
$MsBuilExists = Test-Path $msbuild
If ($MsBuilExists -ne $true) {write-host "msbuild does not exist at this location. Install Visual Studio 2015 (Community Edition should be adequate)"}
$buildFile = "C:\Users\Richie\Documents\ssis_guy\build_ssis.proj"
& $msbuild $buildFile
Microsoft Visual Studio 2017 Version 15.0.26430.6.
Copyright (C) Microsoft Corp. All rights reserved.
Some errors occurred during migration. For more information, see the migration report:
========== Rebuild All: 0 succeeded, 0 failed, 0 skipped ==========
Build succeeded.
0 Warning(s)
0 Error(s)
<Target Name="AfterGet">
<CallTarget Targets="DevEnvInstaller">
$sql_connection_string = "SERVER=.;Integrated Security=True;Database=master"
$sql_connection = new-object System.Data.SqlClient.SqlConnection ($sql_connection_string)
try {
return $sql_connection.Database
catch {
Write-Error $_.Exception
Function Test-DownloadUri {
Tests that a url is valid
Returns a status code from an http request of a url. Used to verify that download links work.
The url that we are checking is valid
Set-Location "/home/<whatisyourlinuxuser>/sqltoolservice/"
$Assem = (
Set-Location "/home/richie/sqltoolservice/"
$Assem = (
function Connect-AzureRmSubscription (
) {
[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
if ($null -eq $AzureSubscriptionId -or $null -eq $AzureSubscriptionUsername -or $null -eq $AzureSubscriptionPassword) {
throw "The variable set for Azure Subscription information has not been added or the SubscriptionId, SubscriptionName, AzureSubscriptionUsername and AzureSubscriptionPassword variables have not been set for this environment"
Function Get-FrequencyIntervalValue {
[int]$Value = 0
if (($Freq -contains "Sunday") -eq $True) {$Value = $Value + 1}