Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 7,2000
»
SQL Server Agent
»
SQL AGENT JOB - VBScript
SQL AGENT JOB - VBScript
Rate Topic
Display Mode
Topic Options
Author
Message
dankwart menor
dankwart menor
Posted Tuesday, January 22, 2008 3:53 AM
SSC Rookie
Group: General Forum Members
Last Login: Monday, May 23, 2011 5:01 PM
Points: 44,
Visits: 113
Hi Folks!
My Problem is that I executed a VBScript as an SQL Agent Job and somehow it only runs in background. I can see it in the task manager (with an owner that is the same user that is logged in). But it's invisible! It's not even in the task bar.
I tried:
"
Set ShellWSH = CreateObject("WScript.Shell")
ShellWSH.Exec("notepad.exe")
Set WshShell = Nothing
"
I also tried (same result):
"
Set shell = CreateObject("Wscript.Shell")
shell.Run "notepad.exe",5,True
Set shell = Nothing
"
What can it be???
Thx 4 reading, hope YOU might be able to help me out of that misery!
-->Dankwart
--------------------------------------------------------
Correct me if I'm wrong
Post #445809
Steve Jones - SSC Editor
Steve Jones - SSC Editor
Posted Tuesday, January 22, 2008 9:42 AM
SSC-Dedicated
Group: Administrators
Last Login: Today @ 2:54 PM
Points: 31,410,
Visits: 13,726
It's executed as the SQL server Agent logon. So it's not the console where you logged on, it's a separate console for that user.
Even if you use your use ID, I'm not sure it's the same session in which it runs.
What are you trying to do? If you have a script that executes as your login, then it will work with the SQL Agent one, providing it has the permissions required.
Follow me on Twitter:
@way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
Post #445962
dankwart menor
dankwart menor
Posted Tuesday, January 22, 2008 10:32 AM
SSC Rookie
Group: General Forum Members
Last Login: Monday, May 23, 2011 5:01 PM
Points: 44,
Visits: 113
Thx!
Another session you say... that makes sense. But how can I address the current session? I created a "
credential
" that maps to the user for which I want the script to be executed. So the task Manager tells me that it is the right user - but apparently the wrong session.
where can I adjust that?
--------------------------------------------------------
Correct me if I'm wrong
Post #445993
dankwart menor
dankwart menor
Posted Friday, February 01, 2008 1:20 AM
SSC Rookie
Group: General Forum Members
Last Login: Monday, May 23, 2011 5:01 PM
Points: 44,
Visits: 113
Steve Jones - Editor (1/22/2008)
[...] What are you trying to do? If you have a script that executes as your login, then it will work with the SQL Agent one, providing it has the permissions required.
I don't need to be able to observe the process that is started: What means are necessary to use the same session/console as I do when logging in by myself.
Looking forward to reading your answer.
--------------------------------------------------------
Correct me if I'm wrong
Post #450346
deeep
deeep
Posted Monday, November 14, 2011 6:31 PM
SSC Rookie
Group: General Forum Members
Last Login: Thursday, June 21, 2012 3:39 PM
Points: 26,
Visits: 114
Hi All
i am trying to execute VB script to refresh my excel files.. using Vbscript file through SQL Agent job step.
i have copied VBscript in a file with the extension RefreshExcel.vbs kept in C:\RefreshExcel.vbs
my Excel file (ReportFile1.xlsx) , is kept under this folder (F:\Reports\Reports\)
Below is the script used inside the file (RefreshExcel.vbs)
//---Script code-----------------------------------------------------------------
Dim objXL, objWB
Dim FileLocation, FileName
On Error Resume Next
'lgnConn = 1
FileLocation = "F:\Reports\Reports"
Set objXL = CreateObject("Excel.Application")
objXL.DisplayAlerts = False
FileName = "ReportFile1.xlsx"
'MsgBox (FileLocation & "/" & FileName)
Set objWB = objXL.Workbooks.Open(FileLocation & "/" & FileName)
objWB.EnableConnections
objXL.CalculateUntilAsyncQueriesDone
objWB.RefreshAll
objXL.CalculateUntilAsyncQueriesDone
objWB.RefreshAll
objXL.CalculateUntilAsyncQueriesDone
objWB.Save
objWB.Close
Set objWS = Nothing
Set objWB = Nothing
objXL.Quit
Set objXL = Nothing
'MsgBox ("Refresh Completed")
---------------------------------------------------------------------------------------------------//Script complete
Now when i am trying to call this script file in SQL agent job step as Type(job Properties) cmdExec(OperatingSystem)
cscript "C:\RefreshExcel.vbs"
Issue: job step executed succesfully ,,but without performing any refresh on the excel. So i am not understandig what is going wrong. the same script file work when i am calling it through a batch file (window scheuler task). But it doesnt support to run the file "when user is not logged in"
that is why i want to refresh my excel file through sql agent ,which can be scheduled to any time and cab be run as SQL agent credentials.
Can you please help me on this ...i have tried all the option but nothing working .. found hope by seeing your solution.
Thanks in advance.
Please help me. :-(
Post #1205630
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.