Powershell – ScottGeek Technology https://scottgeek.technology Thu, 13 Feb 2020 22:48:17 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.4 Powershell Create of the SSISDB Catalog https://scottgeek.technology/2020/01/23/powershell-create-of-the-ssisdb-catalog/ https://scottgeek.technology/2020/01/23/powershell-create-of-the-ssisdb-catalog/#respond Thu, 23 Jan 2020 17:51:05 +0000 https://scottgeek.technology/?p=5135 So when management gets this [insert explicative] idea to strip away my MSDN enterprise access, and I need to create an SSISDB catalog on my dev server- what the hell am I to do? Well, maybe not simple… I put on my PowerShell hack through hat. Shall we?

In your favorite SQL instance (we’ll just use localhost for my examples) start with making sure you have CLR ENABLED first:

EXEC sp_configure 'clr enabled', 1;  
RECONFIGURE;  
GO

Do this in a query window in SSMS of course.

Now the PowerShell:
 

# Load the IntegrationServices Assembly  
[Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Management.IntegrationServices")  

# Store the IntegrationServices Assembly namespace to avoid typing it every time  
$ISNamespace = "Microsoft.SqlServer.Management.IntegrationServices"  

Write-Host "Connecting to server ..."  

# Create a connection to the server  
$sqlConnectionString = "Data Source=localhost;Initial Catalog=master;Integrated Security=SSPI;"  
$sqlConnection = New-Object System.Data.SqlClient.SqlConnection $sqlConnectionString  

# Create the Integration Services object  
$integrationServices = New-Object $ISNamespace".IntegrationServices" $sqlConnection  

# Provision a new SSIS Catalog  
$catalog = New-Object $ISNamespace".Catalog" ($integrationServices, "SSISDB", "P@assword1")  
$catalog.Create()

The last part in “Provision a new SSIS Catalog” make sure you do a good password.

And that’s it…. So why am I doing this with PowerShell? No “DIS” on PowerShell, but it seems that the version I install SQL Server 2016 has this thing about connecting to Azure SSIS with creating a SSISDB Catalog, and since I no longer have access to MSDN (you knew MSDN was in this somewhere) I had to hack my way around getting a catalog created… Now yes, I could have done the Azure SQL SSISDB connect bah bah (I do have an enterprise Azure accounts), but you what? This same management does not want to spend money on Azure… YA! An Azure SQL SSISDB has a cost. 

So there you go… Got to love this jumping around not having the tools to get stuff done.

~ScottGeek

 

 

 

 

]]>
https://scottgeek.technology/2020/01/23/powershell-create-of-the-ssisdb-catalog/feed/ 0
Powershell 6.x Profiles https://scottgeek.technology/2019/04/24/powershell-6-x-profiles/ https://scottgeek.technology/2019/04/24/powershell-6-x-profiles/#respond Wed, 24 Apr 2019 20:11:49 +0000 https://scottgeek.technology/?p=5008 Because I can never remember this:

All Users, All Hosts $PsHome\Profile.ps1
All Users, Current Host $PsHome\Microsoft.PowerShell_profile.ps1
Current User, All Hosts $Home\Documents\PowerShell\Profile.ps1
Current user, Current Host $Home\Documents\PowerShell\Microsoft.PowerShell_profile.ps
$Profile Current User, Current Host
$Profile.CurrentUserCurrentHost Current User, Current Host (Yeah the same as above)
$Profile.CurrentUserAllHosts Current User, All Hosts
$Profile.AllUsersCurrentHost All Users, Current Host
$Profile.AllUsersAllHosts All Users, All Hosts
]]>
https://scottgeek.technology/2019/04/24/powershell-6-x-profiles/feed/ 0
Powershell 6 Core Like Install https://scottgeek.technology/2019/04/24/powershell-6-core-like-install/ https://scottgeek.technology/2019/04/24/powershell-6-core-like-install/#respond Wed, 24 Apr 2019 17:57:09 +0000 https://scottgeek.technology/?p=5004 As I re-tool (or is it update) my Powershell, I came across the simple one liner to do the install… nice:

iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"

Btw some neat changes in 6.2 PS…

Some interesting settings:

Enable-ExperimentalFeature -Name PSCommandNotFoundSuggestion

Enable-ExperimentalFeature -Name PSTempDrive

Enable-ExperimentalFeature -Name PSUseAbbreviationExpansion

Read More:

What’s New in PowerShell Core 6.2

What’s New in PowerShell Core 6.2

New features and changes released in PowerShell Core 6.2

Source: docs.microsoft.com/en-us/powershell/scripting/whats-new/what-s-new-in-powershell-core-62?view=powershell-6

 

 

]]>
https://scottgeek.technology/2019/04/24/powershell-6-core-like-install/feed/ 0