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

SQL Server 2000

Hi community, Question: I have to copy tables+data from a database in sql server 2000 to a sql server 2008r2 database where this table does not exist. Is possible to do it with PowerShell ?? Thanks for...

View Article


Generate Create Script for a table - include indexes, keys, statistics

I spent yesterday trying various approaches to this found on google. Couldn't get any to work. What I'm looking for is a powershell script that will work for a single table, generating the create...

View Article


Parameter on Powershell Script

I'm having some problems sending parameters to a Powershell script when it includes a dash (-) in it. Here's an example on what I'm trying to do. The script is made to run an SSIS package from...

View Article

Powershell help

Hi Experts, Is there is powershell script which displays top 10 database tables taking up more space in each database on that sql instance in a nice HTML table format. I am not an powershell expert and...

View Article

Need help in modifying powershell script

Hi Powershell Experts, I have below PS script which will display the database file info like dbname, physicalfilename, size, free,used etc. It is working fine for 1 instance. However, I want this to...

View Article


SQL Powershell help

Hi All, Need some help in SQL Powershell. I got the below script from the powershell community. This report works perfectly fine. This is sql powershell report which gives info abt the database files...

View Article

Group-object question

Let's suppose I have $objTable, a SQL Server table object, with 3 columns: nUnitType_Id cE_Descritpion cF_Description I swear that at one point a few months ago, this bit of code was returning...

View Article

Set variable values when calling a SQL Agent Job from PowerShell

Hi guys, Is it possible to set variable values when calling a SQL Agent Job from PowerShell? If we can, can somebody please direct me to some documentation? Thanks is advance :-)

View Article


SQL Policy Management - Invoke-PolicyEvaluation - remote policy file path

Hi, I'm trying to call a number of XML SQL Management Policy files using a remote network path e.g. Invoke-PolicyEvaluation -TargetServer "instancename" -Policy "\\servername\policy.xml" This results...

View Article


how add contents of the string to 2 table objects

Hi, I have string with following format $string = @' AvgSQLCpu,AVGCpu,AVGOtherCpu 100,97,2 alertType,alertStatus,alertGenerate,alertDetails HIGHCPU,ERROR,0, '@ I have 2 table objects [object] $tbl1 =...

View Article

Free eBook from PacktPub: Getting Started with PowerShell - 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

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

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

View Article

Help needed with multiple invoke-sqlcmd commands

Hi , I am using invoke-sqlcmd cmdlet to fetch the data initially then use that data to fetch other details (looping through these details) code: Import-module sqlpls $instance = <servername>...

View Article


Powershell profile and VS2013

Is there a way to set up Visual Studio 2013 so that my profile.ps1 runs on startup, or do I just have to load the SQLServer modules as needed in each script?

View Article

Help calling PowerShell Function via SSIS EPT

Hi, I successfully tested this by using the following expression: "-ExecutionPolicy Unrestricted -File \"" + @[User::Script_Path] + "\\Exec PoSh Script.PS1\" \"" + @[User::FirstName] + "\" \"" +...

View Article


Powershell to send email with attachment only if file is full

Hi All, Hope All is Well. I am new to powershell. I am trying to attach a txt file using the following in a ps file and it works well. Send-MailMessage -To <> -From <> -Subject "System...

View Article

Powershell vs Sqlcmd

Hi there, I'm wondering if anyone can explain whether I should be using Powershell instead of Sqlcmd, or as well as, which is best for certain situations and what the main differences are between them....

View Article


parsing records with empty spaces

I have text  data in following format ‌ServerName      Server.db             PowerUser   RoleSERVER1       &nb

View Article

pipe result to a .csv or .txt files

Hi All,i find it hard to pick up powershell...need some help here.... .i have some result as below:PS C:\Users\xxx> $strReference = Get-Content "C:\temp\cep\book1.csv"PS C:\Users\xxx>...

View Article

SQL SERVER PS. Retreive Databases and Database Roles from instances

I will like to Retrieve Databases  and  Database Roles from many instances in the domain with a PS script. have someone already done something similar? Do you have a script?can you do it for one...

View Article
Browsing all 467 articles
Browse latest View live