D
David
Hi
I am attempting to print a Word document via a vbscript which is triggered
via a scheduled task on a Windows Terminal Server. The scheduled task is
configured to run daily.
The process works perfectly when the service account configured to open and
print the document via the vbscript has an active logon session to the
Terminal Server.
However when the service account does not have an active logon session, the
task triggers the script which opens the document and prints, but the
document remains open thus meaning any additional attempts to open the
document will advise that the document is locked and the process will fail.
This also means that the document cannot be edited.
The script is as follows:
set WshShell = WScript.CreateObject("WScript.Shell")
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open("path to docmuent")
objDoc.PrintOut()
WScript.Sleep 2500
objWord.Quit
WScript.Sleep 2500
WshShell.SendKeys "n"
Any advice regarding a solution to this problem or an alternative solution
would be greatly appreciated.
I am attempting to print a Word document via a vbscript which is triggered
via a scheduled task on a Windows Terminal Server. The scheduled task is
configured to run daily.
The process works perfectly when the service account configured to open and
print the document via the vbscript has an active logon session to the
Terminal Server.
However when the service account does not have an active logon session, the
task triggers the script which opens the document and prints, but the
document remains open thus meaning any additional attempts to open the
document will advise that the document is locked and the process will fail.
This also means that the document cannot be edited.
The script is as follows:
set WshShell = WScript.CreateObject("WScript.Shell")
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open("path to docmuent")
objDoc.PrintOut()
WScript.Sleep 2500
objWord.Quit
WScript.Sleep 2500
WshShell.SendKeys "n"
Any advice regarding a solution to this problem or an alternative solution
would be greatly appreciated.