Quantcast
Channel: SQLServerCentral » Programming » Powershell » Latest topics
Viewing all articles
Browse latest Browse all 467

Cannot use Powershell to UNZIP files inside SQL Job

$
0
0
Server is running Windows 2008R2 Standard. SQL Server is 2008R2 SP2Code:$path = "I:\SQLBackupsFromPROD"$destination = "I:\SQLBackupsFromPROD\CaaS_Backups" $shell_app= New-Object -com shell.application $files = Get-ChildItem -Path $path -filter *.zip -recurse foreach($file in $files) { $zip_file = $shell_app.namespace($file.FullName) $copyHere = $shell_app.namespace($destination) $copyHere.Copyhere($zip_file.items()) }It is set to run as the SQL Server Agent Account. I have logged into the server using that account and I can run the script successfully.When I put it into a SQL Job Step and run it, it shows SUCCESS but no files are unzipped."MessageExecuted as user: <Username>. The step did not generate any output. Process Exit Code 0. The step succeeded.":crazy:

Viewing all articles
Browse latest Browse all 467

Latest Images

Trending Articles



Latest Images