Windows PowerShellâ„¢ is a task-based command-line shell and scripting language designed especially for automation of Windows tasks. It has become the defacto CLI for Microsoft products since the its release, and can fully leverage .NET frameworks.
0
votes
1answer
72 views
SQLPlus: Cmd vs PowerShell
From cmd.exe, when I run:
C:\oracle\client\BIN\sqlplus.exe username@server
then type my password, I get in. However, if I run the same command from PowerShell and type the same password I get:
...
1
vote
1answer
218 views
How to connect Powershell to the SQL Server named instance?
When I run
# Load the SMO assembly
[void][reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo");
$ServerName = "[local\s12]";
#Get a server object which corresponds to the ...
0
votes
1answer
510 views
Restore SQL Server database using Windows Powershell 3.0
I'm trying to restore a SQL Server database with a PowerShell script, but I'm having problems.
Here is the error I'm getting:
Exception calling "SqlRestore" with "1" argument(s): "Restore failed
...
1
vote
0answers
83 views
SQL Server: Powershell to dump database as SQL Beginner Issues
I want to be able to dump a database to a sql text file using Powershell. I want this because our DBAs want to be able to do a diff on the file that is committed to SVN. They won't execute it if they ...
5
votes
1answer
130 views
Why am I missing some output?
Archiving to avoid ID Exhaustion
We are about to run out of IDs in one of the tables of our OLTP logging system. It's my job to find a way to 'archive' the existing row data in the full table and in ...
5
votes
2answers
306 views
SQL Server SMO and PowerShell formatting
I have probably been looking at this for too long to figure this out...
What is the easiest way I could get this exported to a CSV format?
Would it be better to dump this to a table in a database ...
2
votes
1answer
331 views
SMO v11 (SQL Server 2012) not scripting key definitions, indexes, and constraints
I have a .ps1 PowerShell script that runs on a Central Management Server. The script goes out to all databases in our environment, and scripts out all of of objects. For tables scripts, the output ...
6
votes
1answer
241 views
Executing Powershell SMO against a cluster with elevated privileges to update service accounts
I'm working on a Powershell script to update service accounts on named SQL instances in a failover cluster. I'm trying to use the SMO and WMI to update this so that I can update the service account ...
3
votes
2answers
460 views
Powershell script executing within SQL Server Agent
I am trying to use Powershell within a SQL Server Agent job to download a zip file. The script uses PuTTY (PSCP.exe) to download a zip file from a SFTP site.
The issue I am having is that when the ...
3
votes
1answer
309 views
How to script out push subscription creation at the subscriber?
I'm trying to set up a push subscription to a SQL Server publication from the subscriber.
I could set up the subscription at the publisher using the Replication Wizard in Management Studio. However, ...
2
votes
1answer
254 views
How to change SQL Server Service Account using PS
SQL Server runs under AD Account SQLAccount1. How to make it run under another account, SQLAccount2? How to do it un Powershell?
1
vote
1answer
251 views
Powershell Format Table Combine Values
I have an awesome script that gives vital data for running worker processes. What I'm attempting to do is to get these three values into a table so that they can be displayed all pretty-like. I ...
5
votes
1answer
198 views
SQL Server SMO Method “Discover()”
I think I just found the coolest thing every with SQL Server SMO and PowerShell. I was asked to get a script together to find the owner of every object in an instace of SQL Server. I found a script on ...
15
votes
3answers
3k views
Which PowerShell technique should I use to talk to SQL Server?
I'd ultimately like to use PowerShell to replace the old KornShell scripts we use for SQL instance monitors. I'm having a hard time, though, getting my brain around all the different ways that ...
1
vote
2answers
2k views
Get Job id OR Job name from within executing job
I have a central DB that I write job outcomes on all my servers back to. I pass 3 parameters via powershell in a SQL job back to a sp on the central server that verifies the job should be running at ...