Quantcast
Channel: SQLServerCentral » Programming » Powershell » Latest topics
Browsing all 467 articles
Browse latest View live

Write PowerShell Output to SQL Server Table

Heh... First time I've had to admit being a "newbie" in a long time so be gentle with me. I might not even know enough to ask the right questions.I managed to pick up the following PS script from the...

View Article


SQLPS (SQL Server 2012)

I am starting to learn (work) with PowerShell. On my work laptop I have installed SQL Server 2012 DE. Also using PowerShell 3.0 at the OS level. On our Windows Server 2008 systems we have installed...

View Article


Restore with relocate database files location in powershell

Please help me to modify this script as relocate database files location means like with move ... this will help mewrite-host "Restoring Databases"foreach ($database in $databases){write-host...

View Article

PowerShell Vulnerabilities

I had an interesting conversation with one of our security folks yesterday about PowerShell vulnerabilities. He has read several things in the news lately, for example:...

View Article

Connecting to remote server using powershell subtype

Hi All,Super newbie to powershell and I am on Day 1 of learning..i am trying to configure a SQL Server Agent job with a Powershell step type that will execute this piece of ps code:Enter-PSSession...

View Article


Auto export database/tables from Local Sql Server to Azure.

Hi, I'm new to powershell and currently we use a c# app on the local to export data from local to our azure db. I now want to explore other options for auto exporting and have pegged looking at...

View Article

Server 2003 powershell

What version of powershell ships with Windows Server 2003?

View Article

Script to change SQL Server and SQL Server Service Logins.

I need a Script to change SQL Server and SQL Server Service Logins.Does any one have a script to do this?

View Article


Query AD - Script Out of memory

I have a problem with a script to query ActDir. I have found some code to search what I need, but the script stops after some time, "Exception of type 'System.OutOfMemoryException' was thrown". Our AD...

View Article


Powershell for network path

I am totally new to powershell(just 2 days) so please bear my ignorance.Here is the code I am trying to execute as a sql agent job that basically deletes files over 2 days old.[code]function...

View Article

Output message from invoke-sqlcmd required

I am using powershell to run a .sql file and I need to log the out put to a txt or csv file.Trouble is I am not getting the error messages displayed in the powershell consol.I think an example is...

View Article

Difference between ISE vs command line and out of memory

I'm having a small problem. I downloaded a Powershell script that would allow me to deploy SSRS reports. The script itself works great. I modified the script so that it would copy only the reports that...

View Article

Wanted to check good / alive SQL Servers through script.

Hi,I want to extract the list of good servers where the SQL Server services are running to execute a .SQL file across the list of servers using powershell.Somehow the below script does not work.Any...

View Article


File transfer failing with no error returned

Hi all-I have a PS script that I use to transfer files from our data center to our corporate location so that we can restore in our development environment on a regular basis. For some reason, the...

View Article

Ideas to monitor file copying progress for automated script

I have a PS script that runs on a schedule.This process is automated and the app that calls the PS script is a service that does not have admin privileges.This script looks in a certain folder for any...

View Article


Change DB owner to AD account that is member of sa

So I have an AD account that is a member of an AD group that has sa on our SQL 2008 R2 server.How can I set the ownership of the DBs on that server to that account, ideally using PoSh + smo (although...

View Article

Unable to delete local backups

Hi,I am unable to delete the local 4 backup folders from multiple servers.Can you suggest whether my query is doing anything wrong?import-module "SQLPS" -DisableNameCheckingset-executionpolicy...

View Article


Using Restore-SQLDatabase

when I run the script below in ISE it runs fine. when I try to schedule as a job to run it blows up. I get the following error "get-childitem : Cannot call method. The provider does not support the use...

View Article

Trying to Execute a SQL Agent Job With Powershell in Job Steps

Hello - I'm really stuck on this issue i'm having today. Here's my set-up:1) I created a SQL Agent job which calls an .exe file to connect to a web service and retrieve data back to a .csv file. I'm...

View Article

For Each - Remove-Item

Hi,The function scripted below executes a stored proc (SP) in SQL. This SP return the database file paths.example:D:\MSSQL11.Test\MSSQL\Data\Test08.mdfD:\MSSQL11.Test\MSSQL\Data\Test08_log.ldfThe SP...

View Article
Browsing all 467 articles
Browse latest View live