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

PowerShell module into SQL Server

Hello,I'm trying to find a way to burry my PS module into extended stored procedure(XP) in sql server. Any help in guiding me in this direction is highly appreciated.Thanks in AdvanceJagan K

View Article


move files from server to server

Hi,I need to move the files base on the query from sql database. The files name is on the table, and I need to move these files to another sever. I was looking at this,...

View Article


Powershell and Excel and SQL Server

Is there a way to read an entire Excel sheet into a Powershell variable, including the values as well as the cell formatting (specifically, Interior.ColourIndex), as opposed to the RBAR-CBAC (Cell By...

View Article

Fail sql job if error is encountered in powershell script

I have a powershell script that has 2 steps. The script is called by a SQL agent job. If a step fails, it is sending back the error to the job but wasn't actually failing the job. I found if I use...

View Article

Forms and controls

I'm trying to generate a dynamic control from data in SQL Server.The number of rows is variable, as is the visibility of the individual radiobuttons.criteria1 radiobutton1 radiobutton2 radiobutton3...

View Article


Need a way to script out LinkedServers on a SQL 2005\2008 boxes but place the...

If I run this it scripts them out all into one file. Can this be adjusted to put them in to individual files or is there a better way to do this?Add-PSSnapin SqlServerCmdletSnapin100Add-PSSnapin...

View Article

Powershell code encapsulation into exe with dynamic parameters

Might be anyone could help with solution. I need to encapsulate powershell logic into exe. At the moment I am calling *.ps1 file using an agent job with passing to it parameter. Works fine, no issues....

View Article

Copy file to folder with current date

HiI am trying to copy a multiple files the have the current date as the creation date using a wild card but can't seem to get the syntax correct. Any help would be appreciated.Copy-item...

View Article


Powershell using SMO is painfully slow

this is probably more of a rant than a request for a solution....I threw a ton of time adapting and enhancing the script found in another topic...

View Article


Powershell within SQL 2012 SP1 can not load any modules

I have been attempting to run a Powershell script from a SQL Server agent job on SQL2012. The script runs fine in SQL 2008R2 however, I receive the below error when attempting to import any module in...

View Article

Powershell Multithreading with SQL Agent

Hello All,So I have 4 SQL Agent jobs that all run PowerShell scripts that utilize the multithreading abilities of PowerShell but I am running into issues. These 4 jobs are set to run every 5 minutes...

View Article

Problem with Powershell and SQL Agent Job token

I'm working on a script that will transfer SQL Agent Jobs to another job server. One of the jobs uses the SQL Agent Token in a step:[code="sql"]WHERE job_id = $(ESCAPE_SQUOTE(JOBID)) [/code]Once the...

View Article

SQL Server documentation using Powershell

Hi allI have been using SQL Power Doc to document my instances. [url]https://sqlpowerdoc.codeplex.com/wikipage?title=Guide%20For%20PowerShell%20Beginners[/url].I am in the process of running the...

View Article


Syntax error help please

Hello EveryoneI am running the below script which is meant to check the creation date of certain files and send an email if the file is missing or if the creation date is not current date. When I run...

View Article

Getting My List of Databases as an array?

Fairly new to powershell, but not to programming.I've got the script below, that i [b]thought[/b] was going to create a array that i could lop through.when i write out the contents, i'm getting the #...

View Article


Continue on error in foreach

I have PS that select all instance setup in CMS and then using that list does a foreach check for errors in the database mail log. IF all instance connect it runs great but if it cant connect to one...

View Article

Filtering Get-ChildItem results with -LIKE?

i cannot for the life of me pinpoint my error here.this should be fairly simple: find matching files, and print em out before i explicitly delete them.i'm trying to test each file in a folder to match...

View Article


***-PSSnapin SQLServerCmdLetSnapin110 ....cannot add

HelloI have gotten part of this powershell script from the web, and first part configured by me.#Define Variables and configure variables#----------------------------------------#First Set the target...

View Article

Dynamically creating / evaluating variables

I can't remember where I saw this, and can't find it now :-(I want the value of $cTime to be the current value of $Hourly8, namely, 10$Hourly8 = 10$Hour = 8$Var = $($('$Hourly'+$Hour))set-Variable...

View Article

Move Logins via SMO

It's possible to create in Powershell, a script that move the login from a source server to a destination server, including the password ?I tried to use the sp_help_revlogin procedure, but I'm unable...

View Article
Browsing all 467 articles
Browse latest View live