Run the following command in the doscommand (or Bat file:
Net use \ 192.168.100.1 \ ip$ ks-c-001-11/user: administrator
COPY \ 192.168.100.1 \ xm \ XM \ SALE_DBC. * c: \ temp/y
COPY \ 192.168.100.1 \ xm \ XM \ sale07. * c: \ temp/y
COPY \ 192.168.100.1 \ xm \ XM \ sale10. * c: \ temp/y
COPY \ 192.168.100.1 \ xm \ XM \ sale11. * c: \ temp/y
Net use \ 192.168.100.1 \ ipc $/del
Perform the following operations in query analysis:
1. When xp_mongoshell is used, it is best to add "master. dbo." Before the command, because the stored procedure "xp_mongoshell" belongs to the master database.
2. When you set the connection to IPC, the IP address or computer name must be added between "user:" and "user Name.
1. Use an IP address to connect
-- 1. Set connection
EXEC master. dbo. xp_mongoshell 'net use \ 192.168.100.1 \ ipc $ ks-c-001-11/user: 192.168.100.1 \ administrator'
-- 2. Execute the doscommand
EXEC master. dbo. xp_mongoshell 'Copy \ 192.168.100.1 \ xm \ XM \ SALE_DBC. * c: \ temp/Y'
EXEC master. dbo. xp_mongoshell 'Copy \ 192.168.100.1 \ xm \ XM \ sale07. * c: \ temp/Y'
EXEC master. dbo. xp_mongoshell 'Copy \ 192.168.100.1 \ xm \ XM \ sale10. * c: \ temp/Y'
EXEC master. dbo. xp_mongoshell 'Copy \ 192.168.100.1 \ xm \ XM \ sale11. * c: \ temp/Y'
-- 3. Disconnect
EXEC master. dbo. xp_mongoshell 'net use \ 192.168.100.1 \ ipc $/del'
2. Use a computer name to connect
-- 1. Set connection
EXEC master. dbo. xp_mongoshell 'net use \ ks-008 \ ipc $ ks-c-001-11/user: ks-008 \ administrator'
-- 2. Execute the doscommand
EXEC master. dbo. xp_mongoshell 'Copy \ ks-008 \ xm \ XM \ SALE_DBC. * c: \ temp/Y'
EXEC master. dbo. xp_mongoshell 'Copy \ ks-008 \ xm \ XM \ sale07. * c: \ temp/Y'
EXEC master. dbo. xp_mongoshell 'Copy \ ks-008 \ xm \ XM \ sale10. * c: \ temp/Y'
EXEC master. dbo. xp_mongoshell 'Copy \ ks-008 \ xm \ XM \ sale11. * c: \ temp/Y'
-- 3. Disconnect
EXEC master. dbo. xp_mongoshell 'net use \ ks-008 \ ipc $/del'