Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Bulk Insert WMIC output to table w/ xp_cmdshell

By caffeinated,

This is an example of retrieving WMIC results using the xp_cmdshell proc, and inserting the results into a table.

Specifically, this script retrieves disk info from the LogicalDisk class, but WMIC provides thousands of other properties. WMIC does require it be ran from a Windows 2003 server, but can query other Windows 2000 servers when executed from a W2003 server.

NOTE: If WMIC hasn't been run on the server before, it'll do a compile on its first run. I recommend doing a manual execution of WMIC first before using this script, so you don't insert an extraneous output into the temp table

This example lists the available alias' on the system (e.g. WMIC alias list brief)

WMIC Reference:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/wmic_overview.mspx?mfr=true

Total article views: 446 | Views in the last 30 days: 5
 
Related Articles
FORUM

MSDTC in Windows 2008 server

MSDTC in Windows 2008 server

FORUM

SQL Server 2008 on Windows 2008 Vs. Windows 2003

SQL Server 2008 on Windows 2008 Vs. Windows 2003

FORUM

windows linked server

windows xp to sql server 2005 linked server

FORUM

SQLServer2000 and Windows Server 2008 R2

SQLServer2000 and Windows Server 2008 R2

FORUM

Configuring DTC in Windows 2000 server

DTC Settings on Windows 2000 server enviroment

 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones