Solved

Error on vb script

Posted on 2014-09-09
2
200 Views
Last Modified: 2014-09-10
Hi

when i run this script i got error - Microsoft VBScript compilation error: Expected end of statement

i want to know how to fix this error


Set objShell = WScript.CreateObject ("WScript.Shell")

strservice = C:\Program Files\Tivoli\TSM\baclient\dsmcutil" inst scheduler /name:"TSM Client Scheduler" /node:%computername% /clientdir:"c:\Program Files\Tivoli\TSM\baclient" /optfile:"c:\program files\tivoli\tsm\baclient\dsm.opt" /password:%computername% /validate:yes /autostart:yes /startnow:yes

objShell.Run strservice
0
Comment
Question by:David Regev
2 Comments
 
LVL 58

Expert Comment

by:Gary
Comment Utility
Missing an opening "

strservice = C:\Program Files\Tivoli\TSM\baclient\dsmcutil"
0
 
LVL 82

Accepted Solution

by:
oBdA earned 500 total points
Comment Utility
There are a few more double quotes missing, and VBScript can't expand environment variables directly:
Set objShell = WScript.CreateObject ("WScript.Shell")
strComputerName = objShell.ExpandEnvironmentStrings("%ComputerName%")
strService = Chr(34) & "C:\Program Files\Tivoli\TSM\baclient\dsmcutil" & Chr(34) & " inst scheduler /name:" & Chr(34) & "TSM Client Scheduler" & Chr(34) & " /node:" & strComputerName & " /clientdir:" & Chr(34) & "C:\Program Files\Tivoli\TSM\baclient" & Chr(34) & " /optfile:" & Chr(34) & "C:\Program Files\tivoli\tsm\baclient\dsm.opt" & Chr(34) & " /password:" & strComputerName & " /validate:yes /autostart:yes /startnow:yes"
objShell.Run strService

Open in new window

0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

744 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

12 Experts available now in Live!

Get 1:1 Help Now