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

Registry Keys on multiple SQL instances

Hello,I can't figure this out.... I'm on PowerShell version 2, and version 4, and just starting to learn PS.This is a very basic code to find the location of the errorlog on the registry.I know we can...

View Article


Poweshell script to script out jobs, databases, users, linked servers,...

create a c:\servers.txt file with list of serversand copy the following into a file .ps1enjoyfunction getwmiinfo ($svr) { gwmi -query "select * from Win32_ComputerSystem" -computername $svr | select...

View Article


Project ideas for DBA to advance in powershell

Hi, I need forum brainstorm with powershell project ideas based on limitation of working environment Environment 1. PS Version 2 (will not move to any other version soon) 2.my account Not a local admin...

View Article

need help passing argument to script or function called in Start-JOB

Hi, I am automating delete from personal mailbox mails to be placed in 60 different folders and over weekend total number of email could be 10000+ initially I created function that get subfolder name...

View Article

Parse the Data and pump it onto SQL Sever

Hello All,I have a requirement to pump the data from .txt file into SQL table. I was able to do this in the past. but this time i have a problem in the data format. Below is the sample of data format...

View Article


New-Object Confusion.

Hello,I am really confused about something.$DBServer = "ServerName"$DBServerport = "1433"If I type in the following...[code="plain"][/code]$server = New-Object -TypeName...

View Article

Using SQL Switches in a PowerShell Script to Suppress Headers

Hi,I'm new to using PowerShell to process a SQL Query. The query that I'm trying to process is from the Project Server ProjectWebApp database. I came across the following code that seems well...

View Article

Reading a table from a text file

Hello,There got to be a easier way.I'm writing a script that reads the Summary.txt file when we patch SQL.If the server has multiple instances, I want to read those instances from the Summary.txt...

View Article


Ransomware trojan enters via Powershell script contained in Word macros

It's translated from a German security researcher web page, so it isn't easy to read but it is...

View Article


ConvertTo-CSV losing accent characters

I'm trying to ConvertTo-CSV ... | Clip (ie, to Clipboard), so I can paste into Excel and work with my data.Working spectacularly in English, but losing accented/special characters in French.Any ideas...

View Article

Sending email via Powershell with Attachment

HelloPlease draft the script to send mail to recipients with attachment.Regards

View Article

Modify a dtsConfig file using Powershell

Hello SSC,The objective here is to dynamically update all dtsconfig files for deployment on three tier architecture (dev, UAT, prod), to make deployment easier and more efficient. We have several SSIS...

View Article

Modify a dtsConfig file using Powershell part 2

Hello,I am trying to update a connection string in an XML file using POWERSHELL. I have the following code that is not working. I have a code snippet for the XML file and my PS script below.Any help...

View Article


modify XML config file with POWERSHELL

Hello,I am trying to update a connection string in an XML file using POWERSHELL. I have the following code that is not working. I have a code snippet for the XML file and my PS script below.Any help...

View Article

Powershell script to modify config file

Hello,I have posted many questions about modifying config files using Powershell, since I am relatively new to PS. I finally got the darn thing working, but now my boss gave me a config file that has a...

View Article


Output formatting and for loop issue

I have this powershell code which goes through a list of servernames in a text file and outputs the corresponding values as here.CODE:$Results = Foreach ($Server in (get-content...

View Article

Formatting output to pass as part of a where clause from Select_Object

I am really new to PS and I am trying to write a script to set up our AGs with RegisterProviderAllIPs = 0. In order to do this, I need to get the name of the Network Name associated with the AG. For...

View Article


Servers in a domain

Does this code create the list of servers available within a domain ?System.Data.Sql.SqlDataSourceEnumerator]::Instance.GetDataSources() | SELECT ServerName | Format-Table -HideTableHeaders >>...

View Article

Autoalert if SQLAgent stops

Typed in services.mscSelect SQLAgent->Properties->Recovery->Under First Failure select - >Run a ProgramUnder program ->Path to the powershell executableUnder command ->-Command...

View Article

Powershell script for SSIS 2012 build and deployment

HI All, I need Powershell script sample for Build and Deployment of SSIS 2012 packages . we are using SSISDB. If possible, please provide sample ssis solution and powershell scripts so I will able to...

View Article
Browsing all 467 articles
Browse latest View live