打开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'

原文地址:https://www.cnblogs.com/zhaoyx/p/2705064.html