Viewing 15 posts - 106 through 120 (of 486 total)
You're passing a DBname, but the class expects a database object:
$Server = New-Object Microsoft.SqlServer.Management.Smo.Server $TargetServer
$objDB = $Server.Databases[$dbname]
$NewRole = New-Object Microsoft.SqlServer.Management.Smo.DatabaseRole ($objDB, $RoleName)
$NewRole.Create()
August 3, 2016 at 8:03 am
Got it:
$object = $objSrcDB.Discover() | ?{$_.Name -eq $objName}
June 16, 2016 at 7:07 am
I was able to get it sorted using PsExec and the instructions here.
https://www.mssqltips.com/sqlservertip/2682/recover-access-to-a-sql-server-instance/
Phew.
Thanks gents.
P
May 3, 2016 at 12:05 pm
No luck with the -E -A with my own local admin account.
We're using a domain\account to run the SQL Server service. That account has the same privs as my own,...
May 3, 2016 at 11:49 am
This worked a charm: $OutputEncoding = New-Object System.Text.UnicodeEncoding($false, $false)
Thanks Gary!
March 31, 2016 at 5:28 am
Say, that's a good link. Not sure how I never came across it..
Thanks for posting.
P
February 11, 2016 at 12:51 pm
Ah, right!
See these Options in the Smo.Transfer class.
$xfr.Options.DriAll = $true
$xfr.Options.DriForeignKeys = $true
$xfr.Options.DriUniqueKeys = $true
$xfr.Options.DriChecks = $true
$xfr.Options.DriUniqueKeys = $true
$xfr.Options.ClusteredIndexes = $true
$xfr.Options.NonClusteredIndexes = $true
then, call the script method on the transfer...
February 11, 2016 at 11:48 am
Found this at https://technet.microsoft.com/en-us/library/ms162153%28v=sql.105%29.aspx
Scripting Out the Dependencies for a Database in PowerShell
This code example shows how to discover the dependencies and iterate through the list to display the results.
# Set...
February 11, 2016 at 10:44 am
The Powershell would look something like this. I haven't tested it (the -o part may need some work).
One problem with the *.SQL files-in-this-folder approach is that one may run into...
November 19, 2015 at 9:02 am
Try this in Powershell: this basic functionality is relatively simple to learn.
You'll never go back to .bat
November 19, 2015 at 6:03 am
Yep, all good: when I replace TransferData() with ScriptTransfer(), the appropriate code is spewed out.
It's the TransferData() method that's broken.
Both source and dest servers (in my implementation) show Monitor...
October 15, 2015 at 10:10 am
Version 10 of smo and smoextended are both there; same on my SQL Servers.
October 15, 2015 at 10:00 am
We've developed a couple of apps using ORM and E/F. As far as I can see, they are supposed to obviate the DBA.
And they worked -- for a while. But...
September 2, 2015 at 6:19 am
Got it:
$Code = "*_GOL_*"
Get-ADGroup -Filter {(name -like $Code)} | select -ExpandProperty name
Thanks!
September 2, 2015 at 6:04 am
Viewing 15 posts - 106 through 120 (of 486 total)