Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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: 480 | Views in the last 30 days: 4
 
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