Viewing 15 posts - 31 through 45 (of 64 total)
Try modifying the RedgateRestore function, adding the $SQLCommand.CommandTimeout line below.
$SQLCommand = New-Object system.Data.SqlClient.SqlCommand($SQLQuery, $SQLConnection)
$SQLCommand.CommandTimeout = 10000
$SQLCommand.ExecuteNonQuery() | Out-Null
Setting the CommandTimout value to 10,000 was completely...
May 17, 2012 at 7:18 am
If the restore is happening the only thing left is the ChageDBOwner function. Make any modifications there? Try sending $SQLQuery out to a file and check that it's...
May 16, 2012 at 1:11 pm
Try
$FullPath2 = [Regex]::Replace(a.FullPath, "Q:", "")
May 4, 2012 at 12:31 pm
No need to read-host. I added that "param ( [switch]$disable )" line so you can add -disable (or not) to the command line when calling your script.
For example, if...
April 16, 2012 at 8:59 am
You just missed a couple of small things but they do make a difference.
First -like and -match work differently
Second, in your line $jobs.IsEnabled = $TRUE
$jobs is a collection of the...
April 16, 2012 at 7:51 am
If you're still interested in a Powershell method try this.
Add-Type -AssemblyName "Microsoft.SqlServer.Smo, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" -EA Stop
foreach ($server in $(Get-Content -Path serverList.txt)) {
$srvObject = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Server...
March 22, 2012 at 8:33 am
Great script Lowell, it’s definitely going in my traveling SQL bag. Thanks.
March 2, 2012 at 7:27 am
The Script method of the Mail object doesn't get the SMTP server information and neither does the Script method for the Accounts object. I guess it's just an SMO...
March 2, 2012 at 6:47 am
Glad you liked it. Here's what I use for operators.
# Configure the SQL Agent to use dbMail and add operators .
$sqlSrvObject.JobServer.AgentMailType = 'DatabaseMail'
...
February 22, 2012 at 6:15 am
Try replacing $ds.Tables[0] | out-gridview
with
foreach ($dataRow in $ds.Rows) {
$dataRow ["suid"]
$dataRow ["status"]
$dataRow ["accdate"]
$dataRow ["totcpu"]
...
February 20, 2012 at 8:21 am
Just an FYI if you run Get-Help Select-Sting where you see -Pattern <string[]) that [] means -Pattern takes an array. That applies to all items with a <string[]> in...
February 16, 2012 at 4:06 pm
Try
Select-String -pattern "Found file", "Records IN", "File copied" |
February 16, 2012 at 1:28 pm
Not sure why your're still getting errors. I'd check those servers manually just to make sure it's not a WMI availability, OS version or permissions issue.
February 16, 2012 at 9:31 am
If it fails on the same servers every time it could be an issue with the txt file. I've seen a copy/paste from an outlook email to a txt...
February 16, 2012 at 8:30 am
If you have access to Powershell it's a three liner
Add-Type -AssemblyName "Microsoft.SqlServer.Smo, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" -EA Stop
$srvObj = new-object -TypeName Microsoft.SqlServer.Management.Smo.Server -ArgumentList 'YourServerNameHere'
$srvObj.Logins | Where {$_.LoginType -eq 'SQLLogin'} | Select...
January 31, 2012 at 10:56 am
Viewing 15 posts - 31 through 45 (of 64 total)