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

Powershell drop down list for parameter values.

Hello,I am looking to right a function that will add a sql login to a role. Thing is, when the parameter is entered, I don't want anyone typing anything is because typos are a pain. I have done some...

View Article


Error in Downloading Report from Local SSRS Server

I am executing this attached code "SampleScript.ps1" to access my SSRS report in my local server and download the report in pdf format in local drive.The error which I am getting is as...

View Article


Acces Denied

Good day Experts,I am new to powershell and please help me.Where i work we use powershell script in sql server agent job to retrieve information that is hostname and disk drives size and free space...

View Article

Errors while trying to copy files to UNC path using Powershell

Hello experts,I found the promising script below at the following...

View Article

Extract output from central management servers into a table

This one has my head spinning. I would like to run a query on all of the servers registered in the central management server and then write the output to a table on our management server. I can get the...

View Article


Get Visual Studio 2014 Path

Hi,If I run the below path I get the path as : "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\"....but I need the below path :'C:\Program Files (x86)\Microsoft Visual Studio...

View Article

Error scripting database objects (view/table) that have a trigger

I'm getting an error using the script i've added a link to below as well, in case the forum doinks up some of the code.this script, in a larger context, scripts all the objects out in a given...

View Article

Connection options using SMO

I'm trying to set the following for a single connection (so that I can create a Unique Constraint on a computed varbinary column)I want to do this in PoSh using SMO, rather than executing T-SQL -- if...

View Article


Powershell Slower based on Runtime account

So I have a powershell script that goes out and grabs some database properties on approximately 30 servers. It returns data on a couple hundred databases in under 1minute, however when it gathers data...

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

Remove newline in CSV field

Hi all,I'm trying to replace text in a CSV.The CSV line looks something like this:[code="other"]"Field One","Field Two","FieldThree","Field Four"[/code]So I tried something like:[code="vb"](Get-Content...

View Article

PowerShell Reference

What's a good PowerShell reference book for someone with limited experience with PowerShell (meaning my experience is looking for scripts written by others that do something similar to what I want and...

View Article

Get smo object from sql database item name

Hi all,Is there a way to get an smo object (stored proc, UDF, etc...) from an items' name and a database object?that is, without knowing what type of object xyz is, with the string "xyz" and a database...

View Article


DBEngine Access check

The below powershell code checks if we can access to a server and separates the good list from the bad list.How can also check and add to the same above code to check if wehave access to the database...

View Article

Problem trying to create a database+datafile in a specific directory.

Hello,I am trying to create a script that will create a database, a datafile with a particular naming convention, and place it in a directory that is created, also using a naming convention, and put it...

View Article


Comparing file name and view column in Powershell

Hello experts,I'm learning Powershell to try to accomplish a task. I say "learning" as a disclaimer - so if the code below is as ugly as I think it is, by all means let me know of a more elegant way!1....

View Article

Autoalert if SQLAgent stops

I have this piece of powershell code which sends out an email when executed in a SQL job or run in powershell mode but does not work in this below situation.Attached is a screenshot of the Recovery tab...

View Article


Invoke-ASCMD - Passing values to the XMLA file not working

I need to create a cmd file to backup Analysis Service Database. Because my SQL Server 2014 does not have ascmd.exe, I thought I would use powershell 'Invoke-ASCMD' but I am having problems passing...

View Article

Easy piece of code just doesnt bloody work.

Sounds like a headline from the onion.All I want to do is add a new database role to a database and its not working. I understand the error, but I don't know why I'm getting it. It (the code) matches...

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
Browsing all 467 articles
Browse latest View live