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

Powershell query to get the Mount Points and the associated LUN ID details

Does anyone has any handy PS query to get the details of each mount point and the associated LUN ID details?If anyone has, please share.

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


Umlauts in my TSQL script are turning to "?" when called from a powershell...

I am using a powershell script to manage releases over multiple servers & databases.when the tsql runs, umlauts are changing to question marks.an example:the...

View Article

SQL Logins output to a file via sp_help_revlogin

Hi all,I'm looking to get sql logins output to a file via powershell.After many different, but unsuccessful searches to find a PS script to retrieve SQL Logins via the stored proc sp_help_revlogin, I'm...

View Article

Script improvement advice.

Hi everyone.Hoping someone could offer me some advice in regards to an issue I am stuck on.My script checks the Tempdb status , I would like the results to a .csv and also display on screen if...

View Article


Printing

I need to schedule a powershell script in a SQL job.The powershell script should silently print pdf files from a UNC path to a network printer.I was able to print from command prompt (not silent...

View Article

deploy SP to multiple database

Is there anyway I can use powershell to deploy a SP to Multiple dabases in same server. I have to depoly the same SP to 50+ databases which I can get the list from sys table in the same server.I am...

View Article

SQL Agent job not failing when Powershell script errors

First time using Powershell. And I'm trying to execute via SQL Agent job. So I don't know if I have something wrong in my Powershell script or my SQL Agent job or Both.SQL Server 2008 R2 PowerShell...

View Article


Powershell query to find all SQL Instance names alone and export to .Txt

I am writing a query to find the SQL Servers which are all UP & Running. While doing so, I find that each instance has multiple SQL Instances. How to write a good powershell query to export all the...

View Article


How do you connect to Central Management Servers if your server has an...

Trying to connect to my CMS using powershell but the server name for CMS has an instance name and all of the script I find online only has the server name.I cant figure out the combination I need to...

View Article

Getting the error - Add-PSSnapin. added snapin "add-pssnapin...

Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version2.At line:1 char:13+ add-pssnapin <<<< SqlServerCmdletSnapin100; + CategoryInfo : InvalidArgument:...

View Article

Reading Event Log: speeding up with If Exists equivalent?

In the Jack of all trades role, i've got a web application , that since it connects to SQL server, somehow also falls under my domain.without digging into the code, i know that at some point, an error...

View Article

Unable to override the values of the configuration.ini file while doing SQL...

HI GuysPlease suggest how would I be able to override the values of $action, $features,$INSTANCENAME , etc....to pass the values in the below section to override the values of "install" by "uninstall"...

View Article


Need double quote in between a variable (Stirng Operation)

Hi Experts,Please help me getting a double quote in between the string. Thereafter I will write a logic to delete that specific folder which I can easily manage through test-path.$INSTALLSHAREDDIR =...

View Article

How to add a comma in between two strings

Hi,I want to add a comma in between these two strings. "domain1\OracleDBATeam" "domain1\SQLDBA TEAM"I tried with the below approach:$SQLSYSADMINACCOUNTS = Get-Content...

View Article


Unable to read the encrypted password.

HiI used the below command to accept password. But unable to print the password entered.Please help me with the correct format to decrypt the password? I don't want to hard-code the password to my...

View Article

Script to find if a SQL Server Instance Exist

Kindly provide a good script to check if a sql server instance does exist. If not need to throw a good alert. I'm trying using the below script, but taking long time to execute. Any better way to write...

View Article


Check Existence of server with search progress and time took to retrieve the...

Hi,I am trying to search if a server is present, it will show the progress (using write-progress activity in a loop) and tell me the time it took to fetch the details. Unable to compose the script to...

View Article

Execute SQL Script on remote server with another windows account

Hi All,I have a set of SQL server Instances in another domain connected to my machine. These instances use windows authentication to login and all the instances use different accounts.I am trying to...

View Article

Unable to generate the results in a proper pipe or ";" delimited format

HiNeed the output of the results to a comma / semi colon / pipe delimited format.Function RunningSQLServices{[CmdletBinding()] Param ( [Parameter(Position=0,Mandatory=$true)][string]$filepath #Enter...

View Article
Browsing all 467 articles
Browse latest View live