﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / Populate SQL Table with Powershell script / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 10:39:17 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Populate SQL Table with Powershell script</title><link>http://www.sqlservercentral.com/Forums/Topic1407131-391-1.aspx</link><description>Just found this post which looks like it answers my questions :)[url]http://www.sqlservercentral.com/articles/powershell/65196/[/url]</description><pubDate>Tue, 15 Jan 2013 03:40:49 GMT</pubDate><dc:creator>Loundy</dc:creator></item><item><title>Populate SQL Table with Powershell script</title><link>http://www.sqlservercentral.com/Forums/Topic1407131-391-1.aspx</link><description>Hi All, I'd like to use a powershell script to populate a table with fixed drive space info.here is the table schema:[code="sql"]IF OBJECT_ID(N'[dbo].[FixedDriveInformation]', N'U') IS NULL	BEGIN				CREATE TABLE dbo.FixedDriveInformation		(			Id INT IDENTITY(1,1) NOT NULL			,ServerInstance VARCHAR(100) NOT NULL			,DriveLetter CHAR(1) NOT NULL			,DriveLabel VARCHAR(50) NOT NULL			,GBFreeSpace NUMERIC(2,2) NOT NULL			,DriveSize NUMERIC(2,2) NOT NULL			CONSTRAINT [FixedDriveInformation_Id] PRIMARY KEY CLUSTERED (Id)		)					IF OBJECT_ID(N'[dbo].[FixedDriveInformation]', N'U') IS NOT NULL			BEGIN							PRINT 'SUCCESS - Table [dbo].[FixedDriveInformation] created.'							END		ELSE			BEGIN							RAISERROR('FAIL - Table [dbo].[FixedDriveInformation] not created.',16,1)							END	ENDELSE	BEGIN			PRINT 'EXISTS - Table [dbo].[FixedDriveInformation] already exists.'			ENDGO		[/code]Here is the powershell code i'm using:gwmi win32_volume -filter 'drivetype = 3' | select driveletter, label, @{LABEL='GBfreespace';EXPRESSION={"{0:N2}" -f ($_.freespace/1GB)} }, @{LABEL='DriveSize';EXPRESSION={"{0:N2}" -f ($_.Capacity/1GB)}}Does anyone know the best way for me to go about doing this?Cheers,</description><pubDate>Tue, 15 Jan 2013 03:30:10 GMT</pubDate><dc:creator>Loundy</dc:creator></item></channel></rss>