Where is the.cs files when a script task is run from the SSISDB using the agent? - sql

I have an SSIS job that contains a script task.
There is also a connection to another server within the package that can only be executed accessed by a specific user and the agent cannot be given read rights to the other server.
So the solution to this is have the SQL job be run as the required user.
The problem with this is this user does not have full control over the folder/file where the script task will be temporarily located while the code runs so I get a failure on the script task but if I run it in visual studio or with the normal agent account the script task executes successfully.
I have tried giving the user access to all major drives on the server but this has not solved the problem

Is the script doing something on the folder?
Or does it just need permission to execute script?
I would anyway advise you to implement error handling in script:
https://learn.microsoft.com/en-us/sql/integration-services/extending-packages-scripting/task/logging-in-the-script-task?view=sql-server-2017
Make sure it works in visual studio, so that when you get that error you are sure that the error is caused by permissions/environment.
You could also take a look at this article:
article

Related

Running a program at login as admin

I have a program I wrote in Visual Basic Express 2013 to put a classification banner at the top of the screen. I set up a scheduled task using ngen.exe which makes it run at login. The problem is that it doesn't run as admin so any non-privileged user can kill the task.
This program is to replace another program called Netbanner because there are a few issues with Netbanner. The program I wrote resolves all of these issues except for the admin issue. Netbanner is implemented exactly the same way (ngen.exe) but it won't let a non-privileged user kill the task.
I don't know if it is something in the program itself or I missed something in the deployment process.
This is the command used to deploy Netbanner which I duplicated to deploy mine:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe install "C:\Program Files\Microsoft\NetBanner\NetBanner.exe"
Also, these are the files in C:\Program Files\Microsoft\NetBanner:
NetBanner.exe
NetBanner.InstallState
NetBanner.pdb
NetBannerSchTask.xml
Any ideas?
Thanks.
You could try to go into the properties->Compatibility->Run this program as an administrator for the application.
Alternatively, you could do the same thing for a batch file that you can schedule to run on startup.

Triggering stored procedure from script task in SSIS - login failed error

I have a 2008 SSIS package that have a lot of steps, one of the steps is a script task that runs a stored procedure. It is not an option for now to change it from a script task, as it would require a lot of extra developing. The procedure runs fine in the production environment, but I need to be able to test it from VS.
The reason for the failure I have found is that the connection to the target database is not working, it is giving error "Login failed for user 'user'".
The SSIS package is built on a SSIS framework, and it has a "Initialize Connections" task as an Event in the "Initialize" part of the package. I do not know much about what this does. I want to just run the Data Flow (With "Execute task" option inside the Data Flow).
In the ProtectionLevel for the package I have tried both DontSaveSensitive and EncryptSensitiveWithPassword without any luck. I manually insert the password in the Connection Manager.
I read some about the need to use a connection manager/XML file, but I'm unsure of how this can be done. (Not done much SSIS before).
Please explain how this debugging in VS should be done.

Running a batch file from task scheduler and getting access denied

I'm trying to run a batch file from Windows 8 Task scheduler and I'm getting an access denied error on the command prompt for the following command line.
echo "Hello World" >> C:\File.txt
However, if I tick the checkbox "Run with higest privileges" under the task scheduler then it works fine.
The question is why do I require to tick the checkbox when I can run the batch manually without the "Run as administrator"?
A couple possibilities:
If a task is registered using the Administrators group for the security context of the task, then you must also make sure the Run with highest privileges check box is checked if you want to run the task.
If you are using the S4U functionality, make sure the Logon as batch job policy is set for the user.
Make sure the user account the task is using has write access to the C:\ directory
By default in modern Windows you cannot write to the root directory. Use "%temp%\file.txt" instead.

SSIS Execute Process Task Can't Find executable

I am using the 7zip standalone .exe to unzip a file. I am using the Execute Process task for this. I have tested this over and over again on multiple machines and I know it works (at least in debug mode/visual studio). I have uploaded this package the server. I have created a job that calls said package from the Package Store. The package is not able to find the .exe no matter where I put it.
My first thought was to put the .exe on the C:\ drive, which failed. I have also failed in my attempts to place the .exe on a network location that the account the package is running under has full control over.
Basically, has anybody else had issues getting the Execute Process Task to find an executable when the package is uploaded to the server?
The error message is
Can't find 7za.exe in directory C:\7zip
I'll risk a downvote for being wrong, but I believe you have a permission issue.
You say it runs fine on other servers from BIDS, try it without BIDS. Call it from a command-line on a box that it works on.
dtexec.exe /file C:\HereComesTheUnzipper.dtsx
If that works, then repeat the step on the troublesome server. RDC into the box and try again
dtexec.exe /ser localhost /sq HereComesTheUnzipper
If that still works, then you are looking at an issue with the job. What account is the SQL Agent service running as? Is the SSIS job step running as a particular set of credentials? If so, is it a SQL Server login (which wouldn't map to anything on the physical box)? Regardless of what your answer is, the resolution will be to ensure the account has access to
7z.exe
whatever scratch area 7zip may use while unpacking files (I assume %temp%)
the output folder (C:\bin\7z.exe -e e:\data\MyThing.7z)

ssis job in sql server agent

I created an SSIS package, which runs fine in Sql Server Business Intelligence. The problem is when I try to schedule a job to run, I tested it and it says the exe does not exist in the directory and it lists the path to the directory where the exe is located. The exe is obviously there, and the exe runs fine, it just doesn't like the package when I try to schedule a job.
The error that I can see in the job activity monitor is
Description: File/Process "FileName.exe" does not exist in the directory "DirectoryName" End Error
Anybody know how to fix this?
An SSIS package is not an EXE. The name is typically something like 'MyPackageName.dtsx'. The package is interpreted & executed by the DTS utility running in conjunction with a SQL Server instance.
We use SQL Agent to run SSIS packages as a standard part of our application, so that itself shouldn't be a problem. How do you have your SQL Agent job defined?