經過sqlserver用戶操做遠程服務器

USE masterGORECONFIGURE --先執行一次刷新,處理上次的配置GOEXEC sp_configure 'show advanced options',1 --啓用xp_cmdshell的高級配置GORECONFIGURE --刷新配置GOEXEC sp_configure 'xp_cmdshell',1  --打開xp_cmdshell,能夠調用SQL系統以外的命令GORECONFIGUREGO--使用xp_cmdshell在D盤建立一個myfile 文件夾EXEC xp_cmdshell 'd: dir',no_output --[no_output]表示是否輸出信息GOEXEC xp_cmdshell 'shutdown -r now',no_output --[no_output]表示是否輸出信息EXEC xp_cmdshell 'shutdown -r -m \\127.0.0.1 -t 0 -f'--關閉EXEC sp_configure 'show advanced options','1' --確保show advances options 的值爲1,這樣才能夠執行xp_cmdshell爲0的操做GORECONFIGUREGOEXEC sp_configure 'xp_cmdshell',0 --關閉xp_cmdshellGORECONFIGUREGOEXEC sp_configure 'show advanced options','0' --關閉show advanced optionsGORECONFIGUREGO
相關文章
相關標籤/搜索