Hi all,

I've created this VBscript, and it works as expected.
But now I need it to be in perl and I am having trouble
with some of the Win32::OLE calls, so any help would be
appreciated.
In the code below, I need to connect to a server with my admin rights, then create a scheduled task. Which this vb script does.
In my perl attempts it breaks at the
objNewJob.Create("C:\Rescue21\install\fixsnmp.bat", _ SchdTime, False , , , , JobID)

Set objLocator = CreateObject("WbemScripting.SWbemLocator") Set objWMIService = objLocator.ConnectServer("es-g01-app01", "root\cim +v2", "NDRSMP\p57571", "Dragon#06") Set colItems = objWMIService.ExecQuery(wmiQuery) wscript.echo "Now establish a scheduled task" Set objNewJob = objWMIService.Get("Win32_ScheduledJob") set objTZone = objWMIService.ExecQuery("Select Bias From Win32_TimeZon +e") for each objItem in objTZone strBias = objItem.Bias Next SchdTime = TimeConvert(time, strBias) Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate, (Sec +urity)}!\\" _ & "es-g01-app01" & "\root\cimv2") Set objNewJob = objWMIService.Get("Win32_ScheduledJob") errJobCreated = objNewJob.Create("C:\Rescue21\install\fixsnmp.bat", _ SchdTime, False , , , , JobID)
I'd rather be racing my Daytona

In reply to need vb script to be perl by JFarr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.