{"id":16641,"date":"2010-11-01T00:01:00","date_gmt":"2010-11-01T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2010\/11\/01\/use-powershell-to-collect-server-data-and-write-to-sql\/"},"modified":"2010-11-01T00:01:00","modified_gmt":"2010-11-01T00:01:00","slug":"use-powershell-to-collect-server-data-and-write-to-sql","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/use-powershell-to-collect-server-data-and-write-to-sql\/","title":{"rendered":"Use PowerShell to Collect Server Data and Write to SQL"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p><b>Summary:<\/b> Use Windows PowerShell to collect server data and automatically store that information in a Microsoft SQL Server.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" height=\"34\" width=\"34\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" align=\"left\" alt=\"Hey, Scripting Guy! Question\" border=\"0\" title=\"Hey, Scripting Guy! Question\" \/>Hey, Scripting Guy! How is Windows PowerShell usage by database professionals different from the way that other IT Pros use Windows PowerShell?<\/p>\n<p>&nbsp;<\/p>\n<p>&#8212; MC<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" height=\"34\" width=\"34\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" align=\"left\" alt=\"Hey, Scripting Guy! Answer\" border=\"0\" title=\"Hey, Scripting Guy! Answer\" \/>Hello MC, Microsoft Scripting Guy Ed Wilson here. Next week, Nov 8-11, 2010, is the annual <a href=\"http:\/\/www.sqlpass.org\/summit\/na2010\/\">SQL PASS Summit<\/a> in Seattle. In honor of this event, we will have guest bloggers from the SQL side of life. Today we will begin with Chad Miller.<\/p>\n<p>&nbsp;<\/p>\n<p>Chad Miller(<a href=\"http:\/\/sev17.com\/\">Blog<\/a>|<a href=\"http:\/\/www.twitter.com\/cmille19\">Twitter<\/a>) is a SQL Server DBA and Senior Manager of Database Administration at Raymond James Financial. In his spare time, he is the Project Coordinator\/Developer of&nbsp;the Codeplex project SQL Server PowerShell Extensions (<a href=\"http:\/\/sqlpsx.codeplex.com\/\">SQLPSX<\/a>). Chad leads the <a href=\"http:\/\/powershellgroup.org\/tampa.fl\">Tampa Powershell User Group<\/a> and is a frequent speaker at SQL Saturdays and Code Camps. <\/p>\n<p>Take it away Chad!<\/p>\n<p>&nbsp;<\/p>\n<p>We are data people and we believe data should exist in databases. We spend a good part of our day writing Transact-SQL scripts to query and load data from other sources. Therefore, not surprisingly when we use Windows PowerShell we want to run a command, capture the output and then store the data in a database. After the data is in a database, we can use Transact-SQL to do additional reporting and analysis. We might even use SQL Server Reporting Services to provide Web-based access to the data.<\/p>\n<p><b>Extract Data<\/b><\/p>\n<p>SQL Server 2008 and 2008 R2 provide the <b>Invoke-SqlCmd<\/b> cmdlet, but only on computers where the sqlps (the SQL Server mini-shell) is installed. As an alternative solution, you can implement your own function which does not require loading external snap-ins. I have copied the <a href=\"http:\/\/gallery.technet.microsoft.com\/ScriptCenter\/en-us\/7985b7ef-ed89-4dfd-b02a-433cc4e30894\">invoke-sqlcmd2 function<\/a> to the Scripting Guys Script Repository. Save the code as <b>invoke-sqlcmd2.ps1<\/b> and then dot source our new function into your Windows PowerShell console by using the following command:<\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">. .\/invoke-sqlcmd2.ps1<\/span><\/p>\n<p>The following example dot sources the <b>invoke-sqlcmd2.ps1<\/b> script that contains the <b>invoke-sqlcmd2<\/b> function, connects to the pubs database on a SQL server named SQL1 and runs a basic Transact-SQL query. The last command is a single command, but has wrapped to the third line in the output.<\/p>\n<p><span style=\"font-family: courier new,courier\">PS C:\\&gt; . C:\\data\\ScriptingGuys\\2010\\HSG_11_1_10\\invoke-Sqlcmd2.ps1<\/span><\/p>\n<p><span style=\"font-family: courier new,courier\">PS C:\\&gt; Invoke-Sqlcmd2 -ServerInstance sql1 -Database pubs -Query &#8220;Select * from auth<\/span><\/p>\n<p><span style=\"font-family: courier new,courier\"><\/span><span style=\"font-family: courier new,courier\">ors&#8221;<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">&nbsp;<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">&nbsp;<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">au_id&nbsp;&nbsp;&nbsp; : 172-32-1176<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">au_lname : White<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">au_fname : Johnson<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">phone&nbsp;&nbsp;&nbsp; : 408 496-7223<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">address&nbsp; : 10932 Bigge Rd.<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">city&nbsp;&nbsp;&nbsp;&nbsp; : Menlo Park<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">state&nbsp;&nbsp;&nbsp; : CA<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">zip&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 94025<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">contract : True<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">&nbsp;<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">&lt;&#8230;OUTPUT Truncated&gt;<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>This example reads a file that contains T-SQL statements, runs the file, and writes the output to another file.<\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">Invoke-Sqlcmd2 -ServerInstance &#8220;MyComputer\\MyInstance&#8221; -InputFile &#8220;C:\\MyFolder\\tsqlscript.sql&#8221; | Out-File -filePath &#8220;C:\\MyFolder\\tsqlscript.rpt&#8221;<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>This example uses the Windows PowerShell <b>-Verbose<\/b> parameter to return the message output of the <b>PRINT<\/b> command.<\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">Invoke-Sqlcmd2&nbsp; -ServerInstance &#8220;MyComputer\\MyInstance&#8221; -Query &#8220;PRINT &#8216;hello world'&#8221; -Verbose<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">VERBOSE: hello world<\/span><\/p>\n<p><b>&nbsp;<\/b><\/p>\n<p><b>Getting a Server List<\/b><\/p>\n<p>When you have to run a Windows PowerShell command across multiple servers, you will frequently see examples in which the list of servers are stored in a text file and read by using the <b>Get-Content<\/b> cmdlet. However, most database professionals maintain a list of SQL Servers they manage in either a table they create or they may use Central Management Server (CMS) introduced in SQL Server 2008.&nbsp; Instead of using a text file, for database professionals, it makes more sense to read a SQL table. Let&#8217;s take a look at an example. For the purposes of this demonstration we&#8217;ll create a table. However, you could just as easily substitute the <b>msdb.dbo.sysmanagement_shared_registered_servers<\/b> view from your CMS server.<\/p>\n<p>From SQL Server Management Studio, create a SQL table.<\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">CREATE TABLE server_instance<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">(server_name varchar(255) NOT NULL);<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">Next populate the table with a list of SQL Servers:<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">INSERT server_instance VALUES(&#8216;Z001&#8217;);<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">INSERT server_instance VALUES(&#8216;Z002\\SQ2K8&#8217;);<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">INSERT server_instance VALUES(&#8216;Z003\\R2&#8217;);<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>With our <b>server_instance<\/b> table populated, we can use our <b>Invoke-SqlCmd2<\/b> function to retrieve a list of servers and then call Windows PowerShell command for each. The following example retrieves the version information.<\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">Invoke-sqlcmd2 -ServerInstance &#8220;Z003\\R2&#8221; -Database dbautility -Query &#8220;Select server_name FROM server_instance&#8221; | foreach-object {Invoke-SqlCmd2 -ServerInstance $_.server_name -Database master -Query &#8220;SELECT @@version&#8221;}<\/span><\/p>\n<p><b>&nbsp;<\/b><\/p>\n<p><b>Extract and Load data<\/b><\/p>\n<p>A common task for a database professional is collecting and loading data from multiple servers into central utility database. Using the invoke-sqlcmd2 function, we can extract data from a SQL Server data source, but to load data we have to introduce a new function called Write-DataTable. I have uploaded the <a href=\"http:\/\/gallery.technet.microsoft.com\/ScriptCenter\/en-us\/2fdeaf8d-b164-411c-9483-99413d6053ae\">Write-DataTable Windows PowerShell function<\/a> to the Scripting Guys Script Repository. Save the Windows PowerShell function from the Script Repository as<b> write-datatable.ps1<\/b> and then dot source our new function into the Windows PowerShell console by using the following command.<\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">. .\/write-datatable.ps1<\/span><\/p>\n<p>The <b>Write-DataTable<\/b> function uses the .NET <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/30c3y597(v=VS.90).aspx\">Data.SqlClient.SqlBulkCopy class<\/a> to load an in-memory <b>DataTable<\/b> or <b>DataRow<\/b> array into a SQL Server table. This works out well because the cmdlet <b>invoke-sqlcmd<\/b> or our function <b>invoke-sqlcmd2<\/b> returns a <b>datatable<\/b> object. Let us examine an example database named space usage collection for all databases in your environment to use in forecasting growth.<\/p>\n<p>You have to create a SQL Server table using SQL Server Management Studio. To do this, run the following Transact-SQL script:<\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">CREATE TABLE [dbo].[db_space](<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [server_name] [varchar](128) NOT NULL,<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [dbname] [varchar](128) NOT NULL,<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [physical_name] [varchar](260) NOT NULL,<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [dt] [datetime] NOT NULL,<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [file_group_name] [varchar](128) NOT NULL,<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [size_mb] [int] NULL,<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [free_mb] [int] NULL,<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">&nbsp;CONSTRAINT [PK_db_space] PRIMARY KEY CLUSTERED <\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">(<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [server_name] ASC,<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [dbname] ASC,<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [physical_name] ASC,<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [dt] ASC<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">)<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">)<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>The T script and management studio are seen in the following figure.<\/p>\n<p>&nbsp;<img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2234.HSG-11-1-10-01.jpg\" border=\"0\" \/>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Next we&#8217;ll use a Transact-SQL query to collect the server name, database name and file information. We&#8217;ll save the query to a plain old .sql file that is named <a href=\"http:\/\/gallery.technet.microsoft.com\/ScriptCenter\/en-us\/620f28ae-867e-4beb-b98b-d5640213e255\">get-dbspace.sql<\/a>. This is the same kind of SQL script that you would execute in SQL Server Management Studio. However, we will call the script from the <b>Invoke-SqlCmd2<\/b> function:<\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">$dt = invoke-sqlcmd2 -ServerInstance &#8220;Z003\\R2&#8221; -Database &#8220;master&#8221; -InputFile .\/get-dbspace.sql&nbsp; -As &#8216;DataTable&#8217;<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>Examining the type information about $dt variable we can see the type is of a DataTable as shown in the following figure.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/0830.HSG-11-1-10-02.jpg\" border=\"0\" \/>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>To load the <b>DataTable<\/b> into our SQL Server table we&#8217;ll call the <b>Write-DataTable<\/b> function:<\/p>\n<p style=\"padding-left: 30px\">Write-DataTable -ServerInstance &#8220;Z003\\R2&#8221; -Database &#8220;dbutility&#8221; -TableName &#8220;db_space&#8221; -Data $dt<\/p>\n<p style=\"padding-left: 30px\">&nbsp;<\/p>\n<p>Using <b>invoke-sqlcmd2<\/b> and piping the output to <b>Out-GridView<\/b> we can see the data has in fact been loaded.<\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">invoke-sqlcmd2 -ServerInstance &#8220;Z003\\R2&#8221; -Database &#8220;dbutility&#8221; -Query &#8220;SELECT * FROM db_space&#8221; |&nbsp; Out-GridView<\/span><\/p>\n<p>The results from this command are shown in the figure below.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1031.HSG-11-1-10-03.jpg\" border=\"0\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><b>Extract, Transform, and Load Data<\/b><\/p>\n<p>As we&#8217;ve seen, by using a couple of simple functions &#8211; <b>invoke-sqlcmd2<\/b> and <b>write-datatable<\/b> &#8211; we can easily load data from any SQL Server data source, but what about any Windows PowerShell command? As an example, we want to collect disk space utilization by using <b>Get-WMIObject Win32_LogicalDisk<\/b> across a group of SQL Servers into a central database for reporting trending. If we can convert the output of our WMI call into a <b>DataTable<\/b> then we can use our <b>Write-DataTable<\/b> function. Using a function called <b>Out-DataTable<\/b> adapted from <a href=\"http:\/\/thepowershellguy.com\/blogs\/posh\/archive\/2007\/01\/21\/powershell-gui-scripblock-monitor-script.aspx\">a script<\/a> by Marc van Orsouw (<a target=\"_blank\" href=\"http:\/\/thepowershellguy.com\/blogs\/posh\/default.aspx\">Blog<\/a>|<a target=\"_blank\" href=\"https:\/\/twitter.com\/powershellguy\">Twitter<\/a>) we can do just that. I saved the <a href=\"http:\/\/gallery.technet.microsoft.com\/ScriptCenter\/en-us\/4208a159-a52e-4b99-83d4-8048468d29dd\">modified script<\/a> to the Scripting Guys Script Repository. <\/p>\n<p>Save the following code as <b>Out-DataTable.ps1<\/b> and source our new function<\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">. .\/ Out-DataTable.ps1<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>To load convert the output of a WMI call to a <b>DataTable<\/b>, we&#8217;ll pipe to our newly created <b>out-datatable<\/b> function and assign the output to a <i>$dt<\/i>.<\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">$dt = Get-WmiObject Win32_LogicalDisk -filter &#8220;DriveType=3&#8221; | Select @{n=&#8217;UsageDT&#8217;;e={get-date -Format &#8220;yyyy-MM-dd&#8221;}}, &#8216;<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">SystemName, DeviceID, VolumeName, &#8216;<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">@{n=&#8217;Size&#8217;;e={$([math]::round(($_.Size\/1GB),2))}}, @{n=&#8217;FreeSpace&#8217;;e={$([math]::round(($_.FreeSpace\/1GB),2))}} | out-datatable<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>Having assigned the output to a datatable you can call the <b>write-datatable<\/b> to load the collected data into a SQL Server table. This makes <b>out-datatable<\/b> very powerful in that the output of any Windows PowerShell command can be easily loaded into a SQL Server table. Using <b>write-datatable<\/b> requires a SQL Server destination table to exist, but instead of manually creating a SQL Server table, we&#8217;ll use a new function called <b>Add-SqlTable<\/b>. The <b>Add-SqlTable.ps1<\/b> script is also uploaded to the <a href=\"http:\/\/gallery.technet.microsoft.com\/ScriptCenter\/en-us\/c193ed1a-9152-4bda-b5c0-acd044e68b2c\">Scripting Guys Script Repository.<\/a> Save the code as <b>Add-SqlTable.ps1<\/b> and source the new function.<\/p>\n<p>The following command will create a new empty SQL Server table named <b>diskspace<\/b> based on the structure of our <b>DataTable<\/b> variable <i>$dt<\/i>:<\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">Add-SqlTable -ServerInstance &#8220;Z003\\R2&#8221; -Database dbutility -TableName diskspace -DataTable $dt<\/span><\/p>\n<p><b>&nbsp;<\/b><\/p>\n<p style=\"padding-left: 30px\"><b>Note: <\/b>Using this technique to create a SQL Server table is not as precise as manually creating a table as certain elements including defining primary keys and data types are not handled. <b>Add-SqlTable<\/b> works best for a quick data dump of Windows PowerShell data to a SQL Server table.<\/p>\n<p>Finally, with the destination SQL Server table created, we can call our <b>write-datatable<\/b> function to load the collected data:<\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">Write-DataTable -ServerInstance &#8220;Z003\\R2&#8221; -Database &#8220;dbutility&#8221; -TableName &#8220;diskspace&#8221; -Data $dt<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>Using <b>invoke-sqlcmd2<\/b> we can see the data was loaded into the SQL Server table:<\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">invoke-sqlcmd2 -ServerInstance &#8220;Z003\\R2&#8221; -Database &#8220;dbutility&#8221; -Query &#8220;SELECT * FROM diskspace&#8221; | Out-GridView<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/4863.HSG-11-1-10-04.jpg\" border=\"0\" \/><b>&nbsp;<\/b><\/p>\n<p><b><\/b><\/p>\n<p><b><\/b><\/p>\n<p><b>Summary<\/b><\/p>\n<p>This post demonstrated how to query and load the output of any Windows PowerShell command into a SQL Server table. The functions <b>invoke-sqlcmd2<\/b>, <b>write-datatable<\/b>, <b>out-datatable<\/b> and <b>add-sqltable<\/b> can be used as building blocks for many of your Windows PowerShell-based data loading needs.<\/p>\n<p>MC, that is all there is to using Windows PowerShell and SQL Server. SQL week will continue tomorrow when SQL guest blogger Aaron Nelson will talk about how to work with SQL snap-ins. &nbsp;Thank you Chad, for sharing your time and knowledge with us. <\/p>\n<p>&nbsp;<\/p>\n<p>I invite you to follow me on <a target=\"_blank\" href=\"http:\/\/bit.ly\/scriptingguystwitter\">Twitter<\/a> or <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\">Facebook<\/a>. If you have any questions, send email to me at <a target=\"_blank\" href=\"mailto:scripter@microsoft.com\">scripter@microsoft.com<\/a> or post them on the <a target=\"_blank\" href=\"http:\/\/bit.ly\/scriptingforum\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p>&nbsp;<\/p>\n<p><b>Ed Wilson, Microsoft Scripting Guy<\/b><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Summary: Use Windows PowerShell to collect server data and automatically store that information in a Microsoft SQL Server. &nbsp; Hey, Scripting Guy! How is Windows PowerShell usage by database professionals different from the way that other IT Pros use Windows PowerShell? &nbsp; &#8212; MC &nbsp; Hello MC, Microsoft Scripting Guy Ed Wilson here. Next [&hellip;]<\/p>\n","protected":false},"author":595,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[195,146,56,3,176,45],"class_list":["post-16641","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-chad-miller","tag-databases","tag-guest-blogger","tag-scripting-guy","tag-sql-server","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>&nbsp; Summary: Use Windows PowerShell to collect server data and automatically store that information in a Microsoft SQL Server. &nbsp; Hey, Scripting Guy! How is Windows PowerShell usage by database professionals different from the way that other IT Pros use Windows PowerShell? &nbsp; &#8212; MC &nbsp; Hello MC, Microsoft Scripting Guy Ed Wilson here. Next [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/16641","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/595"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=16641"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/16641\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=16641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=16641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=16641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}