Skip to content

Instantly share code, notes, and snippets.

Avatar

Aaron Nelson SQLvariant

View GitHub Profile
View RetrieveObject_Get-RsDeploymentConfig.ps1
Get-RsDeploymentConfig -RsProjectFile 'C:\Repos\GitHub\ReportingServicesTools\Tests\CatalogItems\testResources\TestProjects\SQLServerPerformanceDashboardReportingSolution\SQL Server Performance Dashboard\SQL Server Performance Dashboard.rptproj' -ConfigurationToUse Release
FullPath : Release
OverwriteDatasets : False
OverwriteDataSources : False
TargetReportFolder : SQL Server Performance Dashboard
TargetDatasetFolder : /Datasets
TargetDatasourceFolder : /Data Sources
TargetReportPartFolder : Report Parts
TargetServerURL : http://localhost/reportserver
@SQLvariant
SQLvariant / Build_SQLInstance_wStringCreds_andPortNumber.ps1
Last active Oct 15, 2020
Use Invoke-ExecuteNotebook to build a SQL-on-Linux instance in a Docker container, by calling Invoke-ExecuteNotebook to execute the Notebook, and passing in the sa_password & digits for the name/port number to the Notebook as a parameter.
View Build_SQLInstance_wStringCreds_andPortNumber.ps1
Invoke-ExecuteNotebook -InputNotebook .\SQL-on-Docker-with-PowerShell.ipynb -Parameters @{sa_password = 'Test9999'; SQLNumber = 97}
@SQLvariant
SQLvariant / Download_Notebook.ps1
Last active Oct 15, 2020
Example PowerShell Notebook to show you examples of what will happen when you use the ConvertTo-SQLNoteBook function.
View Download_Notebook.ps1
irm https://gist.githubusercontent.com/SQLvariant/5cbad3dd52093fbd053ec46769a0fc22/raw/1ecf6c292a6c0b9419af01d7360d373a2adff3cd/Using_ConvertTo-SQLNoteBook.ipynb -OutFile Using_ConvertTo-SQLNoteBook.ipynb
@SQLvariant
SQLvariant / README.md
Last active Oct 11, 2020
I wish there was some kind of -GridThru functionality (`Out-GridView` with `-PassThru`) built into the Get-History command
View README.md

Please 'Code Golf' this snippet

I like to get my code 'working' and then see if I can shorten the code, make it run faster, or maybe just reduce the number of variables I'm using.

However, sometimes I end up breaking things. At which point, I want to jump back to a version of the code that executed successfully. To do that, I sometimes use the code block below:

Get-History |
SELECT * |
Out-GridView -PassThru |
foreach { $_.CommandLine } | clip
@SQLvariant
SQLvariant / GatewayClusters.ps1
Last active Oct 5, 2020
Get the Governance Data You Need Out of Your Power BI Gateways with PowerShell
View GatewayClusters.ps1
<# Make sure you have the modules installed.
You only need the ImportExcel module if you want to export the results to Excel files. #>
Install-Module DataGateway
Install-Module ImportExcel
<# Discovery #>
# All Gateway Clusters in your tenant.
Get-DataGatewayCluster -Scope Organization
# All nodes of all Gateway Clusters in your tenant.
@SQLvariant
SQLvariant / DockerDesktop-with-SQL-PowerShell-90.ipynb
Last active Oct 3, 2020
Create a SQL-on-Linux Docker Container with a Host Mount and Restore the AdventureWorks2016 Database
View DockerDesktop-with-SQL-PowerShell-90.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SQLvariant
SQLvariant / Build_SQLInstance_wStringCreds.ps1
Created Sep 29, 2020
Use Invoke-ExecuteNotebook to build a SQL-on-Linux instance in a Docker container, by calling a Notebook to execute, and passing in the sa_password to the Notebook as a parameter.
View Build_SQLInstance_wStringCreds.ps1
Invoke-ExecuteNotebook -InputNotebook .\DockerDesktop-with-SQL-PowerShell-90.ipynb -Parameters @{sa_password = 'Test9999'}
@SQLvariant
SQLvariant / Mmmm_Chocolatey.ps1
Last active Sep 17, 2020
Install SQL / Data Developer Desktop Tools from Chocolatey
View Mmmm_Chocolatey.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install chocolatey -y
choco install sql-server-management-studio -y
choco install azure-data-studio -y
choco install azuredatastudio-powershell -y
choco install git.install -y
choco install vscode -y
choco install vscode-powershell -y
choco install powerbi -y
@SQLvariant
SQLvariant / SqlAssessment ChecksSQL.ipynb
Created Aug 18, 2020
PowerShell Notebook for working with the Get-SqlAssessmentItem & Invoke-SqlAssessment cmdlets from the SqlServer module.
View SqlAssessment ChecksSQL.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SQLvariant
SQLvariant / CellFindingVisitor.cs
Created Aug 11, 2020 — forked from rjmholt/CellFindingVisitor.cs
PowerShell AST visitor to break up a file by comments
View CellFindingVisitor.cs
using System;
using System.Collections.Generic;
using System.Management.Automation.Language;
public class ScriptExtent : IScriptExtent
{
private readonly IScriptPosition _start;
private readonly IScriptPosition _end;
You can’t perform that action at this time.