kill pernicious processes?
Our family computer still gets adware and other crap on it from time
to time, despite my best efforts in using Norton, Adaware, Spybot, and
CWShredder; and avoiding the use of Internet Explorer in favour of
Firefox; and creating separate accounts for each user; and restricting
permission to install software... it seems I just can't monitor
everything every user does.
Some of this stuff my various cleaners and checkers do not seem able
to fix, and one type is particularly nasty: the type where two
programs operate in tandem, each making sure that the other is present
and running, so I can't kill the two processes fast enough via task
manager to prevent one from re-creating the other. (AdTools is an
example of this. Is there a word for this kind of program pair? "Twin
Bootstrap", or something?)
But I need to do something because these adwares aren't just annoying
and don't merely slow down my machine; they're buggy and frequently
launch hundreds of copies of themselves, thus taking CPU usage to 100%
and locking it up.
I can program in VBScript, somewhat....enough to run simple tasks or
to read an HTML form and launch programs. Is it feasible to write a
program that can kill these "Twin Bootstraps" faster than they can
bootstrap each other? If I could get hold of a ps.vbs for WinXP? Could
I have this program running all the time, or would that eat up my CPU
as well? Or would I just be heading down the wrong road altogether?
I know that there is often a third component of these twins whose job
is to redownload the adware if it discovers that they're gone, and it
can be hard to find this third process in the process list. But I
figure if I can kill the main culprits whenever they fire up, I can
hold the nasties at bay until the next update to Adaware etc. is able
to deal with them properly.
Does this idea make any sense? I sure would appreciate advice and
suggestions. Thanks in advance -- Tag: ADO with Excel in VBS Tag: 170352
Chance Text
Hello,
I want print out a chance text if startin the script.
For example:
Text 1: This is text one
Text 2: This is text two
Text 3: This is text three
and so on
When i start the script every time it must print out a change text.
Thank you
BS
I Tag: ADO with Excel in VBS Tag: 170348
Subst question
Can anybody please tell me what the following commands are doing? this
is a cmd logon script
subst m: /d >nul 2>&1
subst m: h:\notes_crb >nul 2>&1 Tag: ADO with Excel in VBS Tag: 170346
remote permissions
What are the minimum permissions a user would need to remotely restart a
service using vbs?
Of course everything works great if the user is a local administrator on the
remote machine, but that would go outside the parameters of the task.
I have given the user power user membership as well as full rights to the
Root namespace and all subnamespaces on the remote machine ... but with no
luck.
The remote machine is a Windows 2000 Server SP3
The funny thing is that power user rights allows remote connection and
service restart using "Computer Management" console, but once again this
falls out of the tasks parameters for a one button remote service restart.
Here is the script I wrote for the task
strComputer = "MyServer"
strService = "MyService"
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
CheckErr "Connect to " & strComputer
Set colRunningServices = objWMIService.ExecQuery ("Select * from
Win32_Service where Name='" & strService & "'")
For Each objService in colRunningServices
objService.StopService()
CheckErr "Stop " & strService & " Service"
objService.StartService()
CheckErr "Start " & strService & " Service"
Wscript.quit 1
Next
Wscript.echo "Could not connect to the " & strService & " on " & strComputer
Function CheckErr(strDesc)
If Err.Number <> 0 Then
strMessage = "Script failed to " & strDesc & " 0x" & Hex(Err.Number)
If(Len(Err.Description) > 0) Then
strMessage = strMessage & chr(13) & "Err.Description: " &
Err.Description
End If
wscript.echo strMessage & chr(13) & date & " at " & time
Else
wscript.echo strDesc & " successful
End If
End Function
Any help is greatly appreciated
TIA
Charles Tag: ADO with Excel in VBS Tag: 170339
Quick Debugging question
I'm doing some ASP based work for the first time and I used the tutorial on
MSDN found at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnasp/html/asptutorial.asp
Specifically the Create A Guestbook code. I changed it a little bit so that
the database was keeping the information I wanted, and my server gave me an
error saying that there was an "Undertermined String Constant" (Go here to
see my error http://64.178.102.157/numbers/input.asp). I checked the work I
did and didn't see anything wrong, then went back and check the tutorial. I
got the same error when I did the tutorial without modifying it, so
something must be wrong with it. I'm very new to this and could really use
the help.
Thanks! Tag: ADO with Excel in VBS Tag: 170328
Very basic VBScript question
I am starting to set up Java Web Start (JAWS) on my system and the docs
suggest a short VBScript - which they provide - for determining which
version of Internet Explorer is running. The only thing they DON'T say is
what the name of the file CONTAINING the script needs to be, particularly
the file extension.
Files containing JavaScripts are supposed to use a ".js" extension so I'm
assuming that VBScripts have a standard extension too, possibly ".vbs" or
".vs".
Can anyone confirm that? Or does it really not matter what the file name and
extension are for a VBScript?
--
Rhino
---
rhino1 AT sympatico DOT ca
"There are two ways of constructing a software design. One way is to make it
so simple that there are obviously no deficiencies. And the other way is to
make it so complicated that there are no obvious deficiencies." - C.A.R.
Hoare Tag: ADO with Excel in VBS Tag: 170318
Resolving e-mail addresses using VBScript
Hi,
Finding out which user owns which primary e-mail address is easy, using
ADSI.
However I could not determine a way to query any e-mail address, including
secondary e-mail addresses without going through all the contacts and
parsing their e-mail addresses array. Is there a shorter, less demanding
way?
Amit Tag: ADO with Excel in VBS Tag: 170317
Scripting.dictionary
I have a web site with some ASPs. The ASPs that contain the line
'Server.createobject(Server.Dictionary) are not running. When executed,
we receive the error given below.
Server object error 'ASP 0178 : 80070005'
Server.CreateObject Access Error
/olt/teststart.asp, line 29
The call to Server.CreateObject failed while checking permissions.
Access is denied to this object
Somebody help,
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! Tag: ADO with Excel in VBS Tag: 170309
import users into Adive Directory 2003
Hi guys,
I'm wondering if anyone has a script that imports users into active
directory from an excel spreadsheet.
Thanks, Tag: ADO with Excel in VBS Tag: 170300
Create file on external web server and save to local user drive
We currently have an internal web reporting tool that we create asp
reports that pull data from a sql server. I currently created a report
that instead of outputting the report in html format, it generates an
Excel file behind the scenes and saves it on the web server. My
question is this.....how can I get the file to save locally to the
computer of the user running the report instead of saving on the web
server? I tried the following code, but no luck
--current code that saves on the web server
xlWorkbook.SaveAs "\\webserver\storagefolder\Report.xls"
--tried the following
xlWorkbook.SaveAs "C:\Temp\Report.xls"
--or
xlWorkbook.SaveAs "\Temp\Report.xls"
both seem like the work fine, but when I look for the file, it does not
exist.
Can anyone help me out with this? Tag: ADO with Excel in VBS Tag: 170292
Login script with admin priveleges
Wondering if anyone could help me out with the following:
On NT, W2K and XP client machines I need a way to run an exe, through the
login script, with admin priveleges. I've looked into "runas" and "su",
however, they're not the best options as I run into problems with
compatability with NT or the fact that one has to insert the password when
prompted. I've also looked into "Admin Script Editor" and its packager
which lets one create and .exe to be run with alterante credentials.
Anyone know if this is possible through VBScript using impersonation?
Any enlightment into this matter would be appreciated.
Thanks!
JCOliveira Tag: ADO with Excel in VBS Tag: 170291
creating a partition
Hi,
I have looked around before posting this but haven't been successful in
finding a solution. What I'm trying to do is create a partition within
windows 2000/xp using a vbscript.
How I would like it to work is that I build the pc from a ghost image. The
PC would then autologon and run a vbscript to create a partition from the
unallocated disk space.
Is this even possible? If it is, and anyone has an example of a script that
would be able to do this or is able to point me in the right direction I
would be very grateful.
Thanks in advance Tag: ADO with Excel in VBS Tag: 170290
IE Title Bar
I am using T Lavedas' WSH Scripts for msgbox function. I want to display the
title bar at the top of the msgbox. Can't figure out how or find a reference
on MSDN.
Help?
Thanks,
dra Tag: ADO with Excel in VBS Tag: 170288
Get SAMAccountName
Could someone tell me how to determine the SAM account name using VBScript
and LDAP? I'm trying to write a login scrip that does stuff based on the
users SAM account name and haven't been able to get anything I've been
trying to work.
TIA
Ernie Tag: ADO with Excel in VBS Tag: 170285
Starting service and dependent service - multiple machines
I've got a script that reads a file(containign machine names) and
start a service. The script works as expected when trying to start
standalone service. i.e. It kicks off the service(& does not wait for
completion) in each machine.
When a service is dependent on another service, running the script
will wait for dependent service to start. Hence, for each machine the
script waits for dependent service startup.
How can I change the script such that it will not wait for dependent
service startup...?
Here's the code snippet...
---
cmdToexecute = "Winmgmts:\\" & "MyMachine" & "\root\cimv2"
Set wmi = GetObject(cmdToexecute)
Set wmiService = wmi.get("win32_service.name='" & "MyService" & "'")
LatestState = wmiService.state
LatestStatus = wmiService.status
If LatestState = "Stopped" Then
wmiService.startservice
End If
---
Thanks,
Sandiyan Tag: ADO with Excel in VBS Tag: 170280
hidden variable
In this procedure I am attempting to set the hidden variable (hidden_data)
with a delimited list of email address before submitting the form. If I put
the values in a querystring the values pass fine. However, I don't want to do
that. I have created a hidden variable in my html code named hidden_data.
When I set the variable and submit this way, the variable looses it's value.
Please help :)
Code:
sub submitform()
dim contacts()
redim contacts(listform.elements.length)
For c = 0 to listform.elements.length - 1
If listform.elements(c).type = "checkbox" then
If listform.elements(c).checked and mid(listform.elements(c).id,1,4) <>
"list" then
contacts(c) = listform.elements(c).id
end if
end if
next
tmp = filter(contacts,"@")
listform.hidden_data.value = join(tmp,",")
listform.action = "send.asp?mailer=" & listform.mailer.value
listform.submit()
end sub Tag: ADO with Excel in VBS Tag: 170275
Good IDE to write JScript or VBScript
Hi guys,
anyone of you knows a good IDE to write JScript or VBScript? The basic
funcionalities I need are: code completion, syntax highlighting and
intellisense.
I'd like this software it's free :)
Iis it possible write JScript or VBScript using Visual Studio .NET 2003.
Thanks,
Davide Tag: ADO with Excel in VBS Tag: 170271
Aaagh! cScript no longer Returning! ??
Hi, I use cScript to run the adsutil.vbs etc scripts to generate web
sites during automated installations of our product.
here is an example:
cscript.exe C:\inetpub\AdminScripts\mkwebdir.vbs -c localhost -w
"Default Web Site" -v "adminDir","C:\MyDir\Web\Admin"
This always /used/ to work just fine. Now when I try it, csript.exe
appears to do the task, but it now NEVER returns from the dos prompt.
Whats wrong with that?
I am using stock windows2000 professional workstation with IIS 5.0
installed to do this.
here is the output of the dos prompt:-
---<PRE>
Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.
C:\>cscript.exe C:\inetpub\AdminScripts\mkwebdir.vbs -c localhost -w
"Default We
b Site" -v "adminDir","C:\MyDir\Web\Admin"
Microsoft (R) Windows Script Host Version 5.1 for Windows
Copyright (C) Microsoft Corporation 1996-1999. All rights reserved.
2/18/2005 10:11:09 AM : Accessing root for IIS://localhost/W3svc/1
2/18/2005 10:11:09 AM : Done.
</PRE>---
thats it! as you can see, csript never returns from the function. It
performs the function ok, but then just sits there saying 'Done' and
does not return. you have to end task on the dos prompt!! Aagh!!
Has anyone else come across this issue??? Tag: ADO with Excel in VBS Tag: 170270
virtual path
hi,
does someone have a vbscript to check for file existance in a virtual
path ?
eg. http://www.yourserver.com/someDirectory/file.doc
pls help. thanks Tag: ADO with Excel in VBS Tag: 170269
Mail merge - data (text+tab) via http
Hello everybody !
I try since some week to lanch "automagically" fron one clic under IE on a
web page :
-> the download of a data file for Word mail merge, and save it on local
disk WITHOUT PROMPTING,
-> lanch the Word application and the merge.
I've found one script (below) to do this... or nearly : in fact this script
retrieve data from an sql server, instead of a poor data text file
(text+tab) on a html server (what i want).
And, even after several tries,.... i'm not able to modify it ....8-(((
NOTA : the data text file has the first row for name header, and the second
row has data (only 2 lines).
So... any help would be welcome !!!!!
Thanks
Eric
---------------------
<script language="VBScript">
Sub CreateDataDoc(oApp)
' Declare variables.
Dim sServer,oDoc,oRS,sTemp,sHead,oRange,oField
' Place your server's name here.
sServer = "<servername>"
' Create a new document.
Set oDoc = oApp.Documents.Add
' Create a new recordset.
Set oRS = CreateObject("ADODB.Recordset")
' Open the XML recordset from the server and pass the SQL statement
' to the Getdata.asp page.
sSQL = "SELECT * FROM AUTHORS"
oRS.Open "http://" & sServer & "/WordMailMerge/Getdata.asp?SQL=" & sSql
' Convert the recordset to a string.
sTemp = oRS.GetString(2, -1, vbTab) ' 2 = adClipString
' Append the field names to the front of the string.
For Each oField In oRS.Fields
sHead = sHead & oField.Name & vbTab
Next
' Strip off the last tab.
sTemp = Mid(sHead, 1, Len(sHead) - 1) & vbCrLf & sTemp
' Get a range object and insert the text into the document.
Set oRange = oDoc.Range
oRange.Text = sTemp
' Convert the text to a table.
oRange.ConvertToTable vbTab
' Save the document to a temp file.
oDoc.SaveAs "C:\data.doc"
' Close the document (no save).
oDoc.Close False
End Sub
Sub ButtonClick()
Dim oApp
Dim oDoc
Dim oMergedDoc
' Create an instance of Word.
Set oApp = CreateObject("Word.Application")
' Create our data file.
CreateDataDoc oApp
' Add a new document.
Set oDoc = oApp.Documents.Add
With oDoc.MailMerge
' Add our fields.
.Fields.Add oApp.Selection.Range, "au_fname"
oApp.Selection.TypeText " "
.Fields.Add oApp.Selection.Range, "au_lname"
oApp.Selection.TypeParagraph
.Fields.Add oApp.Selection.Range, "city"
oApp.Selection.TypeText ", "
.Fields.Add oApp.Selection.Range, "state"
oApp.Selection.TypeParagraph
.Fields.Add oApp.Selection.Range, "zip"
oApp.Selection.TypeParagraph
' Create an autotext entry.
Dim oAutoText
Set oAutoText = oApp.NormalTemplate.AutoTextEntries.Add _
("MyLabelLayout", oDoc.Content)
oDoc.Content.Delete
.MainDocumentType = 1 ' 1 = wdMailingLabels
' Open the saved data source.
.OpenDataSource "C:\data.doc"
' Create a new document.
oApp.MailingLabel.CreateNewDocument "5160", "", _
"MyLabelLayout", , 4 ' 4 = wdPrinterManualFeed
.Destination = 0 ' 0 = wdSendToNewDocument
' Execute the mail merge.
.Execute
oAutoText.Delete
End With
' Close the mail merge edit document.
oDoc.Close False
' Get the current document.
Set oMergedDoc = oApp.ActiveDocument
' Show Word to the user.
oApp.Visible = True
' Uncomment these lines to save the merged document locally.
'oMergedDoc.SaveAs "C:\test.doc"
'oMergedDoc.Close False
'oApp.Quit False
End Sub
</script> Tag: ADO with Excel in VBS Tag: 170268
device is in use
a user is getting h drivemapped twice because he is in group IT AND LABS
WHAT DO I DO?
Dim objNetwork, objSysInfo, strUserDN, objUser, strUser
Set objNetwork = CreateObject("Wscript.Network")
Set objSysInfo = CreateObject("ADSystemInfo")
strUserDN = objSysInfo.userName
strUser = objNetwork.UserName
Set objUser = GetObject("LDAP://" & strUserDN)
If IsMember("IT") Then
'objNetwork.removenetworkdrive "q:"
objNetwork.MapNetworkDrive "q:", "\\server\IT"
objNetwork.MapNetworkDrive "h:", "\\server\Users\" & strUser, false
End If
If IsMember("Services") Then
objNetwork.MapNetworkDrive "y:", "\\server\AcadServ"
End If
If IsMember("Administration") Then
objNetwork.MapNetworkDrive "w:", "\\server\Admin"
End If
If IsMember("Labs") Then
objNetwork.MapNetworkDrive "L:", "\\server\Lab"
objNetwork.MapNetworkDrive "h:", "\\server\Users\" & strUser, false
objNetwork.addwindowsprinterconnection "\\server\HP4100"
End If
'--------------------------------------------------------
Function IsMember(strGroup)
' Function to test one user for group membership.
' objUser is the user object with global scope.
' strGroup is the NT Name of the group to test.
' objGroupList is a dictionary object with global scope.
' Returns True if the user is a member of the group.
Dim objGroup
If IsEmpty(objGroupList) Then
Set objGroupList = CreateObject("Scripting.Dictionary")
objGroupList.CompareMode = vbTextCompare
For Each objGroup In objUser.Groups
objGroupList(objGroup.sAMAccountName) = True
Next
End If
IsMember = objGroupList.Exists(strGroup)
End Function
'---------------------------------------------------------- Tag: ADO with Excel in VBS Tag: 170267
Trying to get a file system script working
I've been learning a bit of scripting and picked a task deleting a file.
So I read a bit and search the net a bit. I came up with an example:
www.microsoft.com/technet/scriptcenter/resources/qanda/nov04/hey1102.mspx
which shows
Const TEMPORARY_INTERNET_FILES = &H20&
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(TEMPORARY_INTERNET_FILES)
Set objFolderItem = objFolder.Self
strPath = objFolderItem.Path & "\*.*"
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile(strPath)
I wanted to modify this a bit so I change the strPath line
strPath = objFolderItem.Path & "\triggerParams.js"
but this fails with an 800A0035 error.
I have checked that the file is in the folder, changing the
script to just enumerate the filenames in the folder finds it:
For each file in objFolder.Items
MsgBox "Found: " & file.name
next
Can anyone see something I've made a mistake doing?
Thanks Tag: ADO with Excel in VBS Tag: 170266
Searching for a certain file name in a log file
Is it possible to search a text file for a specific value in VBScript?
For instance:
I have a log file which contains a distribution job for software to a server.
I want to interigate this log file called library.dct (regular text file)
for a piece of software which was placed on this server. e.g [Windows XP
Service Pack 2]
Please advice, thanks in advance Tag: ADO with Excel in VBS Tag: 170263
Can I use VbScript to extract a file from a CAB fie?
I am trying to open a cab file on my local machine and then add or
delte some file to it and then recompress it into a CAB file again.
Can I use vbscript to do this?
Thanks Tag: ADO with Excel in VBS Tag: 170258
Script to enable/disable domain account?
I'd like to be able to enable/disable a specific domain account in AD using
a script. Does anyone know if this can be done?
Thanks! Tag: ADO with Excel in VBS Tag: 170246
Can non-admin run GPO script?
I've written a vbs script that will enable/disable a GPO link, and it works
fine (I'm a domain admin). However, I'd like to allow a non-admin user to
run this script. Can this be done? Tag: ADO with Excel in VBS Tag: 170245
generating empty 1gb files
Hi all!
Can I use vbscript to generate an empty file that has a specified size?
I know that you can do it by opening a file for writing and then writing
characters into it until it reaches the desired size.
But can you gneerate the file in some other way so that you can instantly
generate the file?
I need to generate dummy files that have a size of 1GB.
thanks Tag: ADO with Excel in VBS Tag: 170235
Script startup / current path?
Hi,
Which command returns the script startup / current location? I'm looking for
the directory which contains the script not the current working directory.
Many thanks Tag: ADO with Excel in VBS Tag: 170233
VPN3005 PPTP with groups
Hi,
Is it possible to have PPTP users on a 3005 concentrator authenticate into
different RADIUS groups.
I would like to have internal users assigned to one group (in one IP Pool)
and have customer users assigned to another (again with another IP Pool)
The concentraor is in a dmz off of the firewall, and I want to allow access
on an IP address basis though the firewall.
Thanks for any pointers!
Jo Tag: ADO with Excel in VBS Tag: 170231
Change WMI Property with WMI
Hello,
I'm newbie to use WMI scripting but I'm tring to use Win32_UserAccount
method.
Some of it properties are read/write and I don't know how to modify it
!!!
In fact, I would like to modify the fullname of a user per example.
I can get all information with that :
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM
Win32_UserAccount WHERE Name='rhildt'", "WQL",
wbemFlagReturnImmediately + wbemFlagForwardOnly)
And I try to modify with an update sql command :
Set colItems = objWMIService.ExecQuery("Update Win32_UserAccount SET
Fullname='Toto' WHERE Name='rhildt'")
But no error message and no change.
I looked on the microsoft documantation :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_useraccount.asp
Fullname is a read/write property but no method to modify it and no
explaination.
Somebody can help me ???
Thanks a lot and sorry for my english (I'm french)
Romain Tag: ADO with Excel in VBS Tag: 170224
Confessions of a "Top-Poster" (ugh!)...
It has come to my attention that there are participants here
who condemn the practice of "top-posting" (i.e., placing the
response ahead of the question), as in:
A: No
Q: Should I include quotations after my reply?
I must confess that I do this all the time, under the
rationalization that somebody reading down the thread has
already read the question, and shouldn't need to re-read it
in order to get to my answer.
Further, I will frequently cut off or seriously abbreviate
the question, to just the specific issue I hope to address.
O.K. so this is offensive. But, I ain't going to quit.
Here's an easy remedy. If you don't like my habit of
"top-posting" then just filter out my postings, and all my
annoying violations of netiquette will just disappear.
cheers, jw Tag: ADO with Excel in VBS Tag: 170223
LDAP Search Script - Issue Querying Terminal properties
I found this handy sample script from Microsoft's website which I want to
expand on.
I have successfully modified this script to query other values but whenever
I try to query Terminal related values the script hangs. For example, where
it mentions "SELECT givenName, SN, department, telephoneNumber FROM..." Once
I put "TerminalServicesProfilePath" and "TerminalServicesHomeDirectory" - the
script hangs.
Any idea's?
Thanks in Advance
=========================================
Const ADS_SCOPE_SUBTREE = 2
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
objExcel.Cells(1, 1).Value = "Last name"
objExcel.Cells(1, 2).Value = "First name"
objExcel.Cells(1, 3).Value = "Department"
objExcel.Cells(1, 4).Value = "Phone number"
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 100
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = _
"SELECT givenName, SN, department, telephoneNumber FROM " _
& "'LDAP://dc=fabrikam,dc=microsoft,dc=com' WHERE " _
& "objectCategory='user'"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
x = 2
Do Until objRecordSet.EOF
objExcel.Cells(x, 1).Value = _
objRecordSet.Fields("SN").Value
objExcel.Cells(x, 2).Value = _
objRecordSet.Fields("givenName").Value
objExcel.Cells(x, 3).Value = _
objRecordSet.Fields("department").Value
objExcel.Cells(x, 4).Value = _
objRecordSet.Fields("telephoneNumber").Value
x = x + 1
objRecordSet.MoveNext
Loop
Set objRange = objExcel.Range("A1")
objRange.Activate
Set objRange = objExcel.ActiveCell.EntireColumn
objRange.Autofit()
Set objRange = objExcel.Range("B1")
objRange.Activate
Set objRange = objExcel.ActiveCell.EntireColumn
objRange.Autofit()
Set objRange = objExcel.Range("C1")
objRange.Activate
Set objRange = objExcel.ActiveCell.EntireColumn
objRange.Autofit()
Set objRange = objExcel.Range("D1")
objRange.Activate
Set objRange = objExcel.ActiveCell.EntireColumn
objRange.Autofit()
Set objRange = objExcel.Range("A1").SpecialCells(11)
Set objRange2 = objExcel.Range("C1")
Set objRange3 = objExcel.Range("A1")
========================================= Tag: ADO with Excel in VBS Tag: 170222
Outlook - Changing SMTP Ports VBScript
Hi Everyone,
We have around 100 laptops out there that arent connected to a domain, and
most users arent really computer savy. I'm looking to figure out how to
change SMTP ports on specific accounts in Outlook 2003 and XP (I've figured
it out for Outlook Express). I'm not really sure where to look, I'm quite
certain these values are in the registry, but I'm not sure where to look.
Anyone have any ideas? Tag: ADO with Excel in VBS Tag: 170220
Possible in vbscript?
I'd to use an HTML editor to help filling/modifying a textarea in an
HTML form. I am totally new in programming vbscript and would like to
know whether the following scenario could be realized with vbscript.
When clicked a button located near the textarea:
<> Saves the contents of the textarea in a temporary file
<> Launches an HTML editor installed on my PC giving it the temporary
file as an argument
<> Waits for the edit session to complete
<> Stores the contents of the temporary file inside the textarea
<> Removes the temporary file
Thanks for your help.
Bruno Tag: ADO with Excel in VBS Tag: 170217
Looping Group Creation Script Help...
Hi
Firstly, I'm a newbie to vb scripting, and so I find that at the
moment, I scrape along using bits of code extracted from various
sources (mostly books or Microsoft), until I earn the fundamentals.
Basically, I'm trying to say please don't shoot me down if my script
contains glaring (to the professional eye) coding errors.
At the moment, I'm trying to create a script that creates Active
Directory global groups, based on information supplied from a text file
(the script loops until it reaches the end of the file). The script
assignes two parts to the name, which is the 'cn=' value, and the
'sAMAccountName' value. The 'cn=' part works fine, but the script falls
at the 'sAMAccountName' value. The script looks like this:
##########################################
Const ForReading = 1
Set objDictionary = CreateObject("Scripting.Dictionary")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("C:\Shared\Scripts\Groups\Groups.txt", ForReading)
Set objRootDSE = GetObject("LDAP://RootDSE")
strRoot = objRootDSE.Get("defaultNamingContext")
Set adsContainer=GetObject("LDAP://" & strRoot)
i = 0
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
objDictionary.Add i, strNextLine
i = i + 1
Loop
msgbox(strNextLine)
For Each objItem in objDictionary
adsGrp = objDictionary.Item(objItem)
Set adsGroup = adsContainer.Create("group", "cn=" & adsGrp)
adsGroup.Put "sAMAccountName", adsGrp
adsGroup.SetInfo
Next
WScript.Echo "Group creation is complete"
WScript.Quit
########################################################
I've tried putting a MsgBox in just before the 'sAMAccountName' line,
to see what the value of the 'adsGrp' variable is, but it returns as
empty, then fails.
I've used a similar script to create Organizational Units, and it works
fine, but that one doesn't assign two values. Can anyone help?
--
tbennett300
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------ Tag: ADO with Excel in VBS Tag: 170207
Error: 80072030, Facility: LDAP Provider, "There is no such object on the server."
Hi,
I desperetly seek for help here.
I'm running this script from my local machine (2003 server) and try to
connect to the exchange on a different server. I have all the CDO
obejcts installed:
1 Set iExs = CreateObject("CDOEXM.ExchangeServer")
2 iExs.DataSource.Open "inquire-exch"
4 For Each storegroup In iExs.StorageGroups
5 Next
As a result, I'm getting the following error on line number 4:
C:\a.vbs(5, 1) (null): There is no such object on the server.
Facility: LDAP Provider
ID no: 80072030
Microsoft CDO for Exchange Management
when running the script on the exchange serveri itself, no problem
occur. I also have administrator priviliges on the exchange server.
Any idea what could be the problem here?
Thanks!
Alon Tag: ADO with Excel in VBS Tag: 170202
replacing ASCII text
newbie question here:
I need to create a function that will take in a string and replace any
ASCII characters greater than ASCII code 127 with their HTML equivalent.
E.g. something like: Replace(sInput, Chr(233), "é")
but to account for every other character than might get in there.
Would it be more cost-effective (processing-time wise) to just write
lots of replace functions one after the other, or should I loop through
the string and replace and characters as I encounter them.
How would I do this?
Thanks!
--
"I hear ma train a comin'
... hear freedom comin" Tag: ADO with Excel in VBS Tag: 170201
download and save an image from a website
Hi. How do I download an image from a website and save it on the client
side?
Thanks a lot,
MC Tag: ADO with Excel in VBS Tag: 170197
Cant Access a textbox value in a div (HTA environment)
Hi,
I can write, access style variables to a textbox in a div. But i cant
read the value of it. I am working around HTA.
i tried window.textboxid.value AND
document.getElementById("textboxid").value methods...
The textbox is inside the <div>, also div properties has all read-write
permissions.
I am going to eat my keyboard.
What is the definite true solution?
Thanks
Caglar Tag: ADO with Excel in VBS Tag: 170196
CreateObject suucceed but using members fails
I have one COM server that implements one method/property that returns int .
The CreateObject does create the instance of com server.
The problem is that I get error when trying to access its method/property
with the annoying behaviour that in some computer it works and in others it
doesn't
Dim app
Dim result
Set app = CreateObject("MyApp.MyApplication")
result = app.Result
When trying with VB6.0 to check with more detais. I did:
Dim app as Object ....
and I got the same error, but if I do
Dim app as MyApplication
it works.
Looks like the "casting" from generic Object type to use defined type is not
working on those computers where I get the error.
Does anyone had similar problems before, or what is the cause of it?
Thanks on advance
alex Tag: ADO with Excel in VBS Tag: 170192
window.opener problem!
Hi,
When i used window.opener to access the opener from the popup window
this problem (object required) has occured. I used to use this
technique in my web applications without any problem. Is there a
security issue for window.opener in HTA environment.
Or a syntax difference?
Thanks.
Caglar Tag: ADO with Excel in VBS Tag: 170190
Cannot get information from details view
Hi all,
I cannot get the information in details view of "Network and Dial-up
Connections", may I have your suggestion about what is going wrong?
Code start:
sNetworkFolderName = "Network and Dial-up Connections"
Const ssfCONTROLS = 3
set shellApp = createobject("shell.application")
set oControlPanel = shellApp.Namespace(ssfCONTROLS)
for each folderitem in oControlPanel.items
if folderitem.name = sNetworkFolderName then
set oNetConnections = folderitem.getfolder
exit for
end if
next
for each folderitem in oNetConnections.items
msgbox folderitem.name
'can get the name successfully
msgbox "hi " & folderitem.ExtendedProperty("Status")
'get hi only
next
Code End
Thanks a lot Tag: ADO with Excel in VBS Tag: 170181
Inserting from ASP creates 2 records instead of 1
Hi,
I'm doing an insert from an ASP page (written in VBScript) and there is a
problem.
When I call the SP from the page, it inserts 2 records into my table. If I
call the SP directly from Query Analyzer, 1 record is inserted.
I removed the oRS.moveFirst. that fixed it, but it causes other problems.
Any ways to get around this double insert crap?
please advise Tag: ADO with Excel in VBS Tag: 170174
Access share on network computer
I have a limited experience with vbs scripting, so I would be grateful for
some help.
I need to script copying a file from one pc to another.
The source part is no problem, as I can access a share on the source pc
directly.
Due to network configuration issues I need to set a connection/access the
target WinXP Pro pc by its IP address (say 192.168.200.1) and logon with
username and password (say "pcname\myname" and "mypass").
Is there a way to make this work in one go:
logon remotely
(maybe map the remote share to local drive letter temporarily)
copy the file tothe remote share
(maybe mop up)
Thanks in advance,
Eric Tag: ADO with Excel in VBS Tag: 170171
Hidden Variable not holding value
What's happening:
When Select all button is clicked the hidden variable, buttonname, is
supposed to be set to all and the form is submitted to itself. If the
buttonname = 'all' then all of the checkboxes are supposed to be displayed as
checked. However the buttonname variable is not holding it's value. When I
view the final source after submitting the form, the buttonname variable is
empty. I didn't know what group to post this in since my code contains both
vbscript and javascript. If you can help I'd very much appreciate it.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>StarNet - E-mail Admin</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="JavaScript">
function submitthis ( selectedtype )
{
document.list.buttonname.value = selectedtype ;
document.list.submit() ;
}
-->
</script>
<% getCon=Application("connectionObject")
'type is true if an ecard and false if a newsletter.
dim objrs,bool,mailer
set objrs=server.CreateObject("adodb.recordset")
set objGroups=server.CreateObject("adodb.recordset")
set objContest=server.createobject("adodb.recordset")
objrs.open "select * from addstarnet where username ='" & session("whois")
& "' order by groupname",getcon,3,3
If isnull(session("agentid")) or session("agentid") = "" or
isempty(session("agentid")) then
contestcontacts = false
else
objContest.open "select * from contest where agentid = '" &
session("agentid") & "'",getcon,3,3
If not objContest.eof then
contestContacts = true
objContest.movefirst
else
contestContacts = false
end if
end if
If not objrs.eof then
bool = true
objrs.movefirst
objGroups.open "select distinct groupname from addstarnet where username =
'" & session("whois") & "' order by groupname", getcon,3,3
objGroups.movefirst
else
bool = false
end if
%>
</head>
<body>
<table width="638" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="634" height="236" valign="top" bgcolor="#FFFFFF"><div
align="center">
<table width="634" border="0" cellpadding="0" cellspacing="0"
style="margin-bottom:0">
<tr>
<td width="634"><div align="center"><img src="images/S.gif"
width="40" height="65"><img src="images/t.gif" width="50" height="65"><img
src="images/a.gif" width="64" height="65"><img src="images/r.gif" width="50"
height="65"><img src="images/n.gif" width="54" height="65"><img
src="images/e.gif" width="48" height="65"><img src="images/t.gif" width="50"
height="65"></div></td>
</tr>
<tr>
<td><div align="center"><font color="#996600">E-mail Postcard and
Newsletter System</font></div></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><strong><font color="#000000">Step 4 - Send
to... </font></strong></td>
</tr>
<tr>
<td valign="top"> <p align="center"> </p>
<p align="center"><a href="email_admin.asp">Add/Delete/Edit
E-mail
Addresses</a></p>
<% If bool = true then%>
<form action="step4.asp" method="post"
enctype="multipart/form-data" name="list">
<table width="530" border="1" align="center" cellpadding="1"
cellspacing="1">
<tr bgcolor="#CCCCCC">
<td colspan="4" bgcolor="#CCCCCC"><a
href="javascript:submitthis('all')">Select
All </a> -<a href="javascript:getsupport('Free')">
Delete
Selected</a> - <a
href="javascript:getsupport('Free')">Select
Contest Contacts Only</a></td>
</tr>
<%response.write(request("mailer"))
For i = 1 to objGroups.recordcount%>
<tr bgcolor="#CCCCCC">
<td colspan="4" bgcolor="#FFFFFF"><font size="2">
<input name="buttonname" type="hidden" value="">
<input name="list<%response.write(i)%>"
type="checkbox" id="list<%response.write(i)%>"
value="<%response.write(objGroups("groupname"))%>" <%If request("buttonname")
= "all" or request("list" & i) = objGroups("groupname") then
response.write("checked")%>>
<%response.write(objGroups("groupname"))%>
</font></td>
</tr>
<% b = 1
Do until objGroups("groupname") <> objrs("groupname")%>
<tr bgcolor="#CCCCCC">
<td width="45" bgcolor="#FFFFFF"><div
align="right"><font size="2">
<input name="list<%response.write(i & "-" & b)%>"
type="checkbox" id="list<%response.write(i & "-" & b)%>"
value="<%response.write(objrs("email"))%>" <%If request("buttonname") = "all"
or request("list" & i) = objGroups("groupname") then
response.write("checked")%>>
<%b=b+1%>
</font></div></td>
<td width="135"
bgcolor="#FFFFFF"><%response.write(objrs("first"))%></td>
<td width="145"
bgcolor="#FFFFFF"><%response.write(objrs("last"))%></td>
<td width="195"
bgcolor="#FFFFFF"><%response.write(objrs("email"))%></td>
</tr>
<%objrs.movenext
if objrs.eof then exit do
loop
objGroups.movenext
Next
if contestContacts = true then%>
<tr bgcolor="#CCCCCC">
<td colspan="4" bgcolor="#FFFFFF"><font size="2">
<input name="contest" type="checkbox" id="contest"
value="Contest Contacts">
Contest Contacts
</font></td>
</tr>
<%For i = 1 to objContest.recordcount%>
<tr bgcolor="#CCCCCC">
<td width="45" bgcolor="#FFFFFF"><div
align="right"><font size="2">
<input name="list<%response.write("c-" & i)%>"
type="checkbox" id="list" value="<%response.write(objcontest("emailadd"))%>">
</font></div></td>
<td width="135"
bgcolor="#FFFFFF"><%response.write(objcontest("firstname"))%></td>
<td width="145"
bgcolor="#FFFFFF"><%response.write(objcontest("lastname"))%></td>
<td width="195"
bgcolor="#FFFFFF"><%response.write(objcontest("emailadd"))%></td>
</tr>
<%objcontest.movenext
next
end if
%>
</table>
<input name="mailer" type="hidden"
value="<%response.write(request("mailer"))%>">
<div align="center"><br>
<input name="image" type="image" src="images/next.gif"
alt="submit form" width="87" height="32">
</div>
</form>
<%end if%> </td>
</tr>
</table>
</div></td>
</tr>
</table>
</body>
</html> Tag: ADO with Excel in VBS Tag: 170168
how to check file access
Hi all,
I'm hoping that one of you can help me with the following issue.
I would like to copy some files from one location to another.
This is not so difficult to do with vb scripting, but in my case it's
possible that the person that is executing the script has no access to some
of the files.
Now I can solve this with on error resume next, but then I don't have
controle over the situation.
I would like to check if the user is able to read the file before copying
it.
That way I don't have to create all the subfolders at the destionation
folder if it's empty.
I also can open every file that I'm copying and see if this raises an error,
but that seems a lillte to much overhead if you ask me.
I'm sure that there is an easier way, but I have not found it yet....
Any help is surly appriciated....
Thanks in advance...
Greetings Sander Tag: ADO with Excel in VBS Tag: 170165
Multiple Computer System Restore disable script
Hi,
I'm trying to run a script on my Network to disable System Restore on every
computer in the Domain. This is what it looks like:
On Error Resume Next
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = _
"SELECT CN FROM 'LDAP://dc=domainname,dc=com' WHERE
objectCategory='computer'"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
strComputer = objRecordSet.Fields("Name").Value
' =====================================================================
' Insert your code here
' =====================================================================
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\default")
Set objItem = objWMIService.Get("SystemRestore")
errResults = objItem.Disable("")
' =====================================================================
' End
' =====================================================================
objRecordSet.MoveNext
Loop
I'm not sure if there is anything run with it but it's not working. Could
somebody help?? Tag: ADO with Excel in VBS Tag: 170161
Excel formatting using vbscript
Hi all,
I'm searching for he code how to align the text in a cell to centered.
anybody an idea?
--
K0b3
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------ Tag: ADO with Excel in VBS Tag: 170159
Wait for the install to finsh! Please!
I am launching an install with setup.exe and need the script to wait
until the install (msiexec) has completed before moving on, I have
tried several command and none of them seem to work...
In a vbs I am trying to uninstall any old version of NAV they have and
then install the new version of NAV with the settings we want. All
done with no user interaction.
I am launching the uninstall with "start /w msiexec /x {GUID HERE} /qn
REBOOT=REALLYSUPPRESS"
And then the install with "start /W setup.exe /v""/qb+
ADDLOCAL=SAVMain,SAVUI,SAVHelp,EMailTools,OutlookSnapin,Pop3Smtp,QClient
ENABLEAUTOPROTECT=1 RUNLIVEUPDATE=1 NETWORKTYPE=1 SERVERNAME=MANAGED
REBOOT=REALLYSUPPRESS /l*v c:\SAV9Inst.Log"" ",1,True"
I am using objshell.run "......" for both the install and uninstall.
The wait command does not seem to work, it launches msiexec so when
setup.exe exits it thinks it is done. How can I do this? Should I be
uinsing the Windows Installer method instead? I cannot find a lot
details on the use of this method.
TIA.
Regards. Tag: ADO with Excel in VBS Tag: 170157
How can we use ADO with excel (xls) in vbs? Any examples please.
I read the MS ADO reference Michael...
Thank you.
CAglar
"caglaror" <caglaror@gmail.com> wrote in message
news:1108913286.448871.81440@c13g2000cwb.googlegroups.com...
> How can we use ADO with excel (xls) in vbs? Any examples please.
> I read the MS ADO reference Michael...
> Thank you.
> CAglar
>
What do you want to do?
Perhaps build an MS-Excel worksheet from a database table?