Skip to content

Instantly share code, notes, and snippets.

Aaron Nelson SQLvariant

Block or report user

Report or block SQLvariant

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@SQLvariant
SQLvariant / GetStartedWithPowerBIcmdlets.ipynb
Created Dec 11, 2019
PowerShell Notebook to get you started with current PowerShell + Power BI capabilities.
View GetStartedWithPowerBIcmdlets.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SQLvariant
SQLvariant / Copy_PowerBI_WorkspaceItems.ipynb
Created Dec 11, 2019
Different options for copying items in a Power BI Workspace.
View Copy_PowerBI_WorkspaceItems.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SQLvariant
SQLvariant / Export_PowerPlatform_Gateway_Assets.ipynb
Created Dec 10, 2019
Export details of your PowerPlatform Gateway assets from your entire tenant.
View Export_PowerPlatform_Gateway_Assets.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SQLvariant
SQLvariant / Export_PBI_AuditLogs.ipynb
Created Dec 10, 2019
PowerShell Notebook showing how to use both cmdlets available for extracting Power BI audit log events
View Export_PBI_AuditLogs.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SQLvariant
SQLvariant / ExportPowerBIWorkspaceAssets_withPowerShell.ipynb
Created Dec 10, 2019
PowerShell Notebook (open in Azure Data Studio) to help you export all of your Power BI Workspace Asset information.
View ExportPowerBIWorkspaceAssets_withPowerShell.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SQLvariant
SQLvariant / DeadSimple_PSResults_Lag.ipynb
Created Dec 6, 2019
Examples of lagging results in PowerShell Notebooks with v0.1.2 of the powershell_kernel
View DeadSimple_PSResults_Lag.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SQLvariant
SQLvariant / GatewayClusters.ps1
Last active Oct 15, 2019
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 / Import_HundredsOf_CSVs.PS1
Created Oct 10, 2019
Basic script to import every .CSV file from a directory and INSERT each one into it's own table in SQL Server. It will create the table if it doesn't exist.
View Import_HundredsOf_CSVs.PS1
dir -Filter *.csv |
foreach {
"$($_.Name)";
,(Import-Csv -Path $_.Name) |
Write-SqlTableData -ServerInstance localhost\SQL2017 -DatabaseName BlankDB -SchemaName dbo -TableName $_.BaseName -Force
}
@SQLvariant
SQLvariant / Export_PBIAuditLogs_toDailyJson.ps1
Last active Oct 3, 2019
Export Power BI Audit Logs to .JSON files
View Export_PBIAuditLogs_toDailyJson.ps1
90..1 |
foreach {
$Date = (((Get-Date).Date).AddDays(-$_))
$StartDate = (Get-Date -Date ($Date) -Format yyyy-MM-ddTHH:mm:ss)
$EndDate = (Get-Date -Date ((($Date).AddDays(1)).AddMilliseconds(-1)) -Format yyyy-MM-ddTHH:mm:ss)
Get-PowerBIActivityEvent -StartDateTime $StartDate -EndDateTime $EndDate -ResultType JsonString |
Out-File -FilePath "c:\temp\PowerBIAuditLogs\PowerBI_AudititLog_$(Get-Date -Date $Date -Format yyyyMMdd).json"
}
@SQLvariant
SQLvariant / Invoke-SqlNotebook.md
Last active Sep 23, 2019
3 different options for using the Invoke-SqlNotebook cmdlet
View Invoke-SqlNotebook.md

Use with Registered Servers

Use Registered Servers or Central Management Server to run Invoke-SqlNotebook against multiple servers.

$datetime = Get-Date -Format yyyyMMddhhmm

dir 'SQLSERVER:\SQLRegistration\Database Engine Server Group' |
WHERE { $_.Mode -ne 'd'} |            
foreach {
You can’t perform that action at this time.