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

Multithreading to upload .bak files in parallel to S3 storage using PowerShell

Greetings -I wrote below PS to upload my backup files from local machine to AWS S3 storage, and it works. However, the process time is about 3 hours to upload 430 GB of backup files. The code goes...

View Article


PowerShell Script Help

I am looking for power-shell script which does QA checks on MSSQL database based on the parameters from Excel sheet using Powershell.Here is what I am looking for.Read the excel sheet values which have...

View Article


how to pass the result of compare-object to be use in if else statement

hi all,basically i am comparing 2 .csv files and output the result to another .csv file.i can't seem to figure out how to further handle the compare-object result to be use in the if..elseif...else{}...

View Article

Load data using powershell

Hi Poweshell GurusI am a power shell newbie , looking to import SQL server version information of multiple instances and load the data to a different table. Using some help from different blogs post, I...

View Article

Powershell formatting help - convert-html commandlet

Hi Experts, I need some formatting help in powershell using convert-html commandlet. Basically, here is my requirement. I want to develop a powershell script which reads the SQL server errorlog and...

View Article


Free eBook from PacktPub: Mastering Windows PowerShell Scripting - TODAY ONLY!!!

PacktPub, a well known but smaller publisher, provides a free eBook every day. I believe it is a loss leader that they run in an attempt to generate more sales. Each book is only available for free for...

View Article

EXEC xp_cmdshell 'Powershell.exe

HI,    Have a problem not sure if its permission issue or something else, any suggestions ?  I am trying to run powershell through EXEC xp_cmdshell to delete scheduled task from ssms, when I use , and...

View Article

Alternative to invoke-sqlcmd cmdlet - SMO

Hi Team,I am trying to retrieve sql data using powershell code - invoke-sqlcmd. Invoke-sqlcmd is failing with not recongnized error , as there are no client components installed on the machine where...

View Article


PowerShell via SQL Agent 2016

Hey all,I can run my PS script just fine via the command line. Yet, when I setup an Agent job for a PowerShell job step and simply call the file "X:\Scripts\File.ps1", it succeeds with no errors;...

View Article


MAXCHARLENGTH in SQL SMO

I export blob data using invoke SQL with the parameters -MaxCharLength and -M

View Article

Invoke-PolicyEvaluation change authentication

Hi all,The PowerShell cmdlet Invoke-PolicyEvaluation only appears to be able to authenticate using the account running the PS console. I need to run a policy against a non-trusted domain using sql...

View Article

DiskSpace

When I run this below piece of code using task scheduler.I get an output where the last server mentioned repeats random number of times.(sometimes it repeats twice or thrice or 5 times or appears...

View Article

Powershell script to find the text between two strings

Hi ,Iam trying to find a script which can loop through the dtsx files and get the connection managers.Get-ChildItem -Path C:\temp\*.dtsx -recurse | Select-String -Pattern "XXX" | Substring (10,20)I...

View Article


'invoke-sqlcmd' is not recognized as the name of a cmdlet

Good day - I have been writing Powershell scripts to use Invoke-sqlcmd to complete some data tasks I need to do.  I am running into cases where I need to run this on other windows servers, but they do...

View Article

Incorrectly displaying values

Declare @tableHTML NVARCHAR(MAX);    Set @tableHTML =        N'<H3>NWH DSR</H3>' +        N'<table border="1">' +&nb

View Article


Issue with powershell command for service down

Hi All,I have migrated (sort of) from the SQL areas :).So I am trying to get an email sent when the MSSQLSERVERAGENT service goes down.I have this script:

View Article

Setting folder access permissions

I found the following code on the internets that appears to do what I want it to, namely grant read and execute access on a folder and all subfolders and files to various AD groups.Project path is the...

View Article


How to zip files using powershell - my own solution

Hello, as I struggled all day today to find out how to zip folders using Powershell I decided to post my solution, just in case anyone has any problems using Google as a source. The latter provides...

View Article

INSERT INTO SQL Server Table

Hi, Help is required with the next step for the code below.  The code connects to SQL Server, executes a stored procedure which outputs a list of perfmon counters.  The values are fed into...

View Article

Consolidating tables from multiple servers

I have a table on each of my servers that tracks permissions.  I use a PS script to populate it once a week.  What I need to do is to use a PS script to go through each of the 15 servers and write the...

View Article
Browsing all 467 articles
Browse latest View live