Questions tagged [sqlps]

The sqlps utility starts a Windows PowerShell 2.0 session with the SQL Server PowerShell provider and cmdlets loaded and registered.

The sqlps utility starts a Windows PowerShell 2.0 session with the SQL Server PowerShell provider and cmdlets loaded and registered. You can enter PowerShell commands or scripts that use the SQL Server PowerShell components to work with instances of SQL Server and their objects.

Click Here for documentation.

58 questions
2
votes
2 answers

Get-SqlInstance : The operation failed on target server

I am researching using SQLPS module; PowerShell version 3.0. When running Get-SqlInstance, I consistently get the following error. PS 11/16/2015 08:34:29> $cred = Get-Credential cmdlet Get-Credential at command pipeline position 1 Supply values for…
user5568582
  • 21
  • 1
  • 2
2
votes
1 answer

Powershell invoke-sqlcmd : Value cannot be null. Parameter name: ServerInstance

I'm having issues making calls to the local database using the method outlined below. Error Message invoke-sqlcmd : Value cannot be null. Parameter name: ServerInstance At C:\filelocation\HealthCheckCombined.ps1:86 char:3 1. …
LAugur
  • 35
  • 1
  • 7
2
votes
1 answer

Unable to use SQLPS CmdLet Backup-SQLDatabase with -InputObject parameter

Having run into the same timeout issue found here and trying the workaround, I'm finding that I get the error: Backup-SqlDatabase : Cannot bind parameter 'InputObject'. Cannot convert the "[instDW_QA0]" value of type…
Ken Stuber
  • 23
  • 4
2
votes
3 answers

Import-Module SqlSp fails on TeamCity, works in native PowerShell

I'm having an odd issue with running a PowerShell script as a TeamCity build step, particularly with SqlPs (though I'm not sure it's specific to SqlPs). This one-line script fails in TeamCity: Import-Module SqlPs With the following…
Jerad Rose
  • 15,235
  • 18
  • 82
  • 153
2
votes
1 answer

sqlps transaction issue

I wrote a script that uses sqlps to deploy a SSAS tabular cube. After the deployment, I need to perform a couple of actions on the cube but if I try to access it, I get a message saying that the cube doesn't exist. But it does, in fact, if I split…
Diego
  • 34,802
  • 21
  • 91
  • 134
1
vote
1 answer

Powershell outputs mixed between loops - SQL datasets

I have a PowerShell script that loops through list of 3 servers. A SQL script is run with Invoke-Sqlcmd and the result set is stored to variable $DS. At the end of the loop I return the records with with $DS.Tables.Rows. But the results sets are…
SherlockSpreadsheets
  • 2,062
  • 3
  • 27
  • 47
1
vote
2 answers

Getting the Logical File Name using RESTORE FILELISTONLY from a DB backup and storing it into a variable

I am using a fairly simple PowerShell script to automate the process of restoring databases: #Script to restore database. $serverInstance = $args[0] $dbName = $args[1] $file = $args[2] $dataDestination = $args[3] …
Dan
  • 13
  • 1
  • 4
1
vote
1 answer

sqlps- Cannot find path 'SQLSERVER:\SQL\SERVER\DEFAULT' because it does not exist

I am trying to connect to an sql14 server via sqlps powershell module, but keep getting this error: Cannot find path 'SQLSERVER:\SQL\SERVER\DEFAULT' because it does not exist'. The server does exist and is responsive. I tried connecting to it with…
GKman
  • 503
  • 1
  • 5
  • 19
1
vote
0 answers

Compress folder using Powershell from SQLSERVER runtime

I need to zip a folder using powershell from within SQLPS runtime. I tried the following from PS SQLSERVER:\> prompt: $dest = "C:\SomePath\FolderToBeZipped" $zipfile = $dest + ".zip" Add-Type -assembly…
user3180704
  • 119
  • 3
  • 8
1
vote
2 answers

What is the best to remove xp_cmdshell calls from t-sql code

I'm maintaining large t-sql based application. It has a lot of usages of bcp called through xp_cmdshell. It is problematic, because xp_cmdshell has the same security context as SQL Server service account and it's more than necessary to the work. My…
Marcin
  • 57
  • 7
1
vote
3 answers

Error passing variable SQL instance name into Invoke-SQLcmd

I'm working on a project that pulls a list of SQL instances from server A and then loops through the returned list and runs a query (eventually to audit users and insert results into table) but getting an error instance not found. It seems I'm not…
Jeff A
  • 23
  • 7
1
vote
1 answer

The specified module 'SQLPS' was not loaded in azure VM

I create new Azure VM and i want to invoke some SQL Powershell commands like Import-Module SQLPS -DisableNameChecking. I have not install any sql server in VM, because i want to do operation on my azure database. so i need to install any sql server…
1
vote
1 answer

invoke-sqlcmd failing after Automated SQL install with powershell

I'm using Powershell 4 to install SQL 2014. everything goes ok except at the very end where I have a function that will run a script from a .sql file using invoke-sqlcmd. I get the following error: "The term 'invoke-sqlcmd' is not recognized as…
ScubaManDan
  • 809
  • 8
  • 22
1
vote
1 answer

sqlps Invoke-Ascmd Error Handling in ssas 2012

In SSAS 2012 Iam trying to use "sqlpls -C Invoke-ascmd -S server -i file.xmla" from command line for cube processing.%errorlevel% is 0 even if cube processing fails since sqlps executing succesfully.Can any one help me to understand how to do error…
rahnam
  • 13
  • 3
1
vote
2 answers

How can I access a SQL Server database with . in name via set-location

Question is in the title. I have a database server which has a number of databases that have periods in the name (they are urls so that I know which database is associated with which site such as foo.bar.com_content). When I navigate to…
Hector
  • 55
  • 4