Check the existence of COM object registered using regsvr32

By | May 2, 2008

I had a chance to work on project which was using a COM object. This object was registered using regsvr32. During application migration to another server, I wanted to check the if this object exists on new server or not. I don’t wanted to write VB application to just check that object so suddenly a thought came in my mind. If I write down a vbs script file, with few lines of code, I can check out quickly. Here are the instructions to do it.

For this, you need to create a file checkobject.vbs on your computer and copy/paste the following code in it.

On Error Resume Next
Dim objVariableSet objVariable = WScript.CreateObject ("Wscript.Network1")
If Err.Number <> 0 Then
	Msgbox "Object is not found", vbCritical
	Err.Clear
Else
	Msgbox "Object found"
End If
Set objVariable = nothing

Now if you double click on that file, VB Script will be executed and appropriate message will be shown.

Vishal Monpara is a full stack Solution Developer/Architect with 12 years of experience primarily using Microsoft stack. He is currently working in Retail industry and moving 1’s and 0’s from geographically dispersed hard disks to geographically dispersed user’s mind leveraging geographically dispersed team members.

Leave a Reply

Your email address will not be published. Required fields are marked *