running an exe file from a sql job - sql-job

i'm trying to run an exe from a sql job.
the db is on the server, as well as the exe file.
the exe is supposed to write stuff on a log.
even though the sql job is successful, i see no change on the log file.
i've checked the exe locally, and it does work.
The job runs on type cmdexec, and the command is :
\\ustlvint02\c\FixProjectsWhichFailedSync\FixProjectsWhichFailedSync.exe
ustlvint02 - the server's name.
the path is valid, since i tested it by running it from my computer (and there, the log isn't created as well).
i'll appreciate any help you can offer.
Hadas

The account that SQL Server Agent runs on needs to have permissions to 1.) un the exe in that location and 2.) write to the log file location.
Find out account is used by SQL Agent, then verify that this user has the proper execute and write permissions.

Look for the log file in %WINDIR%\System32 (for 32-bit version of SQL Server) or in %WINDIR%\SysWOW64 (for 64-bit version of SQL Server), where %WINDIR% is a path to the folder where Windows is installed (typically, C:\Windows). This destination does not depend on the system account specified for the SQL Agent job. All files which your executable needs to write to or read from must be either specified within an absolute path or be specified within a relative path and thus be present in the aforementioned system folder.

Related

Microsoft SSIS Package running successfully manually from Visual Studio and SSMS Integration Services Catalog, but not via SQL Server Agent

I have a complex SSIS package, which detects the file extension from a folder, and loads the file into a SQL Server table. I have a For Each Loop Container to load a number of files in this manner, from this folder location and load each file into a SQL Server table.
After the loading of each file into the SQL Server table, the SSIS has a File System Task in the Control Flow; this File System Task first creates an archive folder and then moves each file into this archive folder.
I am using Environment Variables in the SSMS Integration Services Catalog, to map to the parameters in the SSIS package/project.
The entire process is successful when I run the SSIS package in the SSMS Integration Services Catalog manually, but when I try to run via a SQL Server Agent, the data loading and the (File System Task's) folder creation are successful, but not the File System Task's file moving process. (The Agent is Run as SQL Server Agent Service Account.)
I get the following error when I see the execution report in the Integration Services Catalog in the SSMS:
File System Task - Move Files:Error: An error occurred with the following error message: "Access to the path is denied.
While the SQL Server Agent is able to create a folder using a File System Task successfully, it is not able to
move the file into this new folder location.
Inside the SQL Server Agent History, I see this in the job step:
Execute as user: NT Service\SQLSERVERAGENT. Microsoft(R) SQL Server Execute Package Utility Version 14.0.2002. 14 for 64-bit.
... Package execution on IS Server failed. Execution ID: 30449, Execution Status : 4.
I am not good with this permission issue in SQL Server Agent. I read about some proxy setting etc. but am not able to comprehend.
Is there a step-by-step solution you can provide me to fix this issue ?
The SQL Agent job executes the package using the SQL Agent service account. When you run the package manually, the package executes using the credentials you used to sign in. Most likely the SQL Agent service account does not have enough access to the directory, especially if it has just been created. Make sure the service account has "Full Control" of the directory the package is referencing. To test whether it is an access issue, log on to the server using the service account credentials and manually run the package from the SSIS catalog. If it fails for the same reason, you know you need to look at file system access for the service account.

How to give File access to Tableau server?

I have a .twb file created using the excel data source that is located in some network file path.
On publishing to server I get this error.
How to resolve this?
I need to provide some access for "Run as user" in my server machine,how could I do that ?
Ensure that when the workbook is created, a connection to the Excel file is created using the full UNC path
Ensure that the Tableau Server Run As user is able to access that file using the UNC path specified in the workbook. An easy way to test this would be to open Windows Explorer as the Run As user, then paste in the UNC path. If the Excel file opens, then you're good to go.
If you still have issues, test access to the file while logged into the Tableau server to make sure there is no firewall or port blocking access from that host. Often Excel isn't installed on servers for security reasons, so the test is not whether Excel opens the file, but whether you can view the contents from the server as the Run As User, even just using the type command at the console.
If you can't get your network access fixed, an alternative is to build and publish extracts to the server. There are multiple ways to accomplish that

PowerShell Script Cannot Write to File Share via Group Policy Startup Script

I have added a PowerShell script as a Group Policy computer startup script. The script runs fine and does all of the tasks fine. However, at the end of the script, it is supposed to copy a log file to a file share, which it is not doing. The file share shows that "SYSTEM" has full control, so I'm not sure what the issue is. I'm able to run the script as admin while on the same machine and it will copy the log to the server without a problem. It does not do this via computer startup script (under SYSTEM account) though. Any ideas?
You will need to give the computer account write permissions on the network share. When the SYSTEM account is used to access a network resource it will do so as the domain account of the computer (DOMAIN\COMPUTER$).

How can I download a perl script from a CGI server instead of running it?

I am trying to download the perl scripts from this site:
http://pages.cs.wisc.edu/~david/courses/cs552/S12/handouts/bins/
When I open or download any of them, the scripts execute. However, I want the text in the scripts. Is there any way I can do this?
For the non .pl files,
The server is actually retuning the script (not its output), so you must be executing it on your end. Right-click on the link and choose Save Link As.
For the .pl files,
The server is actually executing these scripts and returning the output. You would need to use a different URL to get the script itself. No such URL is likely to exist.
Contact your prof and advise him of the issue.
If the scripts are executing then the webserver is configured to execute scripts in that directory or it is configured to execute all .pl or .cgi files where ever they reside. That is normal for a webserver to execute a script. If you want the script source then the webserver must be configured to not execute the scripts, in which case it would deliver the source you are after. Contact the administrator to configure correctly, assuming they shouldn't be executing.
Otherwise you would need filesystem access to ~david/courses/cs552/S12/handouts/bins/, be it via FTP or whatever to download them. Basically access however you can without it being over HTTP.
Just right-click it and choose "Save link As..." (works only if no script processing enabled on server side)
Normaly you can't do this, because when you request any script it beiing processed server-side and only result shown at browser.
If you try to configure you httpd to let users download scripts you should disable script handling by extension, or just change the extension to txt for example.

Can RemoteSigned run scripts created on same domain?

I'm creating and testing some powershell scripts to do some basic file copying. I've set my executionpolicy to RemoteSigned. According to the help, this should allow me to run scripts that were not downloaded from the internet. However, my observations seem to indicate that this will run only scripts created on the local machine.
For instance, if I create a script on my development machine and try to copy to my server (on my same domain), the script will not run. However, if I open up the Powershell ISE on the server and open my script, copy the code and paste it into a new file window and save it to the server, the script then runs. Further, if I want to create a self-signed certificate, it will not run on other computers (per the help).
So, this all seems a bit cumbersome that I have to develop my scripts on the machine they are to be run or go through the copy/paste routine mentioned above to get them to run on my server. I just want to know that I've understood all of this correctly and there is no other way to create a script within the same domain and run it under the remotesigned execution policy without paying the fee for a certificate.
this post here provide the method for executing script from shared folder. hope this could help you :-)