Zip and Unzip files and folders
Hi,
I have a script that makes a backup of my info, in win2003 server, but I
need zip and unzip my info with the same backup script, I dont want install
software extra, I want use the way that windows have to make compressed
ziped folders.
Someone can help me??? Tag: how to query line number? Tag: 167755
REgini syntax
What syntax do I use to change permissions on a key and all of it's child
objects?
I have
\registry\machine\software\burli [1 17]
the above is an example.
what do I need to add to have those permissions propagate down? thanks Tag: how to query line number? Tag: 167750
standalone ADO recordset
If I create and fill a standalone ADO recordset is there any way I can write
SQL to compare these records with an existing Access table? I have an Access
database with photo file names and descriptions in a table. My vbscript
builds a standalone recordset based on jpg files found in some folder. I
would like to report any records missing in either the database table or
files in the folder.
thanks
ljb Tag: how to query line number? Tag: 167748
VB Script newbie question
Hi
I have the following script, which works fine for getting
some of the data requested but not all. I realise the
reason this occurs is thatin the line: "Select * from
Win32_ComputerSystem",,48)
it just specifies win32_computersystem. Is there a way to
specify multiple WMI objects in the same script?
-----------------
On Error Resume Next
strComputer = InputBox ("Enter Remote Computer Name or
Press Enter for local machine","Enter Remote Computer
Name",".")
Set objWMIService = GetObject("winmgmts:\\" & strComputer
& "\root\cimv2")
Set colItems = objWMIService.ExecQuery(
For Each objItem in colItems
Wscript.Echo "Wallpaper: " & objItem.Wallpaper
Wscript.Echo "Domain: " & objItem.Domain
Wscript.Echo "Manufacturer: " & objItem.Manufacturer
Wscript.Echo "Model: " & objItem.Model
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "NumberOfProcessors: " &
objItem.NumberOfProcessors
Wscript.Echo "PrimaryOwnerName: " &
objItem.PrimaryOwnerName
Wscript.Echo "SystemType: " & objItem.SystemType
Wscript.Echo "TotalPhysicalMemory: " &
objItem.TotalPhysicalMemory
Wscript.Echo "UserName: " & objItem.UserName
Wscript.Echo "Computer name: " &
objComputer.MachineName
Wscript.Echo "Start Time: " & objItem.StartTime
Next Tag: how to query line number? Tag: 167744
FileExists Wildcard + newest file
I am writing a script to read a log file that is dumped at random
times. All of the logs are in the same location but the name contains a
timestamp of sorts.
example:
c:\log\log2004-11-16-13-12.log
How do I search the directory for "c:\log\log*" and open the newest one
for reading? Tag: how to query line number? Tag: 167740
read email header info
I need to retrieve emails from a pop3 server and read their header info
(sender, subject, time sent) into variables. Once the header info is read,
the email can be removed from the pop3 server and discarded.
Any help would be greatly appreciated.
Thanks...
--
Posted 'as is'. If there are any spelling and/or grammar mistakes, they
were a direct result of my fingers and brain not being synchronized or my
lack of caffeine.
Mike Brearley Tag: how to query line number? Tag: 167735
FileOpen
Hi@all,
sorry but i'am new at VBS. Ich have make a HTML-Page with VBScript and now i
try to read and write a text file but how,
[script]
Dim TextLine
FileOpen(1, Projektverzeichnis+"Inhalt\Help.htm", OpenMode.Input) ' Open
file for reading.
While Not EOF(1)
TextLine = LineInput(1) ' Read next line.
Debug.WriteLine(Seek(1)) ' Position of next line.
End While
FileClose(1)
[/script]
will not work. Thx for any help,
cya Thommy
Sorry about my English Tag: how to query line number? Tag: 167732
list all objects under mailbox rights for
I was wandering if you could help me with this script....
I need vb script that will list all objects under mailbox rights for
user account and then output them into txt file.
Further on I would like to grant user with send on behalf right for specific
account, if he is missing these rights.
Thanx for any help...
/* Goran */ Tag: how to query line number? Tag: 167729
Need help for writing a vbscript from the Gurus
Hello All,
How can achieve the following:
A = 2
B = 3
C = 25
D = 3
X = 10
I would like to obtain X = 0 by decreasing each A B C D (keeping this
priority). In this example only A B & C will be affected
Thanks for your help Tag: how to query line number? Tag: 167725
ASP scripting compilation error: '80070002'
I am a totally newbie in ASP / VB programming, I would like some help from
you guys if possible.
Below are the steps given which i followed,
Step 1: Create a MFC based .Exe with single file document option.
Step 2: Insert -> Add ATL object -> Select Simple object.
Step 3: Build the .Idl file with 2 dummy fuctions as Add, Dummy.
Step 4: Build the proxy DLL in a saperate project including the files
generated by .idl
Step 5: Register the exe.
Step 6: create object from ASP page.
Step 7: Call the function.
I have just pasted the sample code of my script being used, and the result
obtained when i run the code. Please let me know why Compilation Error :
'80070002' is obtained.
<HTML>
<TITLE>Multiplication</TITLE>
<BODY>
<%
Dim MulResult
Dim MulNum, result
Response.write (" before")
Set MulNum = CreateObject("mfcatl.math.1")
Response.write ("after")
result = MulNum.Add(2,8)
Response.write(result)
%>
</BODY>
</HTML>
RESULT obtained :
before after
Parse error in script
ASP scripting compilation error: '80070002'
Description:
In file: /multi.asp Tag: how to query line number? Tag: 167724
mailbox rights
Anybody who could help...?
I need vb script that will list all objects under mailbox rights for
user account and then output them into txt file.
Thanx for any help...
/* Goran */ Tag: how to query line number? Tag: 167723
Word open doc
I don't know how open document in word
Please help me.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("SELECT * FROM __InstanceCreationEvent WITHIN 3 WHERE " _
& "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _
& "TargetInstance.GroupComponent= " _
& "'Win32_Directory.Name=""c:\\\\test""'")
Do
Set objLatestEvent = colMonitoredEvents.NextEvent
Wscript.Echo objLatestEvent.TargetInstance.PartComponent
'sCommand = "C:\Program Files\Microsoft Office\Office10\winword.exe"
Loop Tag: how to query line number? Tag: 167722
script to send ndr
I need to write a script that will check a catch-all mailbox (pop3) and send
a non delivery report back to the sender of the email.
Background info:
I have a domain hosted on a site that offers unlimited email accounts...
the problem is, emails sent to an invalid address on the domain aren't
automatically returned as non-deliverable. I am, however, able to set up a
catch-all address and able to pick up those emails. Id like to set up a
script that checks that account and generates an appropriate ndr that looks
like the following:
Your message
To: email@domain.com
Subject: test non delivery
Sent: Sun, 2 Jan 2005 20:42:39 -0500
did not reach the following recipient(s):
email@domain.com on Sun, 2 Jan 2005 20:42:39 -0500
The e-mail account does not exist at the organization this message
was sent to. Check the e-mail address, or contact the recipient
directly to find out the correct address.
<server.domain.com #5.1.1>
And if possible, return the original message as an attachment as a normal
non delivery report would.
--
Posted 'as is'. If there are any spelling and/or grammar mistakes, they
were a direct result of my fingers and brain not being synchronized or my
lack of caffeine.
Mike Brearley Tag: how to query line number? Tag: 167715
Telnet using vbscript (or similar)
Simple question...
Is there a way to telnet into (passing user name and password info)
into a unix computer, and launch a program from within a vbscript?
I was thinking the winsock.dll should be able to provide connection
functionality but I can't find any information regarding the use of
the dll with vbscript.
I'm trying to stay away from using Visual Basic or writting my own C++
project.
Any help is greatly appreciated.
-
Coach Tag: how to query line number? Tag: 167713
How to Return Filename in particular folder
I have a folder (C:\Origin) that has 3 Files (test1.xml, test2.pdf,
test3.sch) The name of the xml file will change daily as the primary
app writes it.
I need to capture the name of the .xml file, rename it, Move it to
C:\Archive (with it's new name)
The rest of the script that actually process the xml file I already
have.
There will only be 1 xml file in C:\Origin (with a random name)
Thanks
Dale Tag: how to query line number? Tag: 167711
empty cookies and temporary internet folders
Hello,
is it possible to delete the cookies folder and the IE cache folder within a
script??
thnx,
Marco J.L. Tag: how to query line number? Tag: 167710
create an administrative share on c$ via script?
Is it possible to create an administrative share on c$ via (or wmi)? I
dont really think I understand if theres a difference between a
"regular share" and an "administrative share" so maybe I am over
thinking this. Tag: how to query line number? Tag: 167708
shortcut-extended
there is scripting object "shortcut", but it mainly manages target, name,
path etc ...
is it possible to manage *every* item appearing on shortcut's sheet with
vbscript, like gui does?
i am specialy interested on setting "close on exit" for dos prompts
shortcuts. Tag: how to query line number? Tag: 167706
how to create a folder based on login
In an workgroup environment i must create a script that gets the name of
each client local machine and then it should create a folder with that
machine name in the server. If already exists the folder for ie "xpto" the
script shouldn't do nothing.
Another doubt remains once i'm working in an workgroup environment should i
put this script running through a schedule task or by service?... If the
second choice is better how can I do that?
Ricky Tag: how to query line number? Tag: 167695
rename multiple computer accounts with csv file
Hello ..
We have to change all our 200 clients to a new domain.. therfore we
have some scripts... thats ok ..but we have to change all computer
names, too.
I habe found a really good script to change a single computer account
with vbs
http://cwashington.netreach.net/depo/view.asp?Index=990&ScriptType=vbscript
it works with a Inputbox
but i would like to have a script which reads the old computername in
the first column of a .csv file and takes the new computername from
the same row but the second column.
But my script-experience isn't high enough..
I think that some other admins have similar scenarios..to manage it.
I have found this script/function to parse a line from a csv and
return a value based on the field id
http://cwashington.netreach.net/depo/view.asp?Index=958&ScriptType=vbscript
but I don't get it work together..
I hope anyone can help me
all my searches at google and groups comes to nothing
sorry for my bad english.. I'm from germany ;-)
Happy New Year 2005
Here are the scripts
-------------------------------------------------------------------------------
Dim RegKeyCompName, RegKeyTCPIP, WSHShell, ComputerName, HostName,
DomainName, FQDN, ADRootDSE, ADSysInfo, ADComputerName, ADRenameOK,
ADRNewName, vStartRenameCA, NewNAmeU, NewNameL, vStartRenameAD
On Error Resume Next
'###### READ IN EXISTING COMPUTERNAME AND FQDN ######
RegKeyCompName = "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\"
RegKeyTCPIP = "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\"
Set WSHShell = CreateObject("WScript.Shell")
ComputerName = WSHShell.RegRead (RegKeyCompName &
"ComputerName\ComputerName")
Hostname = WSHShell.RegRead (RegKeyTCPIP & "Hostname")
DomainName = WSHShell.RegRead (RegKeyTCPIP & "Domain")
FQDN = HostName & "." & DomainName
Set ADRootDSE = GetObject("LDAP://RootDSE")
If Err.Number <> 0 then
ADComputerName = "Unable to determine this information"
ADOU = "Unable to determine this information"
ADRenameOK = "0"
else
Set ADSysInfo = CreateObject("ADSystemInfo")
ADComputerName = ADSysInfo.ComputerName 'Get DN of
local computer
ADRenameOK = "1"
ADOU = Mid(ADComputerName, InStr(ADComputerName, "=") + 1)
'Strip off just after the first = sign
ADOU = Mid(ADOU, InStr(ADOU, "=") - 2) 'Strip off
at 2 before the second = sign
ComputerPath = "LDAP://" & ADComputerName
OUPath = "LDAP://" & ADOU
End if
'###### ASK USER FOR NEW DETAILS ###########
MsgBox "This script renames this computer and its active directory
account" & vbCr & vbCr & "Name: " & ComputerName & vbCr & "FQDN: " &
FQDN & vbCr & vbCr & "AD DN: " & ADComputerName & vbCr & "AD OU: " &
ADOU, 0, "Information"
NewName = InputBox("Enter the new computer name below and click OK to
continue","Rename: Step 1")
NewNameU = UCase(NewName)
NewNameL = LCase(NewName)
NewNameUCN = "CN=" & NewNameU
if NewName = "" then
wscript.echo "The computer name has not been changed"
else
vStartRenameCA = MsgBox ("Continue and rename computer to: " &
NewName,vbYesNo or vbExclamation,"Rename: Step 2")
if vStartRenameCA = 6 then
With WSHShell
.RegDelete RegKeyTCPIP & "Hostname"
.RegDelete RegKeyTCPIP & "NV Hostname"
.RegWrite RegKeyCompName & "ComputerName\ComputerName",
NewNameU
.RegWrite RegKeyCompName &
"ActiveComputerName\ComputerName", NewNameU
.RegWrite RegKeyTCPIP & "Hostname", NewNameL
.RegWrite RegKeyTCPIP & "NV Hostname", NewNameL
End With
wscript.echo "The computer name and FQDN have been changed"
elseif vStartRenameCA = 7 then
wscript.echo "The computer name and FQDN have NOT been
changed"
end if
if ADRenameOK = 1 then
vStartRenameAD = MsgBox ("Continue and rename AD Account to: "
& NewName,vbYesNo or vbExclamation,"Rename: Step 3")
if vStartRenameAD = 6 then
Set objItem = GetObject(ComputerPath)
objItem.Put "dNSHostName", NewNameL & DomainName
objItem.SetInfo
objItem.Put "displayName", "DESKTOP_" & NewNameU & "$"
objItem.SetInfo
objItem.Put "sAMAccountName", NewNameU & "$"
objItem.SetInfo
Set objNewOU = GetObject(OUPath)
Set objMoveComputer = objNewOU.MoveHere _
(ComputerPath, NewNameUCN)
wscript.echo "The active directory computer account has
been changed"
elseif vStartRenameAD = 7 then
wscript.echo "The computer account in AD has NOT been
changed"
End If
else
wscript.echo "Insufficient information to rename AD account"
End If
End if
------------------------------------------------------------------------
----------------------------------------------------------------------------
' Sample Usage --
TestString = "Phyisical, Data, Network, Transport, Application,
Session, Presentation"
'FYI - First data field is id=0
WScript.Echo CSV_Results(TestString, 2)
'Echoes "Network"
WScript.Echo CSV_Results(Teststring, 6)
'Echoes "Presentation"
'------
Private Function CSV_Results(csvstring, fieldID)
i = 0
Comma = Array(i)
result = Array(i)
Comma(i) = InStr(1, csvstring, ",")
result(i) = Left(csvstring, Comma(i)-1)
If InStr(1, result(i), CHR(34)) <> 0 Then
Qpos1 = InStr(1, csvstring, CHR(34))
Qpos2 = InStr(Qpos1 +1 , csvstring, CHR(34))
Comma(i) = InStr(Qpos2 +1, csvstring, ",")
result(i) = Mid(csvstring, Qpos1+1, Qpos2-Qpos1-1)
End If
Do While Comma(i) <> 0
i = i + 1
ReDim Preserve Comma(i)
ReDim Preserve result(i)
Comma(i) = InStr(Comma(i-1)+1, csvstring, ",")
If Comma(i) <> 0 Then
result(i) = Mid(csvstring, Comma(i-1)+1, Comma(i) -
Comma(i-1) -1 )
If InStr(1, result(i), CHR(34)) <> 0 Then
Qpos1 = InStr(Comma(i-1), csvstring, CHR(34))
Qpos2 = InStr(Qpos1 +1 , csvstring, CHR(34))
Comma(i) = InStr(Qpos2 +1, csvstring, ",")
result(i) = Mid(csvstring, Qpos1+1, Qpos2-Qpos1-1)
End If
End If
Loop
strLength = Len(csvstring)
result(i) = Right(csvstring, strLength - Comma(i-1))
If InStr(1, result(i), CHR(34)) <> 0 Then
result(i) = Replace(result(i), CHR(34), "")
End If
CSV_Results = result(FieldID)
End Function
------------------------------------------------------------------------- Tag: how to query line number? Tag: 167693
Need Loop with Timer Assistance
I don't code in VB script much; thus, here's my question....
I need the following script to loop until the {Spacebar} key is pressed;
moreover, the loop needs to re-iterate after a two second pause.
====START====
Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.SendKeys "^{z}"
WScript.Quit
====END=====
Thanks in advance,
Todd Tag: how to query line number? Tag: 167692
VBScript to set IE proxies
Hi,
I have a question that I have no idea where to even begin researching. I
want to write a vbscript, 2 of them actually. One script should set up a
hardcoded set of proxies for IE to use and the other should clear all proxy
lists that IE uses.
I'm sure its a rather simple thing to do, but I don't know where WinXP
stores this information. I assume it is an registry setting.
Thanks, Brett Tag: how to query line number? Tag: 167680
Run code based on subnet
I'm pretty much just starting out with vbscript and I'm a long ways from
knowing how to do something like this myself.
In short, I need a script that copies files from a network share to a folder
on the local drive based on where they are at in our agency (location).
Since each seperate location is its own network (ie: 192.168.1.0,
192.168.2.0, 192.168.3.0, ect), I need the user, when they log in, depending
on what building they are at, to transfer files from a server located at
that building to their local hard drive.
We have a sql server located at one complex and all the other buildings
connectec via T1s. Every now and then our 3rd party developers will log into
our SQL server and update software libraries then force all the clients in
the network to update those libraries. When all the employess in the agency
come to work the next morning and all log into our database software, they
all start pulling those new libraries over at the same time. These aren't
small files and when everyone is doing it, it takes up to a half hour or
even fails because it's too much bandwidth for the T1s to handle. One way I
temporarily fixed this was to copy the files onto a server located at each
facility. Then, I made a link on the internal website with a label for each
building. We would tell people to go to the internal website and click on
the link that represents where they are. This would run the batch file wich
was written to copy the updated software libraries from a local (on the same
subnet) server to their harddrive instead of having them auto-download them
from over the T1s.
We've aleady told our 3rd party developer not to force the downloads
anymore. But, we need to find a way to force the downloads ourselves so the
employess don't have to go to the internal website and click on the
appropriate link. I was hoping there would be a way in a longon vbscript
(domain logon) that would cause the user to transfer the libraries from the
local server to their harddrive based on what location they are at.
Sorry this was so much reading but I wanted to make it as clear as possible.
Thanks,
Jim Tag: how to query line number? Tag: 167672
Detecting Battery Mode programatically
Is there a way to detect weather my laptop is using the battery or
power-cable programatically in Windows Script? I have an IBM ThinkPad
A30 with Windows 2000 SP3 with a background service that takes up a
large processing power when activated. If possible, I'd like to
shut-down this service automatically whenever I un-plug the laptop,
then start it back up again when I plug it back in.
I have search the forum for solution and try to use WMI win32_battery
to get information on my Windows XP Pro, but it seems not work, for
the properitiers of "BatteryStatus", it just return "1 - Other" when
my notebook is using battery and return "2 - unknow" when I attach
power cable to my notebook, but it should return "charging" or "using
battery".
Why I want to get information of power status ? I want to
automatically install windows xp sp2 patch for all my office desktop
and notebook sliently , but it seems not work on notebook when it's
using battery power.
Is somebody can help me ? Thanks in advance.
Motor. Tag: how to query line number? Tag: 167662
Current logged on user and session time.
How can I use vbs to remotely (or locally) determine what username is
currently logged in at the desktop of a workstation and also how long that
username has been logged in? I don't need the code necessarily, just a place
to look.
Thanks Tag: how to query line number? Tag: 167659
determine current directory script is executing in?
Hi all. I have a script thats going to connect to a remote machine and
copy files back to the local (executing) machine. Problem is, I need to
get the scripts copied back to whatever directory the script is running
in (it will be distributed to folks and thay can put it where they want
it) and so need to determine that relative location so I can pass it in
as the copy to path.
Can someone help? Tag: how to query line number? Tag: 167658
ftp - vbnet
Could anyone send me the code haow can I ftp a couple of files into server
Windows 2003 server with normal FTP service as a integral part of IIS 6.0
(with or without of anonymous access)
regards
D.T. Tag: how to query line number? Tag: 167656
Vbscript help needed!
hi.
i need a bit of help here.. what i am trying to do is a pretty easy
thing to do (or would be for someone who understands vbscript)
i have some syslog messages from a cisco pix that i need to parse into
relavant information.
i have this so far which gives me the eventid, but i need to get out
the source and destination ip's and ports.
if anyone can help, i'd much apreciate it!
thanks in advance,
Rob
here is the script as it is:
Function Main()
' Set the return value to OK
Main = "OK"
' By default, skip to the next rule, don't take the actions that
follow
' If we exit the function before we get to the end, the default 'skip
to next rule'
' will be used.
Fields.ActionQuit = 100
' Example of a PIX message
' %PIX-4-209004: Invalid IP fragment...
' %PIX-3-106011: Deny inbound (No xlate) udp src
outside:192.168.40.15/138 dst outside:192.168.40.255/138
' %PIX-3-305005: No translation group found for tcp src
inside:192.168.200.157/2635 dst outside:195.44.45.243/25
' %PIX-2-106016: Deny IP spoof from (127.0.0.1) to 212.85.6.13 on
interface outside
Dim M ' Message
Dim E ' Explanation
Dim A ' Action
' Copy message to local variable for speed
M = Fields.VarCleanMessageText
' If message length is too short, exit function
If Len(M) < 15 then exit function
' Grab the first 15 chrs
M = Left(M,15)
' Check the message is a valid PIX message
If Mid(M,1,5) <> "%PIX-" then exit function
' Add any additional checks you want to perform here
E = ""
' Grab the important part ("4-209004")
E = Mid(M,8,6)
A = ""
' Exit if we don't have any values to pass
' If len() = 0 then exit function
' If len(A) = 0 then exit function
' Pass the Explanation and Action to take to the custom variables
Fields.VarCustom01 = E
' Use the 2 custom variables in a "Log to ODBC database" action
' or the custom fields can be passed into a "Send e-mail" action as
the message body.
' Since we have a valid match, we want to execute the send e-mail
action which follows.
' Setting ActionQuit to 0 means we won't skip any actions.
Fields.ActionQuit = 0
End function Tag: how to query line number? Tag: 167654
how to read XML?
Hello Group,
I need to write a script that read xml that describes process and services
that shold run and to check them
the part that check the service or process i know how by using WMI but the
part missing is the how i read the xml .
Thanks Tag: how to query line number? Tag: 167649
Not working why??
I have win xp prof This script print Error 3 line 5 mark.
Whay??
Set colOperatingSystems = GetObject_
("winmgmts:{(Shutdown)}").ExecQuery("Select * from
Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
ObjOperatingSystem.Win32Shutdown(1)
Next Tag: how to query line number? Tag: 167647
Increments by 10, 20, 30 ....
Hi All,
I need a function that only allows Increments by 10, 20, 30.....
How do I achieve this in VB Script?
Any help is appreciated.
TIA,
--
Santosh Tag: how to query line number? Tag: 167645
Permission denied shutdown script
I have written my first script and am having trouble with it. It is
supposed to copy a folder on the local drive to a network so that it
can be backed-up.
dim myDate
myDate = DatePart("y", myDate)
Set fso = CreateObject("Scripting.FileSystemObject")
dim fromFile
fromFile = "C:\Documents and Settings\lars\Application
Data\Opera\Opera 8 Beta\*"
dim toFile
toFile = "\\server\Data\My Documents\lars\Bookmarks\Opera\Backup" &
myDate
Set f = fso.CreateFolder(toFile)
fso.CopyFolder fromFile, f.path , true
When I execute this, "cscript cp.vbs", it works fine, copying the data
to the server.
I then placed the above script in
C:\WINDOWS\system32\GroupPolicy\Machine\Scripts\Shutdown, and, using
gpedit.msc, gone to the Local Computer Policy\Computer
Configuration\Windows Settings\Scripts(Startup/Shutdown), selected
Shutdown, and added this script to the Shutdown Scripts for Local
Computer.
When the system shuts down, I get a Permission Denied error
'800a0046'. What am I missing here?
Thanks, Lars Tag: how to query line number? Tag: 167643
How to select multiple items from a list box on an ASP page
Hi there,
I got a simple list box on an ASP page. I tried to select multiple items
and use the item values to do something.
I was able to get the item values. However, I got the following error from
IE's Error on page. I have attached my VBScript below. Any idea why?
<SCRIPT language ="vbscript">
sub Launch_OnClick
dim i
For i = 0 To document.Myform.Mylist.size
msgbox document.Myform.MyList.item(i).value
Next
End Sub
ERROR
Line: 98
Char: 8
Error: Object required: 'document.Myform.Mylist.item(...)'
Code: 0
URL: ..... Tag: how to query line number? Tag: 167641
Expiration Date
Is there a way to enumerate all user accounts in the domain that will expire
on or after Dec, 31st 2004? Tag: how to query line number? Tag: 167640
Using the ChilKatFTP dll with VBScript
I'm still fairly new to VBScript (and WMI, and WSH) but I'm getting
better. What I'm trying to do though is have my script handle FTP
commands on it's own (instead of having the shell run the ftp
-s:command.txt stuff)... I'm trying to use the chilkatftp dll (free
use). Any help would be appreciated. Thanks!
http://www.chilkatsoft.com/chilkatFtp.asp Tag: how to query line number? Tag: 167629
Rename...
I'd like to rename the local administrator account to something like
LocalAdmin on all workstations (about 200 pcs) in our domain. Would anyone
provide vbscript codings on the matter? Appreciate for the help.
Fan Tag: how to query line number? Tag: 167625
Communicating Between VB6 and a HTML Document
I had a need to manipulate the activities of a webpage hosted by the
WebBrowser control from within a Visual Basic project. The requirement was
that VB must be able to communicate with VBScript, and vice versa. This is
how I accomplished the task.
I created a new Visual Basic project and placed the WebBrowser control on
its default form. I initially set that control properties with a name of
WebBrowser1, and as not visible. I placed a command button on top of the
WebBrowser1 control, right-clicked it and sent it to the front and then
right-clicked the WebBrowser1 control and sent it to the back. I set the
form properties to not display a menu bar.
I set the click event handler for the command button to end the program. In
the form unload event is where I destroyed all objects before the VB program
would end.
This code would set the form to entirely fill a 1024x768 screen:
Me.Move 0, 0
Me.Width = 15360: Me.Height = 11520
Me.Visible = True
This code would then initialize that control for full screen and no taskbar
or menus:
WebBrowser1.Left = 10: WebBrowser1.Top = 10
WebBrowser1.Height = Me.Height - 20: WebBrowser1.Width = Me.Width - 20
WebBrowser1.AddressBar = False
WebBrowser1.MenuBar = False
WebBrowser1.StatusBar = False
WebBrowser1.FullScreen = True
WebBrowser1.TheaterMode = True
WebBrowser1.GoHome
WebBrowser1.Visible = True
I defined a global variable named PageReady. Then this code in
WebBrowser1.DocumentComplete:
PageReady = True
Then I created Sub MyTest() and placed this code into it:
WebBrowser1.Navigate MyPath & "Page1.html" 'MyPath is previously defined
PageReady = False
While PageReady = False: DoEvents: DoEvents: DoEvents: Wend 'Page loaded
'Set the text value in the page control named txtWebBrowser!
WebBrowser1.Document.All.Item("txtWebBrowser").Value = "Message from VB6
Code!"
'Get the text value in the page control named txtWebBrowser!
'MsgBox WebBrowser1.Document.All.Item("txtWebBrowser").Value
----------------
That completes the VB part. I then created a webpage called Page1.html,
existing in the MyPath that was specified in the above VB code. The page had
this code:
<HTML>
<HEAD>
<TITLE>Communications Test</TITLE>
<SCRIPT Language="VBScript">
OPTION EXPLICIT
SUB PageLoaded()
txtWebBrowser.Value="READY"
END SUB
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#000000" TEXT="#FFFFFF" LINK="#00FFFF"
VLINK="#FF0000" ALINK="#FF00FF" SCROLL="NO"
ONLOAD="PageLoaded()">
<BASEFONT SIZE=4>
<FONT SIZE=4 FACE="ARIAL">
<CENTER><H1>Theme 1 Page</H1></CENTER>
<TEXTAREA NAME="txtWebBrowser"ROWS=1 COLS=50
style="visibility:visible;position:absolute;top:200;left:40;">
Default Text</TEXTAREA>
</FONT>
</BODY>
</HTML>
----------------------
Launching the webpage by itself will cause the textbox text, initially set
to "Default Text", to be changed to "READY" after the page has loaded.
Launching the page via running the VB project will cause the webpage textbox
text to be changed to "Message from VB6 Code!". I commented out the VB code
that will obtain that textbox content.
This methodology lets code in the webpage communicate back and forth with VB
code via the webpage textbox. This allows synchronizing of code in both of
the applications. I've shown the basic way of providing cross communications
between the applications, but I'll leave it up to others to do something
with it! Maybe someone else will write a complete tutorial and project for
others, rather than just a general explanation as I've done here.
Winguy Tag: how to query line number? Tag: 167616
Remote Cacls
Is there a way to change NTFS permissions on a remote server through a
script. For example from Computer1 can I execute a script that will add
Server1\Group1 to \\Server1\d$\Data with change access. I know I can use
Cacls.exe and give a "domain" user or a "Domain" group permission to a remote
server, but following Microsoft standards they say I should only apply
permissions to Local Groups
Thanks again. I found this site today and I have a few questions that I
have been searching for answers to for a long time.
--
Thanks for the help!
Brian Tag: how to query line number? Tag: 167614
allowing line breaks in memo fields
I'm not sure whether this question strictly speaking belongs to this
group, but since a lot of you guys/gals out there are probably using
ASP in connection with a database, here goes:
As a relative newbie, I have discovered that a memo-type field in my
access database does not accept (or simply ignores any attempt to)
create line breaks.
At least that's what seems to be the case when I created an standard
form containing a text area field linked to an access database.
When displayed, I would like the text to appear with a line break, for
example:
"This is line one.
This is line two."
However, even if insert that line break in the above-mentioned form,
the text appears like this:
"This is line one. This is line two."
Where do I have to make provisions in order to display the line break?
In the form page?
In the display page?
In the access field property?
Or all of the above?
I use pretty basic ASP/VBS for my pages. Below you can see examples of
what would be the form page and and display page related to this
question.
Thanks in advance
TB
-- beginning of form page add.asp: -----
<%
Set Conn = Server.CreateObject("Adodb.Connection")
Dim DSN1
DSN1="Provider=MSDASQL;"
DSN1=DSN1& "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN1=DSN1& "DBQ=C:\web\test.mdb;"
Conn.open DSN1
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
Set RS = Server.CreateObject("ADODB.Recordset")
RS.open "Select * From testtable Where 1 = 2;", Conn, 1, 3
RS.AddNew
RS("Text") = Request.Form("Text")
RS.Update
RS.Close
Conn.Close
Set RS = Nothing
Set Conn = Nothing
Response.Write ("text added.")%>
<a href="list.asp">return</a>
<%Else%>
<Form Method="Post" Action="add.asp">
<textarea rows="3" name="Text" cols="35"></textarea><br>
<input Type="submit" Value="add" name="Submit">
</form>
<%End If%>
-- End of form page add.asp: -----
-- beginning of display page list.asp: -----
<%
Set Conn = Server.CreateObject("Adodb.Connection")
Dim DSN1
DSN1="Provider=MSDASQL;"
DSN1=DSN1& "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN1=DSN1& "DBQ=C:\web\test.mdb;"
Conn.open DSN1
msql = "SELECT * FROM articulos"
Set RS=Conn.Execute(msql)
Do While Not RS.EOF
response.write "text: " & RS("Text") &"<br>"
RS.MoveNext
Loop
RS.Close
Conn.Close
Set RS = Nothing
Set Conn = Nothing
%>
-- End of display page list.asp: ----- Tag: how to query line number? Tag: 167610
LogonScript Suggustion
Currently I am using KixStart95 to write my logon scripts. Right now I
basically say If inGroup "XXXX" then map to \\SERVER\Share
If inGroup "XXXX" then map to \\SERVER2\Share3
over and over until I've checked all the possible groups a person could be a
member of.
I am getting ready to deploy file servers to 150 remote locations connected
over 256K Frame Relay and about 8000 users total. All of our DC's are
located back at central office where the 256K connections funnel to. At
least starting out each user will have only one Group drive which will be on
their file server located in their building. Just wondering if anyone had a
better way to map these drives without having to have 150-500 If Ingroup
lines. I would also like to use as few logon scripts as possible. Obviously
one solution would be to give everyone their own script which would provide
fast logon but too much maintenance.
Any suggestions would be appreciated.
--
Thanks for the help!
Brian Tag: how to query line number? Tag: 167605
Validating a Group Exists
I have the following code to Create a local group. I was wondering if there
is a way to see if the group already exists before I try to create it.
Currently if a group already exists my script errors out, is there a way to
allow the script to continue working in the event that a preexisting group is
encountered?
strComputer = "REQtestXP1"
Set colAccounts = GetObject("WinNT://" & strComputer & "")
Set objUser = colAccounts.Create("group", "FSD")
objUser.SetInfo
--
Thanks for the help!
Brian Tag: how to query line number? Tag: 167604
Need Help with this code!...
Hi!
Ive got this code that open a simple aspx page :
Set oIE = createobject("internetexplorer.application")
oIE.navigate "http://www.somepage.com/page.aspx"
oIE.Visible = True
Do until oIE.readystate=4
sSleep 1
Loop
Some of the page contents have this code:
<td class="celula" align="Center"><input type="submit"
name="dtgAdicao:_ctl25:_ctl0" value="" /></td>
<td class="celula" align="Center"><input type="submit"
name="dtgAdicao:_ctl26:_ctl0" value="" /></td>
<td class="celula" align="Center"><input type="submit"
name="dtgAdicao:_ctl27:_ctl0" value="" /></td>
Can you see see sequence in the "name" attribute (dtgAdicao:_ctl25:_ctl0,
dtgAdicao:_ctl26:_ctl0)...
Well, the question is: how can i FOCUS over one of these elements???....
I try this:
oIE.Document.all.dtgAdicao:_ctl27:_ctl0.focus
but oviously Ive got an error because the name of the element its conaints
illegal caracters...
Witch way can i use to focus or read de "name" tag of this elements???
Thanxs a lot!
Gabriel. Tag: how to query line number? Tag: 167596
VBS Server monitor needed.
New to scripting.
Need Script that monitors servers and sends e-mail when they go down
(and if possible, when it comes back up.)
Also if anyone has any good script repository sites.
Thanks,
Ian Lilkendey Tag: how to query line number? Tag: 167594
Anti-virus help?!
I want to write a vbscript which retrieves the current dat-version (and
engine version) of different anti-virus programs. Well, I've done this for
McAfee, which was very easy.
Does anyone know how to retrieve such information from E-Trust (CA) and
Symantec anti-virus? It seems the registry keys are encrypted and can't find
any information from CA or Symantec about this subject.
Greetings,
Hans
http://fots.nl Tag: how to query line number? Tag: 167590
Missing file extension?
We have a VBScript that runs fine from the command line,
but when run through CronW, it hangs.
While debugging, we had the script print names of the
various files it uses. (fileobject.Name)
When running from the command line, it will print
complete filenames, "somepath\filename.ext",
but when running through cronw, we only get
"somepath\filename" without the extension.
Anyone know any reason it should be like that?
All hints appreciated.
Cheers,
Anders :) Tag: how to query line number? Tag: 167589
blank character
Hi,
How do I create a 'blank character' on a web page?
I have a table and I need a blank cell. If I create a cell with no entry,
the cell doesn't appear in the table.
I remember there was some sequence of keys to create the blank character
that started with an ambersand. Does anyone know what it is?
Thanks,
Guy Tag: how to query line number? Tag: 167586
arguments to script
Hi there,
I have created script which use the following to find out the arguments
passed to it. It works fine if I enter the script name and arguments in
a DOS prompt.
But if I run the same script with the same arguments in window scheduler,
it will only take the default value, i.e. vDatabase='TEST'; ignoring the
arguments I passed in the command.
Please advise what I should do.
Thanks.
JW.
************
Set objArgs=WScript.Arguments
if objArgs.count > 0 then
vDatabase=objArgs(0)
else
vDatabase="TEST"
end if Tag: how to query line number? Tag: 167585
is it possible to query the currently executing line number somehow?