-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeploySSISPackageUtility.bat
98 lines (83 loc) · 2.08 KB
/
DeploySSISPackageUtility.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
@echo off
SET /P SOURCEFOLDER= Enter the Source Folder where the Packages are located:
SET /P DESTSERVER= Enter the Destination Server:
SET /P DESTLOCATION= Enter Destination Folder (Leave blank for root):
IF NOT EXIST "%SOURCEFOLDER%\*.dtsx" GOTO NOFILES
dtutil /SourceS %DESTSERVER% /FE SQL;%DESTLOCATION%
IF %ERRORLEVEL% EQU 6 (
ECHO.
ECHO Please verify the server name is correct.
ECHO %DESTSERVER%
ECHO.
GOTO END
)
IF %ERRORLEVEL% GTR 0 GOTO NOFOLDER
:MAIN
ECHO.
ECHO Ready to load the packages
PAUSE
FOR /F "usebackq delims==" %%i in (`dir /b "%SOURCEFOLDER%\*.dtsx"`) do (
ECHO.
ECHO ^>^>^>^>^>^> Copying %%i to %DESTSERVER%\MSDB\%DESTLOCATION% ^<^<^<^<^<^<^<
ECHO.
dtutil /FILE "%SOURCEFOLDER%\%%i" /DESTSERVER %DESTSERVER% /COPY SQL;"%DESTLOCATION%\%%~ni" /QUIET
IF %ERRORLEVEL% GTR 0 GOTO Error_%ERRORLEVEL%
ECHO.
)
GOTO:COMPLETE
:NOFILES
ECHO.
ECHO *** No SSIS Packages were found. Please verify the folder location:
ECHO %SOURCEFOLDER%
ECHO.
GOTO END
:NOFOLDER
ECHO.
ECHO *** The folder location on the server does not exist.
SET /P RESP=Would you like to create it now (y/n)?
IF %RESP%==y GOTO FOLDERCREATE
ECHO.
GOTO END
:FOLDERCREATE
SET /P PARENT=Enter the Parent Folder ONLY (\ for root):
SET /P NEWFOLDER=Enter the New Folder Location:
ECHO.
ECHO Now creating the new folder on %DESTSERVER%
dtutil /SourceS %DESTSERVER% /FC SQL;%PARENT%;%NEWFOLDER%
IF %ERRORLEVEL% EQU 0 GOTO MAIN
ECHO.
ECHO Something happened, try again.
ECHO.
GOTO FOLDERCREATE
:Error_1
ECHO.
ECHO The utility failed
ECHO Please verify your parameters
ECHO.
GOTO END
:Error_4
ECHO.
ECHO The utility cannot locate the requested package
ECHO Please verify your parameters
ECHO.
GOTO END
:Error_5
ECHO.
ECHO The utility cannot load the requested package
ECHO Please verify your parameters
ECHO.
GOTO END
:Error_6
ECHO.
ECHO The utility cannot resolve the command line because it contains either syntactic or semantic errors
ECHO Please verify your parameters
ECHO.
GOTO END
:COMPLETE
ECHO.
ECHO All Packages have been Processed.
ECHO Please verify that no Error Messages or Warnings were returned.
ECHO.
GOTO END
:END
PAUSE