Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Error when launching vbscript at windows startup

$
0
0

I have a thin client running WES 7 Standard trying to launch a powerpoint file without loading the shell(explorer). I've done this with other applications like IE and Citrix Apps but am getting an error that I don't understand. Below is the script i'm using.

Set WshShell = Wscript.CreateObject("WScript.Shell")

CMD = "C:\slideshow.pptx /F"
strComputer = "."
WshShell.Run CMD,3,True 


Do While (1)

     Set objWMIService = GetObject("winmgmts:" _& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
     Set colProcesses = objWMIService.ExecQuery _
         ("Select * from Win32_Process Where Name = 'pptview.exe'")

     If colProcesses.Count = 0 Then
         WshShell.Run CMD,3,True
     End If

     Wscript.Sleep (2000)

Loop

I've tried various combinations in the CMD field for launching the file. These include using a batch file to pointing to powerpoint viewer and using the command line switches to launch file. Every method so far gives me error dialog from the viewer saying there was an error accessing "the location of the powerpoint file." I have placed this file all over windows and get the same error and even tried this with an administrator account. I suspect it may have to do with the way I am launching this script but do not understand why as I can launch it manually and it works no problem.

I launch the script by modifying the the HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit key to point to a userinit.bat file.

@echo off
if not exist c:\%username%.lck goto Reg
Start c:\windows\system32\applaunch.vbs 
exit
goto End
:Reg
start C:\WINDOWS\system32\userinit.exe
:End
Exit
Any ideas why I am getting this error? Any suggested alternatives? I am getting close to conceding and setting it up to launch after explorer loads because this particular machine and it's purpose won't be within easy reach of people accessing it but I do use this method for other functions where we do not want explorer access available at all. i.e no start menu/taskbar loaded



Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>