this is probably more of a rant than a request for a solution....I threw a ton of time adapting and enhancing the script found in another topic here:[b][url=http://www.sqlservercentral.com/Forums/Topic1240480-1351-1.aspx]Powershell script to script out jobs, databases, users, linked servers, logins, roles, alerts, etc from a list of servers [/url][/b]if you looked at it, each function creates it's own instance of a [i]$srv = "Microsoft.SqlServer.Management.Smo.Server" [/i]and does it's scripting work; i added some additional stuff that scripts out each database objects.tested it on a single box, get the script results i like, and modify the txt file to have a few more for a more robust test.just ten servers took hours with the original code; moving the SqlServer.Management.Smo.Server and other objects out of the functions,and passing them in speeded things up some, but [b]dayum[/b]; in this world of instant satisfaction, powershell is looking to me like one of those overnight batch processing things.I've found an SMO tweak like setting $Server.SetDefaultInitFields($true) so things load up front, instead of when they are referenced, but still, it's painfully slow; if i needed to scan or re-scan a list of 20 or more servers, it's going to take all day. I'd need to start adding logic to skip if exists instead of letting it always script, just to squeeze a bit of performance.
↧