compare - VBScript If Instr with a recordset

I am trying to do an if statement with a recordset within VBScript to do a "like" compare a recordset.While Not rs.EOF result = result & "<tr style='" & FontStyle(FontFamily, FontSize) & _ " background-color: " & RowColors(number mod 2) & "'>" &_ Tdc(number) & Td(rs("Name")) & Tdc(rs("Machine Type")) & _ Tdc(ChooseStatusColor(rs("Backup Status"))) & _ Tdc(rs("Backup State")) & Td(rs("Last Backup Start")) & _ Td(rs("Last Backup En...Read more

How to unzip multiple zip folders using VBscript?

I need a VB script to unzip multiple different zip folders. I have this script - but it does not work.Sub Unzip() Set fso = CreateObject("Scripting.FileSystemObject")For Each f In fso.GetFolder("C:\Dal\").Files If LCase(fso.GetExtensionName(f)) = "zip" Then Unzip f.path, "C:\Dal" End IfNextEnd Sub...Read more

vbscript - Issues opening a recordset in VB Script when connecting to DB2 via ADO

I am trying to use vbscript to connect to an iSeries DB2 database via ADO to do some very simple data retrieval, but am hitting a couple of oddities.If I set the cursorlocation on the connection to be server side then the wscript process "disappears" after step 3 (see below). If i set the CursorLocation to be local then I get an "unspecified error " (80004005) message when trying to open the recordset.If I copy the code into VB (and make the minor syntax changes) then everything works correctly, so it can't be access permission to the database....Read more

upload - VBscript , create directory in FTP

I would like to create a directory in FTP, the name of the directory must be as my computer name,here is my code,Dim FoldertoCreate, filesys, newfolder, ObSet Ob = Wscript.CreateObject("Wscript.Network" )FoldertoCreate = "ftp://user:password@ftpserver/url-path/" & ob.ComputerNameSet filesys = CreateObject("Scripting.FileSystemObject")If Not filesys.FolderExists(FoldertoCreate) Then Set newfolder = filesys.CreateFolder(FoldertoCreate)End IfThis code doesn't work however when i replace ftp://user:password@ftpserver/url-path with any local d...Read more

outlook - Unable to Enumerate and Delete Registry Values Using VBScript

I need to iterate through the registry foe each application for which the following key exists: HKCU\Software\Microsoft\Office\15.0\[NAME OF APPLICATION]\Resiliency\DisabledItemsSo that I can delete any values stored here.I wrote the below script, but all this seems to do is iterate through the keys until it reaches Outlook, at which point it assures me the key does not exist (even though it definitely does), and then the script stops running.'***********************************************''------------------------------------Add-In Keys''****...Read more

vbscript - Remove Number and period in filename vbsript

I have already found a script that will replace underscore (_) and other text that I write in script. I need to modify this script so that it will also remove all the numbers in the filename too. I tried [0-9] and /d but that didn't remove the numbers in the filename. Also I tried to remove a period in the file name, but that also removed the file extension. So it took away the .csv too. Can someone help?'========================================================' VBScript to replace underscore in file name with space ' for each files in a folder...Read more

VBScript to download files via SFTP using WinSCP fails with Unable to use key file (unable to open file)

I am trying to download some files from a remote directory via SFTP using WinSCP.Till now I have this VBScript. Please note, the connection to SFTP server is set up via private key (.ppk file).The code goes like below:Function SFTPDownload(byVal sLocalPath, byVal sRemotePath, byVal sRemoteFile) Set oFTPScriptFSO = CreateObject("Scripting.FileSystemObject") Set oFTPScriptShell = CreateObject("WScript.Shell") sRemotePath = Trim(sRemotePath) sLocalPath = Trim(sLocalPath) sOriginalWorkingDirectory = oFTPScriptShell.CurrentDirectory ...Read more

Variable not defined error in Classic ASP (VBScript)

Microsoft VBScript runtime error '800a01f4'Variable is undefined: 'product_id'/Vital/form/products.asp, line 64 I am using option explicit and I have defined the variable asDim product_idproduct_id=Request.Form("product_id")Is this a problem with IIS or sql server 2003? Actually its working fine when i access my sql server 2008 database from localhost. But the problem comes when my client uploads the asp file to web server and try to access mysql 2003 database....Read more

vbscript - Classic asp page is throwing "internal server 500 error"

Connection file<% Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open "abc","ID","Password" conn.commandtimeout=120 Set RS = Server.CreateObject("ADODB.RecordSet") rs.activeConnection = Conn%>Classic ASP file<%response.buffer = true%><%Response.Expires = 0%><!-- #include file="functions.asp" --><% Response.Write session("RequestID")%><%if session("ValidLogon") <> "true" then if request("FromEmail") = "True" then SetSessVar() else%> <%response.redirect "Defa...Read more

Classic ASP (VBScript) Display only first image (YouTube image)

This is my first time posting here - it's a great resource, I keep seeming to find solutions on here. I'm writing code to display an image gallery of YouTube videos on a website. I'm using Classic ASP to parse the RSS feed, and so far I've successfully got the thumbnail of the YouTube video. Now I'm trying to display only one of the 4 Jpegs - the URL of the YouTube RSS for thumbnails seems to be in the following format:http://i.ytimg.com/vi/oh_OMkstzMQ/0.jpghttp://i.ytimg.com/vi/oh_OMkstzMQ/1.jpghttp://i.ytimg.com/vi/oh_OMkstzMQ/2.jpghttp://...Read more

vbscript - Script to start traceroute if continuous ping fails, output to log

I want to continuously ping my home public IP address, and if the ping fails automatically do a traceroute to see where it's failing.I've been trying to follow the comments made here:http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/efc97c66-60a6-4fd7-8be4-4b454d040ce5Windows compatible would be preferable, bat or vbs would be best. From anywhere on the internet I will lose my connection to my home network. From work I have started a ping and when it drops I've done a traceroute and it fails before it gets to my IP.I need a log file...Read more

VBscript, which will MAKE a local user change their password at next login

Ok, so I have been going at this forever now and I am finding no answers to this that actually work. So, I am trying to create a Script which will make a local user change their password when they next logon. I have looked and looked and looked, but nothing helps. Though I feel like I’m close but missing something. Now I will say I am very, very new to scripting in general so sorry if I seem dumb, but I’d love the help. Also, I am using Windows 10 (not sure if that will make a difference). I am also creating this for a school assignment and I d...Read more

VBScript SendKeys 800A0408 Invalid Character

I'm getting this compilation error with a script I was working on using WScript.SendKeys. Yes, I have saved the .vbs file to be encoded as ANSI. It says the error is on Line 48, which is this:shell.SendKeys {ENTER}The rest of the script works just fine if I take this line out, in case that's important....Read more

vbscript - Is it better to use properties in the child class to access the parent, or make the parent public?

I have 2 classes, a parent and a child. Class Test Private Test_Text Private Sub Class_Initialize() Test_Text = "Hello" End Sub Private Sub Class_Terminate() End Sub Public Property Get Text Text = Test_Text End Property Public Property Let Text(ByVal strIn) Test_Text = strIn End PropertyEnd ClassClass SubTest Public SubTest_Test Private SubTest_Interger Private Sub Class_Initialize() Set SubTest_Test = New Test End Sub Private Sub Class_Terminate() Se...Read more