Can't delete folder recursively in script, no errors are printed.
I'm trying to remove a directory with a powershell script, the script seems to be working fine except for the deletion at the end. It's not printing out any errors so I'm not sure how to determine why...
View ArticleTrying to find instance of item in array, -contains isn't working
I'm trying to write a script in Powershell that will match extensions of file names. This is what I have so far:$location = $args[0]; [String]$extensions = @(".mkv", ".mp4", ".avi", ".wmv"); $pruneSize...
View ArticleBatch File Question - Exit on Error
I have a batch file: StartFile. batcd /d %~dp0powershell.exe -File sp_script.ps1pauseI have sp_script.ps1$ErrorActionPreference;sqlcmd -b -S myserver -d mydatabase -i sql_test_fail.sql | Tee-Object...
View ArticleDBA with PowerShell = What task?
Goal: Understand better how a DBA use PowerShell in his/here daily work. Problem: I really don't understand what specific assignment does a DBA use PowerShell in order to complete task or assignment...
View ArticleTough one - Accessing component properties of a Task Host inside an SSIS Data...
Having some issues with getting a conversion to a COM object to work right (at least I think that's my problem). We have a template SSIS package, within a PowerShell script I access that package, make...
View ArticleWhat PowerShell can be used For Business Intelligence
Goal: Understand better how and why PowerShell can be used in business intelligence. Problem: I really don't understand what specific assignment what PowerShell can be used in order to complete task or...
View ArticleExtract multiple gzip SQL BAK files and then restore them
I'm a complete Powershell newb here so apologies for that upfront. I'm trying to restore multiple SQL bak files and found this script:...
View ArticleQuery SQL Server As A Different User
I have a need to execute a query in a Powershell script against a SQL server with an alternate user account. I have been using the SQLClient .NET class to create connections and run queries up to now...
View ArticleNeed power shell script
Hello,Could you please provide power shell script to add SQL service account to below local policy groups: Lock pages in memory Perform volume maintenance tasksand set TCP...
View ArticleExecute Powershell Script from within TSQL
Hello PS Folks,I am trying to find the EXCEL file from a location and rename the Sheet Name in it.I have the SSIS Package from which I am looking for the EXCEL File from a certain location and load...
View ArticleQuery All servers for linked servers and datasources
hi all - I'm a Newer DBA and my boss has assigned me to look on all our servers (126 of them) and find all the linked servers that are pointing to an oracle database. Of course, I thought of...
View ArticleRestore Database Using SMO - Get status and errors
Hello,I am trying to create a Powershell (v4) script to restore a database to a SQL Server 2012 Instance. I am able to get the database to restore, but i have some complications. If i use the...
View ArticleGet only column name of empty table and save it to csv file
Hello,I am new at powershell and need your help. I can extract data and save it to csv file but I am stuck on how do you get only a column of an empty table and save it to csv with comma dilimited?
View ArticleHow to script out data from a table with Powershell
Hi,I have few lookup tables I need to script data for in order to rebuild an empty database. I've already developed the scripts for the database schema.For example I have a table User:UserId,...
View Articleinvoke-sqlcmd adds a semicolon at the end of stored procedures
We have an automated process that promotes code to SQL Server using powershell scripts. The powershell script executes .sql script files from a file folder. When invoke-sqlcmd executes a .sql script...
View ArticleCan I cross apply the power shell function to a table in SQL Server?
I want to get the file size of millions of files. I have the file path of those files stored in a table in SQL server. Can I use a power Shell function that gets file size given file path by cross...
View Articleshould I use PS for that task ?
HiI know it may be a lame question but I'm new to PS and I would appreciate if you guys with big experience could advice me if I should even process the following scenario using PS or something...
View ArticleReporting Services Audit
Since the connection string in ReportServer.Catalog for 2008R2 is incorrect, I'm wondering if anyone has created a PS script to do an inventory of a ReportServer.I'd like to see Report Name, Report...
View ArticleExamples running SQL Stored Procedures from Powershell with Output Parameters
Does anyone have a good example of calling a SQL Server stored procedure from powershell with output parameters that returns a string with more than one character? I have a stored procedure with an...
View ArticleFunction that updates the database - Guid Problem
I have a function that updates the database with a project name. The PK column is a GUID. When I pass in the project name and an empty GUID I get a error that reads: "Conversion failed when...
View Article