Skip to content
Advertisement

Tag: powershell

Powershell mail every user from SQL query

Unfortunately, I could not find my answer from all the examples I came across. I have a SQL query that contains the following values First name Suffix Last Name Email address Now I want to send a mail per record and in the mail mention the name. Below is the code that doesn’t do the loop right now and puts

Trying to extract data form SQL using PS script

I have been trying to get a PS script to work in extracting files (pdf, word, etc.) from an SQL Server database. I came across the PowerShell script below. The script runs and populates the destination folder but all files are 0 bytes and during the script execution. It throws the error: “Exporting Objects from FILESTREAM container: .docx Exception calling

execute powershell from SSMS

I am trying to execute as certain xp_cmdshell code: but this is the error that I get: when I try an execute the same thing in powershell I get the expected response(see image) Powershell The expected output from the xp_cmdshell should be a json Answer The error message implies that your command line is being executed via cmd.exe, where &

Return the Data from Column Using PowerShell

When I export the $dt to a CSV – it shows in 1.A of Excel = 1 and in 2.A = 2. I need to extract the two value of the second row in column A. First why is the count working? And why do I not get a return for the values in the last two echo commands when

Powershell sorting columns

I was able to sort the column and remove duplicates using -Unique My problem is that I can’t remove a specific row using the status property ID Name Status 1 John Current 1 John Future 2 Mary Future 2 Mary Notice 3 Paul Future I want the rows to be unique by status order. Current Notice Future Example: If there’s

Poweshell retrieve sql query result

I am quite new to PowerShell. I have multiple SQL queries which I am executing from a PS script using SQL adapter. I need to retrieve the common results based on a column from the queries without changing existing queries or writing another one. How to achieve this with PowerShell using the results stored in a variable? I’ve tried working

Multiple Loop with a SQL Query Function – 2 Minute Interval between Queries

Need to loop twice through the query function below loading the results into two seperate variables. The query function works as expected, but need to have two unique queries stored in the two temp tables. How should I create these temporary tables that allow me to reference them as $1_resultsDataTable and $2_resultsDataTable? I will use these two tables to do

Advertisement