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 ArticleError 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 ArticleAcces 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 ArticleErrors while trying to copy files to UNC path using Powershell
Hello experts,I found the promising script below at the following...
View ArticleExtract 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 ArticleGet 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 ArticleError 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 ArticleConnection 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 ArticlePowershell 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 ArticlePowershell 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 ArticleRemove 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 ArticlePowerShell 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 ArticleGet 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 ArticleDBEngine 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 ArticleProblem 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 ArticleComparing 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 ArticleAutoalert 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 ArticleInvoke-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 ArticleEasy 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 ArticleQuery 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