Tags » VBScript

How to use VBScript in C++ (Using Qt)

In this article I’ll explain the process of combining C++ and VBScript codes together. There are many situations in which you find yourself in desperate need of some simple code that can handle what your program wants to do.  216 more words


Automatically trace elements to domain model in Enterprise Architect

This script will search the text in the comments, scenario’s and linked document of the selected elements for terms in the domain model. If it finds a match it will create a trace from your selected element to the element in the domain model. 2,501 more words

Enterprise Architect

Set all line styles in an Enterprise Architect diagram automatically

With this script you can change set all the lines styles on a diagram at once, to your preferred style per type of connector.

In Enterprise Architect you can choose from no less then 9 different line styles for the connectors. 912 more words

Enterprise Architect

Tutorial: Generate complex documents from Enterprise Architect with a two-step semi-automated approach

  • Step 1: Create the virtual document with a script
  • Step 2: Generate the document from the virtual document

Document generation is important in most organisations that work with Enterprise Architect. 2,475 more words

Enterprise Architect

[VBscript] Move out files over n days

Script is used for moving some backup files over certain days

On Error Resume Next
Option Explicit
Dim fso, f, objPC, oFile ,nMaxFileAge ,today
Dim SourceFolder ,DestFolder ,dFileCreated…

53 more words
Network Drive

SCOM monitor for monitoring services status and system drivers presence

Script for the monitor. Currently looking for Sophos antivirus service and system driver.

'Try with or without after you have tested outside of SCOM
On Error Resume Next
Dim oAPI, oBag
Dim StrMntrStatus
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()
For testing
'strComputer = "xyz.domain.com"
'Monitor has to be set to receive DNS name as 1st parameter
strComputer = WScript.Arguments(0) 
strrslt = "" ' String for debugging info
strSvcPresent = "No"
strSvcStatus = "None"
strSysDriverPresent = "No"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_SystemDriver where Name='vsepflt'",,48)
'wscript.echo TypeName(colItems)
if not isempty(colItems) then
 For Each objItem in colItems
 strSysDriverPresent = "Yes" 
 'wscript.echo strrslt
 'wscript.echo "Driver not installed"
end if
set colItems = Nothing
Set colItems = objWMIService.ExecQuery("Select * from Win32_Service where Name='SavService'",,48)
For Each objItem in colItems
 strSvcPresent = "Yes"
 'strSvcStatus = objItem.Status
 strSvcStatus = objItem.State
strrslt = strrslt & vbcrlf & "strComputer: " & strComputer
strrslt = strrslt & vbcrlf & "strSysDriverPresent: " & strSysDriverPresent
strrslt = strrslt & vbcrlf & "strSvcPresent: " & strSvcPresent
strrslt = strrslt & vbcrlf & "strSvcStatus: " & strSvcStatus
Set objWMIService = Nothing
set colItems = Nothing
Call oBag.AddValue("Computer",strComputer)
Call oBag.AddValue("SysDriverPresence",strSysDriverPresent)
Call oBag.AddValue("SvcPresent",strSvcPresent)
Call oBag.AddValue("SvcStatus",strSvcStatus)
 if ((strSvcPresent="Yes" and strSvcStatus="Running") or strSysDriverPresent="Yes") then
 Call oBag.AddValue("Status","OK")
 StrMntrStatus = "OK"
 elseif strSvcPresent="Yes" and strSysDriverPresent="Yes" then
 Call oBag.AddValue("Status","Warning")
 StrMntrStatus = "Warning"
 Call oBag.AddValue("Status","Bad")
 StrMntrStatus = "Bad"
 end if
Call oBag.AddValue("MntrStatus",StrMntrStatus)
strrslt = strrslt & vbcrlf & "StrMntrStatus: " & StrMntrStatus
wscript.echo strrslt
Call oAPI.Return(oBag)

Delete files with a rolling over period (30 days or hours) using VBScript

In this example we will delete files in all folders and keep the last 30 files for that have their creation or modifcation not older than 30 days ( 117 more words