Ok, I've done some programming but, I'm still new to VB scripting and I've run into a snag.
I've pieced together a few things that appear to be working to the extent I want.
1) I activate 1st script that stops all POWERPNT.EXE processes on a remote computer(effectively ending all PPT shows)
2) I upload the new powerpoint show over the old one
3) I activate 2nd script that launches the powerpoint program on the remote computer, then opens the powerpoint show located on the remote computer
(I am doing 2 launches so that it shows in the foreground, when testing if I launched the show directly it would show, but in the background and I would have to click on it to have it in the active window, I want it fully automated)
End Task Code:
Launch PPT Show Code:
on error resume next
set ppt = getobject(,"powerpoint.application")
if Err.number = 0 then
For each pres in ppt.presentations
So both of these work great when executed on the computer directly but, I can't get them to run remotely.
Set Command = WScript.CreateObject("WScript.Shell")
cmd = """C:\Program Files\Microsoft Office\Office14\POWERPNT.exe"""
Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True
Set objSlideShow = objPPT.Presentations.Open("C:\Users\User\Documents\Support Presentation\SupportTVPresentation.pps")
I've been attempting to set them up as scheduled tasks that run one minute later but, they aren't executing properly or something, when I try to create them on my local computer they wont execute.
I'm not sure if its a permissions thing, or if I need to run the task as admin instead of system which I'm not sure what command would do that.
Am I close and just missing a line? is there a better way to do this? or is there a way to run as credentials when creating the task, any insights in this would be much appreciated.
strComputer = "supmedia1-dt"
strCommand = "C:\Users\User\Documents\KILLPPT.VBS"
Const INTERVAL = "n"
Const MINUTES = 1
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objScheduledJob = objWMIService.Get("Win32_ScheduledJob")
Set objSWbemDateTime = CreateObject("WbemScripting.SWbemDateTime")
objSWbemDateTime.SetVarDate(DateAdd(INTERVAL, MINUTES, Now()))
errReturn = objScheduledJob.Create(strCommand, objSWbemDateTime.Value, False, 0, 0, True, intJobID)
If errReturn = 0 Then
Wscript.Echo "PPT Start could not be started due to error: " & errReturn
Thanks ahead of time!