Skip to content

Instantly share code, notes, and snippets.

View RichieBzzzt's full-sized avatar
🦆
Sirfetch'd

Richie Lee RichieBzzzt

🦆
Sirfetch'd
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:
C:\Users\Richie\Documents\ssis_guy\UpgradeLog3.htm
========== Rebuild All: 0 succeeded, 0 failed, 0 skipped ==========
Build succeeded.
0 Warning(s)
0 Error(s)
cls
Set-Location "/home/richie/sqltoolservice/"
$Assem = (
"Microsoft.SqlServer.Management.Sdk.Sfc",
"Microsoft.SqlServer.Smo",
"Microsoft.SqlServer.ConnectionInfo"
);
cls
Set-Location "/home/<whatisyourlinuxuser>/sqltoolservice/"
$Assem = (
"Microsoft.SqlServer.Management.Sdk.Sfc",
"Microsoft.SqlServer.Smo",
"Microsoft.SqlServer.ConnectionInfo"
);
function Connect-AzureRmSubscription (
$AzureSubscriptionId,
$AzureSubscriptionUsername,
$AzureSubscriptionPassword
) {
[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 {
[CmdletBinding()]
param
(
[string[]]
[ValidateNotNullorEmpty()]
$Freq
)
[int]$Value = 0
if (($Freq -contains "Sunday") -eq $True) {$Value = $Value + 1}
Function Get-DaysofWeek {
[CmdletBinding()]
param
(
[System.Collections.Generic.List[Int]]
[ValidateNotNullorEmpty()]
$Enum
)
$daysofWeek = New-Object "System.Collections.Generic.List[String]"
$range = 1, 2, 4, 8, 16, 32, 62, 64, 65, 127
$numbers = New-Object "System.Collections.Generic.List[Int]"
$numbers = $range
$target = 65
Function Get-SumUp {
[CmdletBinding()]
param
(
$x = '<?xml version="1.0" encoding="utf-8"?>
<Notification>
<SendEmail>OnFailure</SendEmail>
<SendEventLog>Never</SendEventLog>
<SendPage>Never</SendPage>
<SendNetSend>Never</SendNetSend>
</Notification>'
$missingVariables = @()
$SendEmail = "Never"
# $SendEventLog = "Sometimes"