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

Out-grid view data display

Hi ExpertsI wrote a function to see the SQL Install Features to the Grid. It's coming properly in a single column but I wanted details in two columns (for e.g first column will show the properties for...

View Article


Generate the results in Yellow

Is there anyway, I can format the string to generate the results in Yellow/any other color? Please suggest.Function GET-Temppassword()...

View Article


IF the test-path result is not correct, I don't want to see error mg, instead...

Hello,IF the test-path result is not correct, I don't want to see error mg, instead try max retires and then throw message.clear-hostfunction checkfilelocation(){ $retrycount = 0 $retries = 5 $val =...

View Article

Unable to pass the values between functions (in Grid, no data is being...

Hi ExpertsPlease help in fixing the issues. The variable values from one function to another is not being passed and thereby in show grid, no data is being displayed.Please suggest a best way to send...

View Article

Noob Powershell String Parsing Question

I am very new to Powershell and am trying to solve what appears to be a very simple problem.I have a variable called $TestLocationsThe value of $TestLocations...

View Article


SQL connection using a windows functional ID

I am trying to user PowerShell to connect to a SQL server as follows:Server A - PowerShell script runs here. - Uses Microsoft.SqlServer.Smo namespace to make the connection to Server B - Using...

View Article

Workflow Problem - Newbie

Hello - I have a Central Management Server that keeps enterprise instances. I want to select the instances from those msdb tables into an array and loop through and execute sql statements. Standard...

View Article

How to I get/manage the Win2012R2 Cluster Resource of SQL Server Possible...

How to I get/manage the Win2012R2 Cluster Resources [b]Possible[/b]Owners using Powershell ?[code="other"]$InstanceName = 'D006'Get-ClusterResource -Cluster cl11 -Name "SQL Server ($InstanceName)" |...

View Article


Application Intent with Invoke-SQLcmd

Are you able to specify read-only routing in invoke-SQLcmd? $dataTable = Invoke-Sqlcmd -Query $Query -Database $SourceDatabaseName -ServerInstance $SourceServerName ;maybe add something like -READONLY...

View Article


How to target files in a certain sub dir with get-childitem

Hi All, So I have a list of directories:D:\Data\Load\customer1\ArchiveD:\Data\Load\customer2\ArchiveD:\Data\Load\customer3\ArchiveD:\Data\Load\customer4\ArchiveWe receive files with spaces and i want...

View Article

Invoke-SqlCmd output sql executed

Hi, is it possible to output the sql executed by Invoke-sqlcmd when an inputFile with variables is used ?Thanks in advance,Rui

View Article

Cannot use Powershell to UNZIP files inside SQL Job

Server is running Windows 2008R2 Standard. SQL Server is 2008R2 SP2Code:$path = "I:\SQLBackupsFromPROD"$destination = "I:\SQLBackupsFromPROD\CaaS_Backups" $shell_app= New-Object -com shell.application...

View Article

implementing backup system using PS (a newbie question)

We have a backup system based on TSQL commands:1. A job in the central SQL Server initiate the process once a day.2. The backup details (which database, in which server, to which directory) are saved...

View Article


Powershell for network path

I am totally new to powershell(just 2 days) so please bear my ignorance.Here is the code I am trying to execute as a sql agent job that basically deletes files over 2 days old.[code]function...

View Article

Run DTEXEC from Powershell - convert from batch file

I have the following dtexec command that works fine in a cmd batch file:dtexec /f %DTSPackagesDir%"\%SSISJob%" /Decrypt %DTSPassword% /CONN cm_sql_USTG;%cm_sql_USTG% /Reporting E /Set...

View Article


Executing a simple Powershell command using SQL job

I am trying to delete sql backup files under UNC path from one server to another server. I am getting an error message - An object at the specified path \\PRPWD01V0131\L$\SQLBackup\Archive does not...

View Article

Multithread : Powershell - To execute .sql procedures in multiple servers

Hi ExpertsDoes anyone any implemented any such logic wherein it helps life in deploying multiple scripts in different servers in parallel using multi-thread?Thanks

View Article


Hi

Hey,I am trying to get the SQL Jobs information and its status through powershell.can anyone help me how to retrieve these results to html format wise.can any one give us the code

View Article

Unique items from an array in order

How to get the unique list of Scriptfiles in the order they were added, ie,File2File1[code="plain"]$ScriptPath = "File2"$ServerList = ("ServerB", "ServerC")$DB = ("DB1", "DB2")$ScriptItems = @()foreach...

View Article

SQL agent job failing with cannot open service control manager

Dear list,I am able to run get-services from powershell command window/ise but when I schedule the same script in SQL agent job and execute, it is failing with cannot open service control manager.Can...

View Article
Browsing all 467 articles
Browse latest View live


Latest Images