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

Administration and Powershell

Hi,I have a script I am writing to make life easier for myself around requests for new Database environments by our developers. (Dev/Test/Live).All was going well until I stumbled on a little...

View Article


Get-WMIObject Win32_Volume fails on proxy account from Agent Job

It may just be a case of me missing something, but I get unexpected behaviour when running a job as a proxy from the SQL Agent. The job itself is a simple one in Powershell that grabs partition usage...

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

How to copy last line of .txt file into new .txt file?

Windows Server 2008 R2I'm totally new to PowerShell but was trying to use it to solve an issue with data files that come with the last row being a) short and b) containing the row count for the file....

View Article

French characters into SQL Server

Hi all,I use Powershell to deploy DB scripts. In one script file, I have French accented characters.When I call Invoke-sqlcmd and pass the script to the -inputfile, the French characters get mangled.In...

View Article


Power shell

Hi guys, I am new to powershell, can anyone please help me in undertanding powershell. I googled about powershell. But i dint get any clear idea about it. I would like to know about, for what purpose...

View Article

Get table's unique indexes

Is there a way to list the unique table constraints on a given table using smo/powershell?Or do I have to query the system views?Thanks!

View Article

get-unique

I [strike]want[/strike] need to understand why the code below returnsalpha ----- Y Can someone explain why I don't see alpha-----XYBonus points: if the last 2 lines are$cAlphas = $Objects | select...

View Article


Remove items from an array based on another array

Hi,I have 2 Array or ArrayList objects, with data like[code="vb"]$Results = New-Object...

View Article


Scrip to connect to remote windows box to get SQL version

Dear All,I am very much new to power shell scripting where i need to find out what version of SQL Server is running on it and on which port the DB is running on the remote windows box.Could you pls...

View Article

powershell WMI error: "Could not obtain SQL Server Service information. An...

I get the following error when I launch powershell from SSMS, after right-clicking on a remote SQL instance and choosing "Start powershell":[quote]Warning: Could not obtain SQL Server Service...

View Article

Script to loop through SQL Server Instances and pass Instance Name to...

I am trying to use a SQL Table to loop through SQL Instances and pass the Instance to a script:$DestinationSQLServer = 'coaidera01\idera'$DestinationDBName = 'CTM_Monitoring'$DestinationQry = "select...

View Article

Help with replace parameter

Hi. I have a script that looks at the sysjobsteps table to find SSIS script locations and then copies them out to disk for disaster recovery. It works fine but I am making an assumption in the script...

View Article


Query to variable - not wanting table style result

HiI am trying to run a script that queries the last full backup file for a specific database. Invoke line formated for ease of reading.[code="plain"]# Script is ran on the SQL server (not remotely)#...

View Article

Inserting into table with Powershell

I have a script that I'm adapting from something I found on the internet where I'm getting database size information and insert that into a table I've created. I've been working with PS for a couple of...

View Article


Powershell execution error

Greetings,I have a script that was executing a powershell script from within a batch file with the following syntax:"“powershell.exe -NoLogo -Noninteractive -Command "& \"%~dp0ScriptName.ps1\" %1;...

View Article

Query local SSMS server group with Powershell?

This may be a totally off the wall question, but it seems like it should be possible to do. Just can't find any specifics as to how I might accomplish it.I have a situation in that I have the same...

View Article


Failed SQL job info from PS to sql table

Hi All,Please have a look at the below link and help me to get the details (as 4 Columns) into a SQL Server table instead of Mail as I can make a SSR report from the data. SERVER = JOB = LASTRUN =...

View Article

Get SQL Query Results as E-Mail

Gurus, I am trying to write a code to send out list of failed jobs in the last 24 hours. I am using out-string to convert my table to string. I am able to get email with list of jobs. But, i would like...

View Article

Help me Error SSIS Error (Agent Service)

An invalid reporting option was specified. Only E, W, I, C, D, P, V, and N are allowedImport Data Source from Oracle to SQL Server2008 password Oracle have '[' how solutionthanks

View Article
Browsing all 467 articles
Browse latest View live


Latest Images