打开sqlserver数据库 xp_cmdshell功能,并映射网络驱动器

1. 打开sqlserver数据库 xp_cmdshell功能

  -- To allow advanced options to be changed.

  EXEC sp_configure 'show advanced options', 1

  GO

  -- To update the currently configured value for advanced options.

  RECONFIGURE

  GO

  -- To enable the feature.

  EXEC sp_configure 'xp_cmdshell', 1

  GO

  -- To update the currently configured value for this feature.

  RECONFIGURE

  GO

  -- To disallow advanced options to be changed.

  EXEC sp_configure 'show advanced options', 0

  GO

  -- To update the currently configured value for advanced options.

  RECONFIGURE

  GO

2. 映射网络驱动器

  exec   master..xp_cmdshell   'net   use   z:  \\192.168.0.2  password  /user:username'

posted @ 2012-09-27 09:27  不弃的追求  阅读(897)  评论(0编辑  收藏  举报