0

锡纸上写着什么。本质上,我想要这样的东西(在powershell中,但这在很大程度上无关紧要):

$server = new-object "Microsoft.SqlServer.Management.Smo.Server" "my\instance"
$service = $server.somePropertyOrMethod
if ($service.getType().FullName -eq 'Microsoft.SqlServer.Management.Smo.Wmi.Service') {
   write-output "you've found what I'm looking for"
}
4

1 回答 1

0

寻找类似的东西?

XP_WMIV3_DLL is a Extended Sqlserver Procedure for Quering WMI.
This package includes versions for 32-bit and 64-bit SQL servers.

Currently tested under SQL-Server 2005 and SQL-Server 2008.

download: http://bummisoft.de/download/XP_WMI.zip


Installation:

EXEC sp_addextendedproc xp_wmiv3, '<Your Path>\XP_WMIV3_DLL.dll'

eg:  EXEC sp_addextendedproc xp_wmiv3, 'C:\DLLs\XP_WMIV3_DLL.dll'

Uninstallation

EXEC sp_dropextendedproc xp_wmiv3


Usage 

e.g. 

exec xp_wmiv3 'SELECT * FROM Win32_Volume'
exec xp_wmiv3 'SELECT * FROM CIM_Userdevice where Name like "%HID%"'
exec dbo.xp_wmiv3 'Select * from win32_perfformatteddata_perfproc_process where name=''sqlservr'''



Create table #tmp(Domain varchar(255),Name varchar(255),Sid varchar(255))
insert into #tmp Exec xp_wmiV2 'SELECT  Domain,SID,Name FROM Win32_UserAccount  where Status ="OK"'
Select * from #tmp
Drop Table #tmp



Be aware that some querys my last very long, some won't return at last.

Covered namespaces in this version depend on local  - root\CIMV2
于 2012-11-13T22:44:04.057 回答