vbscript

File Access from Excel COM object fails when run from NT Service on Vista

We use COM objects to access excel spreadsheets in an NT service (via the Windows Scripting Host). Prior to Vista, this worked beautifully, but starting with Vista, we receive this error: Microsoft Office Excel cannot access the file 'c:\myfiles\test.xls'. There are several possible reasons: • The file name or path does not exist. • Th...

execute caspol from within vbscript

Hi all, I'd like to call caspol from within a script inside a custom action in an msi (setup project). I'd prefer a standard msi to ClickOnce, because with a standard msi I can install drivers & associate filetypes with our application whereas with ClickOnce I can't. When I execute the caspol command from the command line it succeeds, ...

CommonAppData in vbscript

A customer's application "AppName" has its configuration files stored in CommonAppData. Under Windows XP that is C:\Documents and Settings\All Users\Application Data\AppName Under Windows Vista that is C:\ProgramData\AppName How do I get the correct foldername with VBScript? ...

Enable/disable windows-update from a vbscript

I need to disable windows-update service from my installation. I already use vbscript to do some stuff so I would like to do it in vbscript. My knowledge of vbscript (or any other script language) is very limited so...can anybody help me out with that? I'll really appreciate it! Thanks. ...

Get SQL Server database folder of selected instance by using vbscript

Assume that you have a running SQL Server Express instance named (local)\SQLEXPRESS. Its database folder is c:\program files\Microsoft SQL Server\MSSQL.1\MSSQL\Data. How can VBScript be used to retrieve that folder? Maybe by using SMO? And if so, how? <- Forget that. SMO uses .NET. Only possible in PowerShell. Update: The reason f...

Mount/Unmount USB drives with VBSCript

I am looking for a way to mount\unmount a USB flash drive using VBScript. This is the closest I was able to get. Sub EjectDrive(strDrive) On Error Resume Next CONST SSF_DRIVES = 17 Set objShell = CreateObject("Shell.Application") Set objDrive = objShell.Namespace(SSF_DRIVES).ParseName(strDrive) objDrive.InvokeVerb "E&ject" End Sub ...

Oracle to Excel - PL/SQL export procedure

Hi, I’m writing pl/sql procedure that exports data from Oracle to Excel. I need data formatting so I can’t use CSV. I’ve already tried with XML but it generates too large files when I want to export e.g. 70000 rows with 50 columns (almost 300 MB!!!). That’s why I decided to use HTML tags to generate XLS file – it is smaller than XML a...

Exposing the indexer / default property via COM Interop

I am attempting to write a component in C# to be consumed by classic ASP that allows me to access the indexer of the component (aka default property). For example: C# component: public class MyCollection { public string this[string key] { get { /* return the value associated with key */ } } public void Add(string k...

Simple Oracle SQL date syntax question

I am trying to convert a working MS Access query to run on an Oracle database being accessed via VB Script (.asp). This is the last section of the WHERE clause: sql = sql & "WHERE (UAT.HB.MB_MODE = 'A' AND UAT.HB.PRINT_DATE >= '" & SD & "' AND UAT.HB.PRINT_DATE <= '" & ED &"' )" The variable "SD" (i.e. "start date") is a text str...

Best way to know if a user has administrative privileges from a VBScript

As the title says I need to check whether the user executing the script has administrative privilages on the machine or not. I have specified the user executing the script because the script could have been executed with a user other than the logged on using something similar to "Runas". Regards, Javier @Javier: Both solutions work i...

How to caculate last business day of month in VBScript

How do I caculate the last business day of month in VBScript. It is for a Reporting Services report. Thanks ...

VBScript: how to set values from recordset to string

This is probably a beginner question, but how do you set a recordset to a string variable? Here is my code: Function getOffice (strname, uname) strEmail = uname WScript.Echo "email: " & strEmail Dim objRoot : Set objRoot = GetObject("LDAP://RootDSE") Dim objDomain : Set objDomain = GetObject("LDAP://" & objRoot.Get("defaultNamingC...

RegDelete cannot delete Registry key in WSH 5.7

Based on the advice provided at http://www.tweakguides.com/VA_4.html to prevent Windows Vista from "intelligently" rearranging column formats in Windows Explorer, I have written a script to automate the process a little. Dim WshShell Set WshShell = WScript.CreateObject("WScript.Shell") 'Remove the "filthy" reg keys first. regKey = "HK...

How can a webpage react to Information Bar

To facilitate uploading on our web application we install/load an ActiveX control on the upload page. People don't realise the information bar is asking them to install this control. How do I set up the page so it instructs /suppors users and helps them install the addon and only proceeds when this is done? I can't find the trigger/http ...

Can you turn off case-sensitivity in VBScript strings?

Hi, I'm pretty sure the answer to this is no. I know that I can write if lcase(strFoo) = lcase(request.querystring("x")) then... or use inStr, but I just want to check there isn't some undocumented setting buried in the registry or somewhere that makes the content of VBScript strings behave consistently with the rest of the script...

Char ^= 0xB3 equivalent in VBScript

I have the following C++ code: Char ^= 0xB3; Char is a single character in a string. Is there an equivalent in VBScript? ...

vbscript to export an access query to a tab delimited file not working

Hello, I have this code: db = "C:\Dokumente und Einstellungen\hom\Anwendungsdaten\BayWotch4\Neuer Ordner\baywotch.db5" TextExportFile = "C:\Dokumente und Einstellungen\hom\Anwendungsdaten\BayWotch4\Neuer Ordner\Exp.txt" Set cn = CreateObject("ADODB.Connection") Set rs = CreateObject("ADODB.Recordset") cn.Open _ "Provider = Microso...

VBScript chr() appears to return wrong value

I'm trying to convert a character code to a character with chr(), but VBScript isn't giving me the value I expect. According to VBScript, character code 199 is: � However, when using something like Javascript's String.fromCharCode, 199 is: Ç The second result is what I need to get out of VBScript's chr() function. Any idea what t...

How do I include a common file in VBScript (similar to C #include)?

VBScript doesn't appear to have a way to include a common file of functions. Is there a way to achieve this? ...

Why is the indexer on my .NET component not always accessible from VBScript?

I have a .NET assembly which I am accessing from VBScript (classic ASP) via COM interop. One class has an indexer (a.k.a. default property) which I got working from VBScript by adding the following attribute to the indexer: [DispId(0)]. It works in most cases, but not when accessing the class as a member of another object. How can I get...