Solved

Start powerpoint pps on remote pc using vb script

Posted on 2009-05-11
4
1,813 Views
Last Modified: 2013-12-26
Hi,
I need some help from you experts. The thing I am trying to to is to start a powerpoint presentation that is visible on a remote pc. I have come so far that when I run the script, the process starts on the remote pc, but I want it to be visible in fullscreen on the remote pc screen.

I have been playing around with the code so there are a bunch of lines that most likely aren't necessary. I'm not very good at coding so if you can help me out it would be very much appreciated
Dim objFSO, objFileCopy, objGuyFile

Dim strFilePath, strDestination 

strComputer = "sexpw193"

strUser = "remotepc\username"

strPassword = "password"

strProcessKill = "'POWERPNT.EXE'"

strFilePath = "d:\H\PowerPoint\presentation.pps"

strDestination ="\\remotepc\PPT$\"

 

  'Kill powerpoint show

    Set wbemLocator = CreateObject("WbemScripting.SWbemLocator")

    Set wbemServices = wbemLocator.ConnectServer(strComputer, "root\cimv2", strUser, strPassword)

    Set wbemObjectSet = wbemServices.ExecQuery("Select * from Win32_Process where Name = " & strProcessKill)

 

    For Each wbemObject In wbemObjectSet

        wbemObject.Terminate

    Next

 

		

	'code to copy ppt to dest

	Set objFSO = CreateObject("Scripting.FileSystemObject")

	Set objFileCopy = objFSO.GetFile(strFilePath)

	objFileCopy.Copy (strDestination)

	

	

 

  

  'Restart show

	'Set objProcess = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")

	'strCommand = "wscript " & Chr(34) & "D:\PPT\pp.vbs" & Chr(34)

	'objProcess.Create strCommand,null,null,intProcessID

	

	

	

	

	Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process") 

Error = objWMIService.Create("d:\PPT\pp.vbs", null, null,intProcessID) 

 

If Error = 0 Then 

MsgBox (strProcess & " was started with a process ID of " & intProcessID & ".") 

 

Else 

MsgBox (strProcess & " could not be started due to error " & _ 

errReturn & ".") 

 

End If

	

REM Dim objWMIService, objProcess

REM Dim strShell, objProgram, strVBS

 

REM strVBS = "wscript.exe d:\PPT\pp.vbs"

REM ' Connect to WMI

REM set objWMIService = getobject("winmgmts://"_

REM & strComputer & "/root/cimv2") 

 

REM ' Obtain the Win32_Process class of object.

REM Set objProcess = objWMIService.Get("Win32_Process")

REM Set objProgram = objProcess.Methods_( _

REM "Create").InParameters.SpawnInstance_

REM objProgram.CommandLine = strVBS

 

REM 'Execute the program now at the command line.

REM Set strShell = objWMIService.ExecMethod( _

REM "Win32_Process", "Create", objProgram) 

 

REM WScript.echo "Created: " & strVBS & " on " & strComputer

 

 

	Wscript.Quit

Open in new window

0
Comment
Question by:itnordic
  • 2
  • 2
4 Comments
 
LVL 7

Expert Comment

by:Hubasan
ID: 24356856
Hi itnordic,

Unfortunately you can't use objProcess.Create method to launch remote processes Interactively according to Microsoft, and this is their quote :
"For security reasons the Win32_Process.Create method cannot be used to start an interactive process remotely."


Full explanation of this method you can find here:
http://msdn.microsoft.com/en-us/library/aa389388(VS.85).aspx

I would suggest you use PSExec.exe tool from Mark Russinovich, who now works for Microsoft. This tool WILL allow you to launch any process interactively on any remote PC as long as you have rights on that remote PC. This tool is extremely versatile and is one of those "MUST HAVE" Admin tools in my oppinion.

You can find PSExec.exe tool here:
http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

Hope this helps you solve your problem.
0
 

Author Comment

by:itnordic
ID: 24361366
Hiya, and thanks for your reply.

Too bad I couldn't use my first idea :-) The thing is that I really want to start a slide show on my remote pc, and it uses powerpoint to show it.

I tried getting around the problem using PSEXEC, but since it want to start the slide slow I used autoit to create an exe that, when I run it locally, starts the slide show. But when I try to start it remotely it isn't visible. Process is started when I check the task manager.

Is there no way to script my way around this?  
0
 
LVL 7

Accepted Solution

by:
Hubasan earned 500 total points
ID: 24361459
Well, you should be able to launch anything remotely with PSExec with an -i switch which means interactively. just do "psexec \\computername -i yourprogram.exe"
if you go to command prompt and browse to the folder where you saved PSExec you can read all the help on PSExec if you type "PSexec" and just hit enter.
That gives you all the explanations of what it can do.

Hope this helps.
0
 

Author Comment

by:itnordic
ID: 24361625
Works like a charm now.
I found the problem. When I created the exe with autoit I put in the wrong sourcefolder for the vb script and that was why the file couldn't be found when I started the script.  



0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many programs have tried to outwit PowerPoint in terms of technology and skill. These programs, however, still lack several characteristics that PowerPoint has possessed from the start. Here's why PowerPoint replacements won't entirely work for desi…
PowerPoint is the go-to presentation software for millions of users around the world. Many presentations use basic text features but you can really make special text jump out of your slide by applying this bubble text design process. This article ha…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now