定时网络拷贝
想用SQL里面用POWERSHELL执行。
以下在系统环境OWERSHELL里面能正常执行
目标设定共享
POWERSHELL处理:
映射盘符 net use z: \\192.168.0.xxx\files user/psw
删除原文件 Remove-item z:\xxx.xls
拷贝文件 xcopy z:\ d:\test\xxx.xls
但放到SQL里面调用POWERSHELL却出错?无法删除与拷贝文件
奇怪!
消息
Executed as user: SCH-ERP\SYSTEM. The job script encountered the following errors. These errors did not stop the script: A job step received an error at line 1 in a PowerShell script. The corresponding line is 'NET USE X:\\192.168.0.xxx\DELREP user/pwd'. Correct the script and reschedule the job. The error information returned by PowerShell is: 'System error 67 has occurred. ' A job step received an error at line 1 in a PowerShell script. The corresponding line is 'NET USE X:\\192.168.0.xxx\DELREP user/pwd''. Correct the script and reschedule the job. The error information returned by PowerShell is: ' ' A job step received an error at line 1 in a PowerShell script. The corresponding line is 'NET USE X:\\192.168.0.xxx\DELREP user/pwd''. Correct the script and reschedule the job. The error information returned by PowerShell is: 'The network name cannot be found. ' A job step received an error at line 1 in a PowerShell script. The corresponding line is 'NET USE X:\\192.168.0.xxx\DELREP user/pwd''. Correct the script and reschedule the job. The error information returned by PowerShell is: ' '. Process Exit Code 0. The step succeeded.
Executed as user: SCH-ERP\SYSTEM. The job script encountered the following errors. These errors did not stop the script: A job step received an error at line 1 in a PowerShell script. The corresponding line is 'REMOVE-ITEM X:\xxx.XLS'. Correct the script and reschedule the job. The error information returned by PowerShell is: 'Cannot find drive. A drive with the name 'X' does not exist. '. Process Exit Code 0. The step succeeded.