vbscript

Can CPU usage per process be determined in VBScript?

I'm looking to monitor processes running on a window 2003 server using a VBScript file. I've seen PercentProcessorTime, but that doesn't really capture usage. Is there anyway to determin a percentage usage? ...

Open files using VisualBasicScript (.vbs)

Hello, i want to open a file with VisualBasicScript (.vbs) How could i do this? The file is 'file.bat' and it's located in the same dir as the .vbs. It should RUN it! ...

Enumerate files with case sensitivity in VBScript?

I am using the following VBScript code snippet to enumerate all files in my c:\Scripts\ folder: strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colFiles = objWMIService. _ ExecQuery("Select * from CIM_DataFile where Path = '\\Scripts\\'") Fo...

How can I get local IP in .NET?

I have the following vbscript code that returns the local IP address. It works great. I am trying to provide the same functionality in my winform .net app. All the solutions I have come across involve using DNS. Any ideas on how to "port" this script for use in .net? A different way to do this maybe? Thanks! Function GetIP() Dim...

how to Write a VB script to extract security group data from NTFS permissions by server and nested groups in Active Directory.

i am new to Active directory but i knew vbscript, how to write an vbscript in AD to extract data from NTFS permission by server and from nested group from AD, i need just an outline how to proceed, if solution are given in code bases, it fine for the beginners like me. please post as soon as possible ...

Apply Font Formatting to PowerPoint Text Programatically

I am trying to use VBA to insert some text into a PowerPoint TextRange, I use something like this: ActiveWindow.Selection.SlideRange.Shapes("rec1").TextFrame.TextRange.Text = "Hi" However, I can't figure out how to apply bold, italic and underline programatically (I don't see a .RichText property or something similar). What I have is...

Passing Classic ASP VBScript Parameters ByRef to COM c++

It's pretty simple. There's a c++ function that uses ByRef parameters to return three variables at the same time. STDMETHODIMP CReportManager::GetReportAccessRights(long lReportCode, VARIANT_BOOL *bShared, VARIANT_BOOL *bRunOnly, VARIANT_BOOL *bCopy) However, the VBScript ASP code doesn't seem to pick up the new values for bShares, b...

How to generate a GUID in VBScript?

I want to generate GUID strings in VBScript. I know that there's no built-in function in VBScript for generating one. I don't want to use random-generated GUIDs. Maybe there is an ActiveX object that can be created using CreateObject() that is sure to be installed on (newer) Windows versions that can generate a GUID? ...

VBScript/ASP-Classic "Stop" Statement Not Breaking Into Debugger

I've used to put a "stop" statement in my VBScript/ASP-Classic code to break into debugger (Microsoft Script Editor, that comes with Microsoft Office). But now it isn't breaking anymore. The "stop" is ignored and nothing happpens. The server-side debugging flag is already enabled in IIS How to solve this? Sample Code, hello.asp st...

LDAP server access via VBscript/ADO

Can ADO access attributes other that ADsPath and Name when bound to an LDAP server? Below is the code I use to bind to and query a LDAP server on the internet: Set ado = CreateObject("ADODB.Connection") ado.Provider = "ADSDSOObject" ado.Properties("User ID") = "" ado.Properties("Pass...

OpentextFile Permission Denied Error

Hi I'm getting an error when i use opentextfile. The problem is weird because it works for a few hundred files then pops up. Basically the script gets a collection of files, searchs in them for a string which it then removes and writes back the modified content to the same file. The problem occurs when the script wants to open the file...

Vbscript can't modify component table of MSI?

I try to write vbscript, to remove the duplicated component GUID entry in component table of a MSI. But I always get 80004005 error, MSI API error. Does it mean vbscript can't modify/delete on component table? I do know Transform can. my code snippet: DeleteQuery = "delete from component where component.component="+comp Set DeleteV...

Return byte array from C# to VBScript via COM interop

Hey all, I have C# method that returns a byte array I want to be able to access from VBScript. More or less: namespace ClassLibrary7 { [ClassInterface(ClassInterfaceType.AutoDual)] [Guid("63A77D29-DB8C-4733-91B6-3CC9C2D1340E")] [ComVisible(true)] public class Class1 { public void Create( out byte...

Microsoft.Windows.ActCtx on Windows Xp

These days I'm very much busy on developing an activex/com application. Some of our customers are working under heavily restricted windows environments. So i decided to make my application regfree. I found genman32.exe which can easily create manifests (also mt.exe is useful). Everything went fine but when i tried to execute my applicati...

MSScriptControl 'Specified cast is not valid' when exposing an object to VBScript

I'm trying to implement scripting capability to my application. I'm using the code below. Whenever I instantiate a new Api object, the application is supposed to quit (a little testing thing :p) However, the application crashes at script.AddObject(...) with the error Specified cast is not valid. Is there a step I'm missing here? public...

Sort XML data in classic ASP

I want to sort below xml, Based on the Adult and child ( i need to take Adult and child as constant): <HotelDetails> <hotel> <rooms> <room> <roomname>Single</roomname> <Price>100</Price> <Adult>1</Adult> <child>0</child> </room> </rooms> <rooms> <room> <roomname...

Install software on a remote machine?

Hey SO Gus, This might seem like a dump question, but my complete ignorance with VbScript is giving me no chance to try to work it out.In short, a system administrator friend of mine, asked me to write him a script that should allow him to enter a remote machine name, a domain credentials, and an MSI package that will be installed on t...

Convert SQL code that uses XML/XPath to VBScript (classic ASP)

I want to convert below SQL Server code to VBScript in classic ASP... DECLARE @idoc int DECLARE @xdoc nvarchar(4000) DECLARE @xmldoc xml Set @xmldoc = '<Root><Authors au_id="409-56-7008" au_lname="Bennet" au_fname="Abraham"><Titles title="The Busy Executive&apos;s Database Guide"/></Authors><Authors au_id="648-92-1872" au_lname="Blotche...

How to sort xml data using classic asp(vbscript) with out xpath?

hi, this is my xml <rooms> <room> <roomname>Single</roomname> <roomid>1</roomid> <Price>100</Price> <Adult>1</Adult> <child>0</child> </room> </rooms> <rooms> <room> <roomname>Double</roomname> <roomid>2</roomid> <Price>200</Price> <Adult>2</Adult> <child>1</child> </room> </rooms> ...

Unable to connect to SQL2005 using VBScript

Using the connection string below I can connect to a SQL2000 DB but not a SQL2005. I have the code in an ASP file. Dim connStr, cn, rs, sql connStr = "Provider=SQLOLEDB;Persist Security Info=True" _ & ";Initial Catalog=mydatabase" _ & ";User ID=dbuser" _ & ";Password=dbpwd" _ & ";Data Source=...