February 23, 2016 at 6:08 am
Hi All,
I have the following installed on a machine
Windows Server 2008 R2
SQL Server 2012
PowerShell 3
Microsoft SQL Server 2012 Feature Pack Powershell tools
My problem is that whenever i run a script that uses the invoke-sql scmdlet, it takes an huge amount of time. I believe this is because it is importing the module automatically each time (i.e. import module sqlps).
Is there any way to install the invoke-sql cmdlet as an inbuilt feature of powershell? This would make my scripts run almost immediately instead of taking minutes as they do now.
February 23, 2016 at 6:45 am
The PowerShell command line takes longer to load but you can do it via a shortcut:
PowerShell.exe -noexit -command import-module sqlPS
You can add it to your profile instead (see https://technet.microsoft.com/en-us/library/hh849725.aspx).
Gaz
-- Stop your grinnin' and drop your linen...they're everywhere!!!
February 23, 2016 at 2:24 pm
Blogged about the issue here[/url] and what you can do to improve it.
Shawn Melton
Twitter: @wsmelton
Blog: wsmelton.github.com
Github: wsmelton
February 23, 2016 at 2:34 pm
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply