How to convert vbs scripts to perl scripts?

Addons for Cacti and discussion about those addons

Moderators: Developers, Moderators

Post Reply
ioiioi
Cacti User
Posts: 52
Joined: Mon Mar 28, 2005 8:57 am

How to convert vbs scripts to perl scripts?

Post by ioiioi »

hey guys, I want to use perl co-operate with wmi to monitor some specific file's size located on the remote host(win2k), and I have found the following vbs scripts from Microsoft, it works, but I dont know how to convert it to perl. Is there anybody can help me?

Code: Select all

strComputer = "192.168.100.17"
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")
Set colFiles = objWMIService. _
    ExecQuery("Select * from CIM_DataFile where Name = 'D:\\languardnss6.exe'")
For Each objFile in colFiles
    Wscript.Echo "File Name: " & "." & objFile.Extension
    Wscript.Echo "Path: " & objFile.Path & objFile.Name
    Wscript.Echo "File Size: " & objFile.FileSize 
Next
moshesharon
Posts: 17
Joined: Sat Dec 18, 2004 5:38 pm

Convert VBscript to Perl

Post by moshesharon »

Hello

there is a tool from activestate.com called "Perl Dev KIT" in this package you can find VBscript to perl converter.
i only tried it several times but it works fine.
here is the link
http://www.activestate.com/Products/Per ... ation.plex
it costs money but you can try the trial

Hope it helped

Moshe Sharon
rkramer
Cacti User
Posts: 54
Joined: Fri Jun 03, 2005 12:25 pm

Post by rkramer »

instead of converting, just look on the net for perl - wmi examples and build from there, MUCH easier.
ioiioi
Cacti User
Posts: 52
Joined: Mon Mar 28, 2005 8:57 am

Post by ioiioi »

thanks for moshesharon's info, I have used Perl Dev kit for converting it to perl scripts, It works!!!
now, I am learning how to transfer the user input value into the perl scripts and return the result.
it is very interesting, but time consuming. since most of w32 scripts are based on the w32_query_operatingsystem.
cos I am a newbie about perl, so I have a little difficult in understanding it, So It would be better if I could find a more simpler perl scripts add on.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests