Jump to content

Any VBS programers in the house?


smokin5s

Recommended Posts

ok, so I'm trying to do something incredibly simple... but for the life of me, I can't get it to work right...

 

I'm pretty much writing a VBS file that calls an exe... only issue is, the exe has spaces in it's path and won't work... if I take the spaces out of the path, it works fine how do I fix it?

 

Attached is the code that I'm using.

 

The reason why I'm using it is I'm trying to remotely call the exe off of a website... I have the code in there for it to populate the computer name, but for this example, I figure it's just easier to make it call the local host name.

 

*******************************

 

strComputer = "."

strCommand = "C:\Program Files\McAfee\VirusScan Enterprise\mcupdate.exe"

 

 

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)

 

****************************

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...