{"id":1049,"date":"2019-07-18T15:52:35","date_gmt":"2019-07-18T20:52:35","guid":{"rendered":"http:\/\/www.sqlnuggets.com\/?p=1049"},"modified":"2019-07-18T15:52:40","modified_gmt":"2019-07-18T20:52:40","slug":"patching-multiple-sql-servers-with-powershell-and-dbatools","status":"publish","type":"post","link":"https:\/\/sqlnuggets.com\/patching-multiple-sql-servers-with-powershell-and-dbatools\/","title":{"rendered":"Patching Multiple SQL Servers With Powershell and dbatools"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright\" src=\"https:\/\/sqlnuggets.com\/wp-content\/uploads\/2018\/09\/dbatools-logo-1.png\" alt=\"This image has an empty alt attribute; its file name is dbatools-logo-1.png\" width=\"223\" height=\"64\" \/>Patching SQL Server can sometimes be a time consuming process, especially when you have multiple servers that need to be patched. Remoting in to each box to run through the update wizard is tedious, and if you have multiple patches to apply you&#8217;re going to be spending a considerable chunk of time on it.<\/p>\n\n\n<p>Thankfully, the <a rel=\"noreferrer noopener\" aria-label=\"dbatool Powershell Module (opens in a new tab)\" href=\"https:\/\/dbatools.io\/\" target=\"_blank\">dbatool Powershell Module<\/a> makes this process much easier!  In fact, once you get it figured out, using <a rel=\"noreferrer noopener\" aria-label=\"Update-DbaInstance (opens in a new tab)\" href=\"https:\/\/docs.dbatools.io\/#Update-DbaInstance\" target=\"_blank\">Update-DbaInstance<\/a> to patch your SQL Servers becomes very simple.  But, getting it figured out can be a little confusing, so I&#8217;ve outlined the steps below that I use.  The biggest hangups I had were setting up a central patching location and using a credential to access it. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Set Up A Central Patching Location <\/h3>\n\n\n\n<p>First, you need a network share to put your SQL Server patches on.  This share needs to be accessible by all of the SQL Servers you are wanting to install updates on.  What works for me is to have a directory structure of &#8216;SQLSERVER\/VERSION\/SP\/CU&#8217;, which contains each executable file in the appropriate directory. So, for patching SQL Server 2016 I would have a path of &#8216;SQLSERVER\/2016\/SP2\/&#8217; which will look something like this:<br><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"465\" height=\"117\" src=\"https:\/\/sqlnuggets.com\/wp-content\/uploads\/2019\/07\/sql-sp2-filelist.png\" alt=\"\" class=\"wp-image-1048\" srcset=\"https:\/\/sqlnuggets.com\/wp-content\/uploads\/2019\/07\/sql-sp2-filelist.png 465w, https:\/\/sqlnuggets.com\/wp-content\/uploads\/2019\/07\/sql-sp2-filelist-300x75.png 300w\" sizes=\"auto, (max-width: 465px) 100vw, 465px\" \/><\/figure>\n\n\n\n<p>Note that the SP2 directory contains the executable for SP2, as well as the directories for the other various CU updates that apply to SP2.  Now all we have to do is specify the network path in our <em>Update-DbaInstance<\/em> call and it can find the patches that it needs.  In my case I typically specify the root of the SP directory (SP2 in this case), and dbatools will figure out the CU level on its own from there.  In theory, I could just point it to the root SQLSERVER\/2016 directory (not shown) and it&#8217;s supposed to figure out what patches to apply. However I did not try from there, so I cannot say if it works or not. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Using A Credential With dbatools<\/h3>\n\n\n\n<p>This one stumped me for a bit.  Once you figure it out it is super simple, but it took me a little while to find examples and get it working.  For this you have to use the <a rel=\"noreferrer noopener\" aria-label=\"Get-Credential (opens in a new tab)\" href=\"https:\/\/docs.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.security\/get-credential\" target=\"_blank\">Get-Credential<\/a> cmdlet, and then pass the credential in to the <em>Update-DbaInstance<\/em> call.  <em>Get-Credential<\/em> isn&#8217;t part of the dbatools library, but rather a native powershell command. <\/p>\n\n\n\n<p>Running the following command will create a credential for your Active Directory account and save it in a variable named &#8220;cred&#8221;.  When you execute this command, it will prompt you for your AD password.<\/p>\n\n\n<pre class=\"lang:ps decode:true \">#create a credential\n$cred = Get-Credential DOMAIN\\your.account<\/pre>\n\n\n<h3 class=\"wp-block-heading\">Specifying A Patch Level<\/h3>\n\n\n\n<p>One of the really nice things that <em>Update-DbaInstance<\/em> allows you to do is specify the patch level that you want to update your SQL Servers to.  So, even though I have CU7 listed in my shared directory, I can tell <em>Update-DbaInstance<\/em> to only patch up to CU5 if I want.  To do this, just specify a &#8220;version&#8221; in your command.<\/p>\n\n\n\n<p>This took a little big of digging, and trial and error, for me, as I couldn&#8217;t find an details around how to format the version.  But, basically you would specify the version in the format of &#8220;2016SP2CU5&#8221; for patching SQL 2016 to SP2 CU5.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Here&#8217;s The Full Script<\/h3>\n\n\n\n<p>Ok, enough talking (typing?), I know you only came to get the full script.  One of the things I always do is run <a href=\"https:\/\/docs.dbatools.io\/#Get-DbaBuildReference\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Get-DbaBuildReference (opens in a new tab)\">Get-DbaBuildReference<\/a> to ensure that dbatools knows what the latest updates are.  Here it is, with comments:<\/p>\n\n\n<pre class=\"lang:ps decode:true \">#Update the Build Reference so DBATOOLS is aware of the latest SP\/CU versions\n#Set the versions to whatever version you're using\nGet-DbaBuildReference -MajorVersion 2016 -ServicePack 2 -Update\n\n#create a list of servers that you want to patch\n$ServerList = 'SQL01','SQL02','SQL03'\n\n#create a credential to pass in to the Update-DbaInstance command; this will prompt for your password\n$cred = Get-Credential DOMAIN\\your.account\n\n#Set the version that you want to update to\n$version = '2016SP2CU5'\n\n#Start Patching! The -Restart option will allow it to restart the SQL Server as needed\nUpdate-DbaInstance -ComputerName $ServerList -Path '\\\\network\\share\\path\\SQLSERVER\\2016\\SP2\\' -Credential $cred -Version $version -Restart\n<\/pre>\n<p><\/p>\n\n\n<p><br>And that&#8217;s it!  I have been testing and using this script a little bit for the last several months to do my SQL Server patching, and have decided that this is going to be my default patching method going forward. <br> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Patching SQL Server can sometimes be a time consuming process, especially when you have multiple servers that need to be patched. Remoting in to each box to run through the &#8230;<\/p>\n","protected":false},"author":2,"featured_media":841,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[20],"tags":[21,66,17],"class_list":["post-1049","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-automation","tag-dbatools","tag-server-administration"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Patching Multiple SQL Servers With Powershell and dbatools - SQL Nuggets<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.sqlnuggets.com\/patching-multiple-sql-servers-with-powershell-and-dbatools\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Patching Multiple SQL Servers With Powershell and dbatools - SQL Nuggets\" \/>\n<meta property=\"og:description\" content=\"Patching SQL Server can sometimes be a time consuming process, especially when you have multiple servers that need to be patched. Remoting in to each box to run through the ...\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.sqlnuggets.com\/patching-multiple-sql-servers-with-powershell-and-dbatools\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL Nuggets\" \/>\n<meta property=\"article:published_time\" content=\"2019-07-18T20:52:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-07-18T20:52:40+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.sqlnuggets.com\/wp-content\/uploads\/2018\/07\/powershell4.png\" \/>\n\t<meta property=\"og:image:width\" content=\"670\" \/>\n\t<meta property=\"og:image:height\" content=\"250\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Eric Cobb\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@cfgears\" \/>\n<meta name=\"twitter:site\" content=\"@sqlnugg\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Eric Cobb\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\\\/\\\/www.sqlnuggets.com\\\/patching-multiple-sql-servers-with-powershell-and-dbatools\\\/#article\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/www.sqlnuggets.com\\\/patching-multiple-sql-servers-with-powershell-and-dbatools\\\/\"},\"author\":{\"name\":\"Eric Cobb\",\"@id\":\"http:\\\/\\\/www.sqlnuggets.com\\\/#\\\/schema\\\/person\\\/210536254addbc1b9d2d95dc1448b38a\"},\"headline\":\"Patching Multiple SQL Servers With Powershell and dbatools\",\"datePublished\":\"2019-07-18T20:52:35+00:00\",\"dateModified\":\"2019-07-18T20:52:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\\\/\\\/www.sqlnuggets.com\\\/patching-multiple-sql-servers-with-powershell-and-dbatools\\\/\"},\"wordCount\":620,\"commentCount\":29,\"publisher\":{\"@id\":\"http:\\\/\\\/www.sqlnuggets.com\\\/#organization\"},\"image\":{\"@id\":\"http:\\\/\\\/www.sqlnuggets.com\\\/patching-multiple-sql-servers-with-powershell-and-dbatools\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/sqlnuggets.com\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/powershell4.png\",\"keywords\":[\"Automation\",\"dbatools\",\"Server Administration\"],\"articleSection\":[\"PowerShell\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\\\/\\\/www.sqlnuggets.com\\\/patching-multiple-sql-servers-with-powershell-and-dbatools\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\\\/\\\/www.sqlnuggets.com\\\/patching-multiple-sql-servers-with-powershell-and-dbatools\\\/\",\"url\":\"http:\\\/\\\/www.sqlnuggets.com\\\/patching-multiple-sql-servers-with-powershell-and-dbatools\\\/\",\"name\":\"Patching Multiple SQL Servers With Powershell and dbatools - SQL Nuggets\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/www.sqlnuggets.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\\\/\\\/www.sqlnuggets.com\\\/patching-multiple-sql-servers-with-powershell-and-dbatools\\\/#primaryimage\"},\"image\":{\"@id\":\"http:\\\/\\\/www.sqlnuggets.com\\\/patching-multiple-sql-servers-with-powershell-and-dbatools\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/sqlnuggets.com\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/powershell4.png\",\"datePublished\":\"2019-07-18T20:52:35+00:00\",\"dateModified\":\"2019-07-18T20:52:40+00:00\",\"breadcrumb\":{\"@id\":\"http:\\\/\\\/www.sqlnuggets.com\\\/patching-multiple-sql-servers-with-powershell-and-dbatools\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\\\/\\\/www.sqlnuggets.com\\\/patching-multiple-sql-servers-with-powershell-and-dbatools\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\\\/\\\/www.sqlnuggets.com\\\/patching-multiple-sql-servers-with-powershell-and-dbatools\\\/#primaryimage\",\"url\":\"https:\\\/\\\/sqlnuggets.com\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/powershell4.png\",\"contentUrl\":\"https:\\\/\\\/sqlnuggets.com\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/powershell4.png\",\"width\":670,\"height\":250},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\\\/\\\/www.sqlnuggets.com\\\/patching-multiple-sql-servers-with-powershell-and-dbatools\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\\\/\\\/www.sqlnuggets.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Patching Multiple SQL Servers With Powershell and dbatools\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\\\/\\\/www.sqlnuggets.com\\\/#website\",\"url\":\"http:\\\/\\\/www.sqlnuggets.com\\\/\",\"name\":\"SQL Nuggets\",\"description\":\"Nuggets Of SQL Server Knowledge\",\"publisher\":{\"@id\":\"http:\\\/\\\/www.sqlnuggets.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\\\/\\\/www.sqlnuggets.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\\\/\\\/www.sqlnuggets.com\\\/#organization\",\"name\":\"SQL Nuggets\",\"url\":\"http:\\\/\\\/www.sqlnuggets.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\\\/\\\/www.sqlnuggets.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/sqlnuggets.com\\\/wp-content\\\/uploads\\\/2023\\\/11\\\/website-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/sqlnuggets.com\\\/wp-content\\\/uploads\\\/2023\\\/11\\\/website-logo.jpg\",\"width\":320,\"height\":54,\"caption\":\"SQL Nuggets\"},\"image\":{\"@id\":\"http:\\\/\\\/www.sqlnuggets.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/sqlnugg\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/ericcobb\\\/\"]},{\"@type\":\"Person\",\"@id\":\"http:\\\/\\\/www.sqlnuggets.com\\\/#\\\/schema\\\/person\\\/210536254addbc1b9d2d95dc1448b38a\",\"name\":\"Eric Cobb\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3ca1fc0c7054a668e048f09d412cd4ebf89833c4630fbbfccca78a0678a6bdc2?s=96&d=mm&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3ca1fc0c7054a668e048f09d412cd4ebf89833c4630fbbfccca78a0678a6bdc2?s=96&d=mm&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3ca1fc0c7054a668e048f09d412cd4ebf89833c4630fbbfccca78a0678a6bdc2?s=96&d=mm&r=pg\",\"caption\":\"Eric Cobb\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/cfgears\"],\"url\":\"https:\\\/\\\/sqlnuggets.com\\\/author\\\/eric-cobb\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Patching Multiple SQL Servers With Powershell and dbatools - SQL Nuggets","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/www.sqlnuggets.com\/patching-multiple-sql-servers-with-powershell-and-dbatools\/","og_locale":"en_US","og_type":"article","og_title":"Patching Multiple SQL Servers With Powershell and dbatools - SQL Nuggets","og_description":"Patching SQL Server can sometimes be a time consuming process, especially when you have multiple servers that need to be patched. Remoting in to each box to run through the ...","og_url":"http:\/\/www.sqlnuggets.com\/patching-multiple-sql-servers-with-powershell-and-dbatools\/","og_site_name":"SQL Nuggets","article_published_time":"2019-07-18T20:52:35+00:00","article_modified_time":"2019-07-18T20:52:40+00:00","og_image":[{"width":670,"height":250,"url":"http:\/\/www.sqlnuggets.com\/wp-content\/uploads\/2018\/07\/powershell4.png","type":"image\/png"}],"author":"Eric Cobb","twitter_card":"summary_large_image","twitter_creator":"@cfgears","twitter_site":"@sqlnugg","twitter_misc":{"Written by":"Eric Cobb","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/www.sqlnuggets.com\/patching-multiple-sql-servers-with-powershell-and-dbatools\/#article","isPartOf":{"@id":"http:\/\/www.sqlnuggets.com\/patching-multiple-sql-servers-with-powershell-and-dbatools\/"},"author":{"name":"Eric Cobb","@id":"http:\/\/www.sqlnuggets.com\/#\/schema\/person\/210536254addbc1b9d2d95dc1448b38a"},"headline":"Patching Multiple SQL Servers With Powershell and dbatools","datePublished":"2019-07-18T20:52:35+00:00","dateModified":"2019-07-18T20:52:40+00:00","mainEntityOfPage":{"@id":"http:\/\/www.sqlnuggets.com\/patching-multiple-sql-servers-with-powershell-and-dbatools\/"},"wordCount":620,"commentCount":29,"publisher":{"@id":"http:\/\/www.sqlnuggets.com\/#organization"},"image":{"@id":"http:\/\/www.sqlnuggets.com\/patching-multiple-sql-servers-with-powershell-and-dbatools\/#primaryimage"},"thumbnailUrl":"https:\/\/sqlnuggets.com\/wp-content\/uploads\/2018\/07\/powershell4.png","keywords":["Automation","dbatools","Server Administration"],"articleSection":["PowerShell"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/www.sqlnuggets.com\/patching-multiple-sql-servers-with-powershell-and-dbatools\/#respond"]}]},{"@type":"WebPage","@id":"http:\/\/www.sqlnuggets.com\/patching-multiple-sql-servers-with-powershell-and-dbatools\/","url":"http:\/\/www.sqlnuggets.com\/patching-multiple-sql-servers-with-powershell-and-dbatools\/","name":"Patching Multiple SQL Servers With Powershell and dbatools - SQL Nuggets","isPartOf":{"@id":"http:\/\/www.sqlnuggets.com\/#website"},"primaryImageOfPage":{"@id":"http:\/\/www.sqlnuggets.com\/patching-multiple-sql-servers-with-powershell-and-dbatools\/#primaryimage"},"image":{"@id":"http:\/\/www.sqlnuggets.com\/patching-multiple-sql-servers-with-powershell-and-dbatools\/#primaryimage"},"thumbnailUrl":"https:\/\/sqlnuggets.com\/wp-content\/uploads\/2018\/07\/powershell4.png","datePublished":"2019-07-18T20:52:35+00:00","dateModified":"2019-07-18T20:52:40+00:00","breadcrumb":{"@id":"http:\/\/www.sqlnuggets.com\/patching-multiple-sql-servers-with-powershell-and-dbatools\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.sqlnuggets.com\/patching-multiple-sql-servers-with-powershell-and-dbatools\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.sqlnuggets.com\/patching-multiple-sql-servers-with-powershell-and-dbatools\/#primaryimage","url":"https:\/\/sqlnuggets.com\/wp-content\/uploads\/2018\/07\/powershell4.png","contentUrl":"https:\/\/sqlnuggets.com\/wp-content\/uploads\/2018\/07\/powershell4.png","width":670,"height":250},{"@type":"BreadcrumbList","@id":"http:\/\/www.sqlnuggets.com\/patching-multiple-sql-servers-with-powershell-and-dbatools\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.sqlnuggets.com\/"},{"@type":"ListItem","position":2,"name":"Patching Multiple SQL Servers With Powershell and dbatools"}]},{"@type":"WebSite","@id":"http:\/\/www.sqlnuggets.com\/#website","url":"http:\/\/www.sqlnuggets.com\/","name":"SQL Nuggets","description":"Nuggets Of SQL Server Knowledge","publisher":{"@id":"http:\/\/www.sqlnuggets.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.sqlnuggets.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/www.sqlnuggets.com\/#organization","name":"SQL Nuggets","url":"http:\/\/www.sqlnuggets.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.sqlnuggets.com\/#\/schema\/logo\/image\/","url":"https:\/\/sqlnuggets.com\/wp-content\/uploads\/2023\/11\/website-logo.jpg","contentUrl":"https:\/\/sqlnuggets.com\/wp-content\/uploads\/2023\/11\/website-logo.jpg","width":320,"height":54,"caption":"SQL Nuggets"},"image":{"@id":"http:\/\/www.sqlnuggets.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/sqlnugg","https:\/\/www.linkedin.com\/in\/ericcobb\/"]},{"@type":"Person","@id":"http:\/\/www.sqlnuggets.com\/#\/schema\/person\/210536254addbc1b9d2d95dc1448b38a","name":"Eric Cobb","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/3ca1fc0c7054a668e048f09d412cd4ebf89833c4630fbbfccca78a0678a6bdc2?s=96&d=mm&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/3ca1fc0c7054a668e048f09d412cd4ebf89833c4630fbbfccca78a0678a6bdc2?s=96&d=mm&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3ca1fc0c7054a668e048f09d412cd4ebf89833c4630fbbfccca78a0678a6bdc2?s=96&d=mm&r=pg","caption":"Eric Cobb"},"sameAs":["https:\/\/x.com\/cfgears"],"url":"https:\/\/sqlnuggets.com\/author\/eric-cobb\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/sqlnuggets.com\/wp-content\/uploads\/2018\/07\/powershell4.png","jetpack_shortlink":"https:\/\/wp.me\/pdyDvE-gV","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":887,"url":"https:\/\/sqlnuggets.com\/using-dbatools-powershell-module-to-configure-sql-server\/","url_meta":{"origin":1049,"position":0},"title":"Using dbatools PowerShell Module To Configure SQL Server","author":"Eric Cobb","date":"October 9, 2018","format":false,"excerpt":"The more I use\u00a0the\u00a0dbatools PowerShell module, the more I like it.\u00a0 It really is a solid set of scripts that allow you to easily manage your SQL Servers via PowerShell.\u00a0 If you are not familiar with dbatools, I recommend you head over to my previous post,\u00a0Getting Started With The dbatools\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/sqlnuggets.com\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2018\/07\/powershell4.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2018\/07\/powershell4.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2018\/07\/powershell4.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":870,"url":"https:\/\/sqlnuggets.com\/getting-started-with-the-dbatools-powershell-module\/","url_meta":{"origin":1049,"position":1},"title":"Getting Started With The dbatools PowerShell Module","author":"Eric Cobb","date":"September 20, 2018","format":false,"excerpt":"If you are looking for a super easy way to start using PowerShell to manage your SQL Servers, then the\u00a0dbatools PowerShell module is for you!\u00a0 For those that aren't familiar, dbatools is a\u00a0free\u00a0PowerShell module with over 400 SQL Server best practice, administration, development and migration commands included. I have to\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/sqlnuggets.com\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2018\/07\/powershell4.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2018\/07\/powershell4.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2018\/07\/powershell4.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":897,"url":"https:\/\/sqlnuggets.com\/using-dbatools-powershell-module-to-set-maxdop-and-max-memory\/","url_meta":{"origin":1049,"position":2},"title":"Using dbatools PowerShell Module To Set MAXDOP And Max Memory","author":"Eric Cobb","date":"November 27, 2018","format":false,"excerpt":"As I continue my blog series on using\u00a0the\u00a0dbatools PowerShell module, today I want to discuss using it to set MAXDOP and Max Memory on your SQL Server.\u00a0 This builds directly off of my previous post on\u00a0Using dbatools PowerShell Module To Configure SQL Server, so if you haven't seen that one\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/sqlnuggets.com\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2018\/07\/powershell4.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2018\/07\/powershell4.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2018\/07\/powershell4.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1513,"url":"https:\/\/sqlnuggets.com\/upcoming-geek-sync-practical-powershell-for-the-busy-dba\/","url_meta":{"origin":1049,"position":3},"title":"Upcoming Geek Sync: Practical PowerShell For The Busy DBA","author":"Eric Cobb","date":"November 10, 2020","format":false,"excerpt":"Be sure to sign up for my upcoming IDERA Geek Sync, Practical PowerShell For The Busy DBA on November 19th, 2020 at 11:00 AM CT. I will be focusing on using the dbatools PowerShell module, and show just how great it is at handling many of the tasks that SQL\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/sqlnuggets.com\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2020\/11\/EmZ1VIOWMAMIy-r.jpeg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2020\/11\/EmZ1VIOWMAMIy-r.jpeg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2020\/11\/EmZ1VIOWMAMIy-r.jpeg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2020\/11\/EmZ1VIOWMAMIy-r.jpeg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2020\/11\/EmZ1VIOWMAMIy-r.jpeg?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2020\/11\/EmZ1VIOWMAMIy-r.jpeg?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":1350,"url":"https:\/\/sqlnuggets.com\/setting-up-database-mail-and-sql-agent-alerts-with-powershell\/","url_meta":{"origin":1049,"position":4},"title":"Setting Up Database Mail And SQL Agent Alerts With PowerShell","author":"Eric Cobb","date":"April 21, 2020","format":false,"excerpt":"As a DBA, you need to know when there's a problem on your SQL Servers. And while I highly recommend you use a full-fledged monitoring system, there are also some things you can set up on your SQL Servers so that they will tell you when certain things go wrong.\u2026","rel":"","context":"In &quot;Configurations&quot;","block_context":{"text":"Configurations","link":"https:\/\/sqlnuggets.com\/category\/configurations\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2020\/04\/banner-1165979_1280.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2020\/04\/banner-1165979_1280.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2020\/04\/banner-1165979_1280.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2020\/04\/banner-1165979_1280.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2020\/04\/banner-1165979_1280.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":1534,"url":"https:\/\/sqlnuggets.com\/setting-the-database-owner-compatibility-level-and-recovery-model-with-powershell\/","url_meta":{"origin":1049,"position":5},"title":"Setting The Database Owner, Compatibility Level, And Recovery Model With PowerShell","author":"Eric Cobb","date":"December 30, 2020","format":false,"excerpt":"One of the great things about dbatool is that it allows you to run commands against multiple things. Sometimes you may need to run the same command on every server, or every database on a server, or every database on every server (not recommended). Today we're going to look at\u2026","rel":"","context":"In &quot;Configurations&quot;","block_context":{"text":"Configurations","link":"https:\/\/sqlnuggets.com\/category\/configurations\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2020\/12\/pexels-photo-97077.jpeg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2020\/12\/pexels-photo-97077.jpeg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2020\/12\/pexels-photo-97077.jpeg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2020\/12\/pexels-photo-97077.jpeg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2020\/12\/pexels-photo-97077.jpeg?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/sqlnuggets.com\/wp-content\/uploads\/2020\/12\/pexels-photo-97077.jpeg?resize=1400%2C800&ssl=1 4x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/sqlnuggets.com\/wp-json\/wp\/v2\/posts\/1049","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sqlnuggets.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sqlnuggets.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sqlnuggets.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sqlnuggets.com\/wp-json\/wp\/v2\/comments?post=1049"}],"version-history":[{"count":0,"href":"https:\/\/sqlnuggets.com\/wp-json\/wp\/v2\/posts\/1049\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sqlnuggets.com\/wp-json\/wp\/v2\/media\/841"}],"wp:attachment":[{"href":"https:\/\/sqlnuggets.com\/wp-json\/wp\/v2\/media?parent=1049"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sqlnuggets.com\/wp-json\/wp\/v2\/categories?post=1049"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sqlnuggets.com\/wp-json\/wp\/v2\/tags?post=1049"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}