vbscript

VBScript, Batch or PowerShell Script?

I'm trying to run various commands using psexec.exe from Windows Sysinternals. What I need is a simple script to read the output of those commands. For example if everything went OK, then it returns a 0. If something went wrong, then it will spit out an error code. How can it be done? ...

Rename PC To Serial Number

I'm trying to make a script to rename PC's to their serial number. I'm not great with VB, but I've been able to put together enough code to READ the serial number, but I'm not sure where to WRITE it. Here's what I currently have: strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set col...

Run a vbscript from another vbscript

How do I get a vbscript to run another vbscript? Id imagine its only a few lines of code but not tried doing this before, nothing is passed between the 2, one just needs to call/run the other. For examples the script being run is called TestScript.vbs, the other script for it to call/run would be called Secondscript.vbs, both of which ...

Problem casting field when querying spreadsheet

I am trying to query an .xls spreadsheet with VBScript, but I have run into an issue when trying to cast a field. I connect to the spreadsheet like this. Set objConnection = CreateObject("ADODB.Connection") objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DataSource & ";Extended Properties=""Excel 8.0;HDR=No;"";" ...

How to check which Operating System ?

How can I check OS version in a batch file or through a vbs in an Windows 2k/2k3 environment ? You know ... Something like ... : "If winver Win2k then ... or if winver Win2k3 then .... ...

Get server IP of PPP VPN in Windows using VBScript or CMD

Hi all, Is it possible to use VBScript or commandline to grab the server IP of a PPP VPN under Windows? Note this is not VPN dialup server IP. ...

Updating the default font in outlook 2002

I have been asked to create a vbscript that will set the default font for users in Outlook 2002. I have got some code that alters three registry keys and is supposed to update the font details. The keys are being updated in the registry but have no effect on Outlook, I have restarted outlook and rebooted the machine and the font remain...

Overusing CInt?

I am fixing a defect in some classic ASP using VBScript and I've come across the following line: variable1 = CInt((CInt(variable2) MOD CInt(3600))\ CInt(60)) Is it necessary to call CInt(3600) and CInt(60) when we are using them in an expression? Would this be an equivalent expression? variable1 = (CInt(variable2) MOD 3600) \ 60 ...

Finding and removing orphaned web pages, images, and other related files.

I am working on a number of websites with files dating back to 2000. These sites have grown organically over time resulting in large numbers of orphaned web pages, include files, images, CSS files, JavaScript files, etc... These orphaned files cause a number of problems including poor maintainability, possible security holes, poor custo...

Classic ASP class properties

Is it possible to set a dictionary object as a property of a class in classic ASP? I can't seem to get the syntax right. I have a function that I want to return a dictionary object, and assign the dictionary object that is returned by the function to the class property, but I keep getting a type mismatch error? If I can't use the dictio...

VB Script and Access

I have a vbscript which does the following: Open an access 2003 database Run a subroutine to populate the tables in the database Close the database Run a batch file which uploads the database to an ftp This vbscript is set up to run as a scheduled task in windows XP. When I manually run the script, everything works perfectly. If I ha...

VBscript and ADO - 3704 Operation is not allowed when the object is closed.

Hi All, This function inserts a row into a SQL database and needs to return the identity number created: Function WriteDatabase(backupTypeID, numImages, folderSize, success, errorMessage, strLogFileName) On Error Resume Next err.clear Set objConnection = CreateObject("ADODB.Connection") Set objRecordSet = CreateObject(...

Migrate (monolithic) Classic ASP to ASP.Net

For many years I have had an objective of moving out of ASP/VBScript to a "better" language - my preference would be C# as I have skills in C - but I would consider other languages too (including PHP etc. so not just DotNet) Objective is to have the code base in a language which does more for us. I hate the lack of data typing in VBScri...

Windows Script Host Error

I have the following code: Function ExistShare(strServer, strUser) Set objWMILocator = CreateObject("WbemScripting.SWbemLocator") Set objWMIService = objWMILocator.ConnectServer (strServer, "root\cimv2", "NSWIDCFPT03\WMIQuerys", "XXXPASSWORDXXX") objWMIService.Security_.ImpersonationLevel = 3 'Set colShares = objWMIServi...

Appending columns from two tables in MS Access

I have two MS Access tables: tableA num state 1 12 2 13 1 11 3 12 tableB num stateA stateB 1 12 11 1 12 11 2 13 12 2 12 11 1 12 11 1 15 11 3 12 11 How can I create a third table which will have only one column num - appended from two table...

Using Classes in a Dictionary in Classic ASP

Hi I usually do C# but have inherited a classic ASP project. I have defined a class: Class clsPayment Public Name End Class Set objPayment = New clsPayment objPayment.Name = "StackOverflow payment" And a dictionary: Set colPayments = CreateObject("Scripting.Dictionary") colPayments.Add 1, objPayment When rea...

How to set delay in vbscript

Hi, How to set delay in vbscript?? WScript.Sleep(100) does not work on Windows XP, Vista Any help! ...

Unable to call c# code from vbscript - ActiveX error

Hi, i am trying to call a method i have written in c# from vbscript. I have followed just about all of the instructions i can find on the web and am still having problems. Specifically i am getting the error, ActiveX component can't create object, Code: 800A01AD. So far i have done the following.. 1] Set ComVisible(true) 2] Registere...

vbscript autocomplete

Hello, Does someone know where can i find a vbscript autocomplete, google style (no postback)? Thanks ...

Detect Windows CE in vBScript ( Logon script )

Im wondering if its posible to detect windows CE in a windows logon script ( Scrip runs in the user account ). I assume its posible to detect this via some checking for some file, but i was hoping for a bit "cleaner" solution. ...