Sign In | Feedback | Donate | Search
Katie and Emil Logo
Vote Yes! I like it! [+0]  |  Vote no! Dislike? [-0]
Author: by Emil Glownia
Powershell Dtutil (Dtutil.exe) – When I first tried PowerShell with Dtutil command line tool I had an issue to run the command. The problem was semicolon ; which is a special character in Powershell. For those having similar issue see below how you can run dtutil command from PowerShell:

Here is a simple copy file example:

dtutil /FILE ".\SourceFileFromTheSameFolder.dtsx" /COPY FILE';C:\Program Files\Microsoft SQL Server\100\DTS\Packages\PackageFinalDestination.dtsx' /Quiet

In the above command I just move file from folder where I have my PowerShell script into FileSystem SSIS default folder.
Notice that I put apostrophe ‘ before semicolon ; if I didn’t do that it would give the following error:
Unexpected token 'Quiet' in expression or statement.
And if I removed /Quiet it would give next error:
Argument "FILE" for option "copy" is not valid.

Below is code that I am still working on and additionally get dynamically DTSPath from registry which I hope will be reliable way to do it. Captures result in variable to avoid ugly message and then output the result and pauses.

$DTSPath = (get-itemproperty -path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\100\SSIS\Setup\DTSPath").'(default)'

$result = dtutil /FILE ".\SourcePackage.dtsx" /COPY FILE';'$DTSPath'Packages\Destination.dtsx' /Quiet

if ($LASTEXITCODE -eq 0) {Write-Host "Package Deployment result (ERS CSV Load)…ok"}
elseif ($LASTEXITCODE -eq 1) {Write-Host "Package Deployment result (ERS CSV Load)…*** ERROR *** The utility failed. Error code 1"}
elseif ($LASTEXITCODE -eq 4) {Write-Host "Package Deployment result (ERS CSV Load)…*** ERROR *** The utility cannot locate the requested package. Error code 4"}
elseif ($LASTEXITCODE -gt 5) {Write-Host "Package Deployment result (ERS CSV Load)…*** ERROR *** The utility cannot load the requested package. Error code 5"}
elseif ($LASTEXITCODE -gt 6) {Write-Host "Package Deployment result (ERS CSV Load)…*** ERROR *** The utility cannot resolve the command line because it contains either syntactic or semantic errors. Error code 6"}
else {"Package Deployment result (ERS CSV Load)…*** ERROR *** Unidentified Error."}

Write-Host "Press any key to continue …"
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

Powershell dtutil

See also: DTUTIL - Microsoft documentation

Hope that helps
Upsss... Something went wrong and Google Ads on our website did not display.

Google ads sponsor FREE content on our website and without them it would not exist.

How to fix the problem?
  1. Check if the Google Search display any ads by searching the term Business Intelligence
    • If ads don't display, try different search terms and if there no ads then there might be a problem with your browser. If you made changes to your browser behaviour then undoing them will help.
    • If ads display then, refresh our page one more time, if the problem is still there than please contact us.
  2. Become 'No Ads Learner' Member or if you are already one Sign In.
Take care
Katie & Emil
Well done! It seems Google Ads display properly now on our website.

Access our website's FREE content for FREE!