Vbscript Ping
How can I ping an IP address to get a return code (if the IP address
responds) to continue to some other function?
eg. If Ping=1 (ie alive) then do this else don't do this!
Had a look through the internet and can't seem to find anything. Don't mind
installing DLL if there is anything out there....
Thanks
DG Tag: Combo box is always on top of everything! Tag: 147074
pivot html image?
Is there a way to show a dynamically loaded image
rotated/pivoted 90 degrees from the way it's saved?
Here is an example of my code:
<p><img border="0" src="/Cert/<%Response.Write
Request.QueryString("Stock No")%>.GIF"width="671"
height="535" ></p>
The gif image is oriented up and down, but I want to show
the image in my html/vbscript page pivoted 90 degrees, so
it can be printed properly.
There are thousands of the images for items in a database,
so changing the original gif isn't an option.
Or, is there a way to print the image in landscape,
instead of portrait?
thanks,
Eric Tag: Combo box is always on top of everything! Tag: 147068
Need Urgent Help for a VBScript Function
I have a string in one variable. With that string content,
there is an object in the Web page. I want to refer that
object using this variable..
eg:-
p="Checkbox1"
Now want to check that checkbox using variable p
ie. instead of writing
Checkbox1.checked=true
I want to write it using variable p...
Please help me... Tag: Combo box is always on top of everything! Tag: 147053
Detecting OS correctly
Hello,
Can anybody tell me of an accurate way to determine the
OS name and version (and also service pack level if poss)
of machines running the following (all versions):
Win95, Win98, NT4, Windows 2000, Windows XP
I obviously can't use WMI as Win95 and 98 (and I think
NT4) don't come with it... I need to stick to what I know
is installed and that pretty much just leaves VBScript.
I have seen many ways of achieving this on the web but
they all seem to target particular OS versions... I need
to cover them all...
Any suggestions?
Regards Tag: Combo box is always on top of everything! Tag: 147047
Client Side odbc connection?
Hello, is it possible to create and use an odbc
connection on the client side? If so, what is the code
to do so?
Thanks,
Sean Tag: Combo box is always on top of everything! Tag: 147042
Script to extract driver information from .inf files
Hi Gang,
Similar to my last post, I'm trying to get a script to extract driver
version, name and other information from all .inf files in a given
directory. I've hacked at an excellent script I found on the
cwashington website. The problem I get is a subscript out of range
error... the line that gets the error is:
dverpos = Instr(4, Inffile(1), "Driverver", 1)
and here is the script:
' GetVer.VBS
' Example: CScript.EXE GetVer.VBS /f:"C:\Documents and
Settings\Administrator\local settings" /r:c:\test.txt
'Option Explicit
'On error resume next
Dim objArgs: Set objArgs = WScript.Arguments
Dim objFSo: Set objFSo =
CreateObject("Scripting.FileSystemObject")
Dim sHelpString, sRootFolder, sReport, sReportName
sHelpString = "GETVER.VBS - Tool to list all files that have a version
number in" & vbcrlf _
& "a specified folder and its subfolders" & vbcrlf & vbcrlf
_
& "/F:<path> - Specify the root folder to gather the
information" & VbCRLf _
& "/R:<path> - Specify the file to produce the output to. It
will" & vbCRLf _
& " overwrite the file if it already exists"
If objArgs.Count = 0 Then Wscript.Echo sHelpString: Wscript.Quit
If objArgs(0) = "/?" Then Wscript.Echo sHelpString: Wscript.Quit
Dim I
For I = 0 to objArgs.Count - 1
If UCase(Left(objArgs(I),3)) = "/F:" Then sRootFolder =
Trim(Mid(objArgs(I),4))
If UCase(Left(objArgs(I),3)) = "/R:" Then sReportName =
Trim(Mid(objArgs(I),4))
Next
Set sReport = objFSo.CreateTextFile(sReportName, True)
RecurseFldr (sRootFolder)
Sub RecurseFldr(sFolderName)
Dim oFolder, cFolder, cFile, sUnit, sVer
If not objFSo.FolderExists(sFolderName) Then
Wscript.Echo "Error: " & chr(34) & sFolderName & chr(34) & " does
not exist or is no longer available"
Wscript.Quit
End If
Set oFolder = objFSo.GetFolder(sFolderName)
Set cFolder = oFolder.Subfolders
Set cFile = oFolder.Files
'Stack this procedure for every folder in the collection
For Each sUnit In cFolder
' sReport.WriteLine "Folder - " & sUnit
RecurseFldr(sUnit)
Next
'Then process each file in the current folder
For Each sUnit In cFile
If Right(sUnit.Path, 3) = "inf" then
dverpos = 0
devdescpos = 0
Set i = objfso.OpenTextFile(sUnit.Path, 1)
ReadAllTextFile = i.ReadAll
inffile = Split(Readalltextfile, "[Version]", -1, 1)
sReport.Write vbcrlf & vbcrlf & "Filename: " & sunit.path & vbcrlf
sReport.Write inffile(0)
dverpos = Instr(4, Inffile(1), "Driverver", 1)
if dverpos > 0 then
dver = Mid(Inffile(1), dverpos, 50)
dvers = split(dver, vbcrlf, 1, 1)
sReport.Write vbcrlf & dvers(0)
end if
devdescpos = Instr(4, inffile(1), "DeviceDesc=", 1)
'wscript.echo devdescpos
if devdescpos > 0 then
dver = Mid(Inffile(1), devdescpos, 100)
dvers = split(dver, vbcrlf, 1, 1)
sReport.Write vbcrlf & dvers(0)
End if
devdescpos = Instr(4, inffile(1), "FullProductName=", 1)
if devdescpos > 0 then
dver = Mid(Inffile(1), devdescpos, 100)
dvers = split(dver, vbcrlf, 1, 1)
sReport.Write vbcrlf & dvers(0)
End if
End If
Next
End Sub Tag: Combo box is always on top of everything! Tag: 147032
dos equivallet to copy /d
looking for way to run copy /d in vbs
I am copyinng encrypted files from XP workstationn to NT Domain server and
need to decrypt to save it can be done with a bat file with the copy /d
however I cannot figure out how to do this with a vbs script
Assistance Greatly appreciated
P Creighton Tag: Combo box is always on top of everything! Tag: 147030
Script to report file version, description...
Gday all,
I'm trying to write a script that will go through the entire hard
drive, give me the version number and also extended properties of each
file on the PC, but only for files that will report a version number.
I found an excellent script on cwashington.netreach.net by Voltaire
Toledo that does the version number bit, and I've attempted to modify
it to report things like Description, Author etc. When I run it I get
the following error:
getver.vbs(49, 5) Microsoft VBScript runtime error: Object required:
'objFolder'
I don't quite understand this, as its clearly defined.
Here is the script (with my hacked modifications):
' GetVer.VBS
' Example: CScript.EXE GetVer.VBS /f:"C:\Documents and
Settings\Administrator\local settings" /r:c:\test.txt
'Option Explicit
Dim objArgs: Set objArgs = WScript.Arguments
Dim objFSo: Set objFSo =
CreateObject("Scripting.FileSystemObject")
Dim sHelpString, sRootFolder, sReport, sReportName
sHelpString = "GETVER.VBS - Tool to list all files that have a version
number in" & vbcrlf _
& "a specified folder and its subfolders" & vbcrlf & vbcrlf
_
& "/F:<path> - Specify the root folder to gather the
information" & VbCRLf _
& "/R:<path> - Specify the file to produce the output to. It
will" & vbCRLf _
& " overwrite the file if it already exists"
If objArgs.Count = 0 Then Wscript.Echo sHelpString: Wscript.Quit
If objArgs(0) = "/?" Then Wscript.Echo sHelpString: Wscript.Quit
Dim I
For I = 0 to objArgs.Count - 1
If UCase(Left(objArgs(I),3)) = "/F:" Then sRootFolder =
Trim(Mid(objArgs(I),4))
If UCase(Left(objArgs(I),3)) = "/R:" Then sReportName =
Trim(Mid(objArgs(I),4))
Next
Set sReport = objFSo.CreateTextFile(sReportName, True)
RecurseFldr (sRootFolder)
Sub RecurseFldr(sFolderName)
Dim oFolder, cFolder, cFile, sUnit, sVer
If not objFSo.FolderExists(sFolderName) Then
Wscript.Echo "Error: " & chr(34) & sFolderName & chr(34) & " does
not exist or is no longer available"
Wscript.Quit
End If
Set oFolder = objFSo.GetFolder(sFolderName)
Set cFolder = oFolder.Subfolders
Set cFile = oFolder.Files
'Stack this procedure for every folder in the collection
For Each sUnit In cFolder
' Begin my modifications here :)
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(sUnit)
For i = 0 to 33
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
Next
For Each strFileName in objFolder.Items
For i = 0 to 33
sreport.Writeline arrHeaders(i) _
& ": " & objFolder.GetDetailsOf(strFileName, i)
Next
Next
'End my modifications
RecurseFldr(sUnit)
Next
'Then process each file in the current folder
'For Each sUnit In cFile
' sVer = objFSo.GetFileVersion(sUnit)
' If sVer<>"" Then sReport.WriteLine "File - " & sUnit.Path &
vbTab & "Version - " & sVer
'Next
End Sub
Thanks in advance
Paul Tag: Combo box is always on top of everything! Tag: 147029
Newbie problem--should be easy
I am brand new at this and virtually totally clueless; the terms and =
syntax are a complete mystery; nothing like writing up bat files.. (I'm =
going to get a book on this, but that's going to have to wait until next =
payday at least.)
Meantime I tried to edit a simple script I'd seen done before for =
another purpose which looked like it could be altered to simply copy a =
file or two from here to there. Figured once I got it figured out I'd =
add it into the more complicated vbs script I's working on.
I'm trying to copy and concatenate files.
Figured this looked like it would work. It does not.
Set WSHShell =3D WScript.CreateObject("WScript.Shell")
rcmd =3D "copy /y /b d:\files\text.txt+d:\files\test2.txt =
f:\temp\new.eml"
WshShell.Run(rcmd)
What am I doing wrong? What would work? Tag: Combo box is always on top of everything! Tag: 147027
Copying SID to SIDHistory
Hi all,
I am new to vbscript and I am trying to copy the SID from one
Domain account to the SIDhistory of an account in a different domain.
This is what I was thinking:
Set user = GetObject(LDAP path to user in old domain)
SID = user.Get("objectSid")
WScript.Echo SID
Set NewUser = GetObject(LDAP path to user in new domain)
NewUser.Put "sIDHistory", SID
NewUser.SetInfo
I get an error that says "a constraint violation has occured". Like I
said, I'm a noob so I may be on the wrong path or missing some critical
steps. I would appreciate any help, or if someone has done this, maybe a
clue as to which way to approach this problem.
Thanks,
Rich Tag: Combo box is always on top of everything! Tag: 147026
Tricky Text File
I've combined alot of the things that I've learned from this newsgroup and
created some really cool text manipulating programs. I'd like to thank all
of you that have helped me with my struggles these last few weeks (Chad, Dag
Sunde, Collin, and Michael Harrington - just to name a few). I'm really
amazed how slick these little programs work.
For my next task, I'd like to do something very similar. The difference is
that there can be upto 3 Product lists for each customer.
http://www.swandust.com/IN2.txt is a sample file. I'd like the output
(output.csv) to display something like the following:
CustNum,DelAdd,Stock,Qty,Freq
4,SIR ADAM BECK MANOR,WINTER EXTRA MATS
,240 SYDENHAM ST,3 X 12 BROWN RENTAL MAT ,1,E4W
,"LONDON, ON",4 X 8 GREY RENTAL MAT ,1
,Tel: ( ) -
,,MONTHLY ALL YEAR
,,3 X 5 GREY RENTAL MAT,1,E4W
,,4 X 8 GREY RENTAL MAT,3
37,STUDER'S VARIETY,BI-WEEKLY
,336 JOHN ST S,3 X 8 RED RENTAL MAT,1
,"AYLMER, ON",4 X 6 RED RENTAL MAT,1
,Tel: (519) 773-9016,3 X 5 AIR FLEX MAT,1
40,SCOTIA BANK,SUMMER STOCK MONTHLY
,199 BROADWAY,3 X 8 GREY RENTAL MAT,1,E4W
,"TILLSONBURG, ON", 4 X 6 GREY RENTAL MAT,1
,Tel: (519) 688-6400,4 X 8 GREY RENTAL MAT,1
,,4 X 6 SCOTIABANK LOGO MAT,1
,,BIWEEKLY WINTER STOCK
,,3 X 5 GREY RENTAL MAT,2,E2W
,,3 X 8 GREY RENTAL MAT,2
,,3 X 12 GREY RENTAL MAT,3
,,4 X 6 GREY RENTAL MAT,2
,,4 X 8 GREY RENTAL MAT,1
,,4 X 6 SCOTIABANK LOGO MAT,1
I think the below code is a great start. Running this code converts a UNIX
text file into my desired output (.csv). However, it only converts a file
with one list. I hope that you guys can all help me out with the trickier
output (above). Thanks in advance.
Private Sub Command1_Click()
Dim mystring As String, i As Long
Dim cusnum As String, printtofile As Boolean
Dim address(14) As String * 24, product(14) As String * 8
Dim quan(14) As String * 4, freq As String
Dim description(14) As String * 26
Dim InFile As Integer, OutFile As Integer
Call UNIX_DOS
InFile = FreeFile
Open "c:\temp.txt" For Input As InFile
OutFile = FreeFile
Open "c:\OUT1.csv" For Output As OutFile
Write #OutFile, "Cusnum", "Address", "Product", _
"Description", "Quantity", "Frequency" 'Headings
For i = 0 To 13 'initialize arrays
address(i) = " " '24 spaces
product(i) = " " '8 spaces
description(i) = " " '26 spaces
quan(i) = " " '4 spaces
Next i
Do While Not EOF(InFile)
printtofile = False 'reset
Line Input #InFile, mystring
If InStr(mystring, "Customer Number") > 0 Then
cusnum = Trim$(Mid$(mystring, 23, 6))
End If
If InStr(mystring, "Delivery Address:") > 0 Then
For i = 0 To 4
Line Input #InFile, mystring
address(i) = Trim$(mystring)
Next i
End If
'catch the frequncy input
If InStr(mystring, "=== === === === ====") > 0 Then
Line Input #InFile, mystring
freq = Trim$(Mid$(mystring, 20, 5))
Line Input #InFile, mystring
freq = freq & Trim$(Mid$(mystring, 20, 5))
If freq = "A" Or freq = "B" Or _
freq = "C" Or freq = "D" Then freq = "E4W"
If freq = "AC" Or freq = "BD" Then freq = "E2W"
If freq = "AB" Or freq = "CD" Then freq = "E1W"
End If
If InStr(mystring, "=== ======== ==") > 0 Then
i = 0
Do Until InStr(mystring, "*******") > 0
' ie until we reach Product end
Line Input #InFile, mystring
If Val(Left$(mystring, 11)) > 0 Then
product(i) = Trim$(Mid$(mystring, 11, 8))
description(i) = Trim$(Mid$(mystring, 22, 26))
quan(i) = (Mid$(mystring, 66, 4))
i = i + 1
End If
Loop
printtofile = True
End If
'now write to file
If printtofile = True Then
Write #OutFile, cusnum, address(0), product(0), _
description(0), quan(0), freq
For i = 1 To 13
Write #OutFile, , address(i), product(i), _
description(i), quan(i)
If address(i) = " " _
And product(i) = " " Then Exit For
Next i
For i = 0 To 13 're initialize arrays
address(i) = " "
product(i) = " "
description(i) = " "
quan(i) = " "
Next i
freq = "" 'reset
End If
Loop
Close InFile, OutFile
'remove temp file
Kill ("c:\temp.txt")
Print "DONE!"
End Sub
'convert UNIX text to DOS text
Private Sub UNIX_DOS()
Dim MyUnixFile As String
Dim MyDosFile As String
MyUnixFile = "c:\IN.txt"
MyDosFile = "c:\temp.txt"
Dim S As String
Open MyUnixFile For Binary As #1
S = String(LOF(1), vbNullChar)
Get 1, , S
Close #1
Open MyDosFile For Output As #1
Print #1, Replace(S, vbLf, vbCrLf);
Close #1
End Sub Tag: Combo box is always on top of everything! Tag: 147025
All 'Domain Users" group to local 'Power Users' group
Hello all
I have several hundred workstations that I need to add the 'Domain Users'
group to the local machines 'Power Users' group. I assume the easiest way
to do this is with a group policy and a login script. I found the following
script in a previous posting and tried to modify it for my purposes without
much luck. If someone could tell me if I'm on the right track with this
script and how to modify it, I'd be grateful. I'm running a windows 2k
domain with all windows XP workstations.
Thanks for the help
James
From: "Jim Campau" <Jim_Campau@bausch.com>
On Error Resume Next
prbCount= 0
Dim Computer
Set WshNetwork = WScript.CreateObject("WScript.Network")
strComputerName = WshNetwork.ComputerName
strLocalGroup="Power Users"
strGroupName="TestDomain\Domain Users"
strGroupName=Replace (strGroupName, "\", "/")
Set strGroup= GetObject("WinNT://" & strComputerName & "/" & strLocalGroup)
Set strUser= GetObject("WinNT://" & strGroupName)
strGroup.Add(strUser.AdsPath)
'msgbox strUser.AdsPath
if err.number <> 0 then
prbCount=prbCount+1
msgbox"ERROR - " & strGroupName & " Could not be added to " &
strComputerName & " Error Number: 0x" & Hex(err.number) & " " &
err.description
wscript.quit
end if
msgbox "Done" Tag: Combo box is always on top of everything! Tag: 147023
Microsoft VBScript runtime error: ActiveX component can't create object 'GetObject'
I have written a simple VBscript to find out the free disk space on a
local machine. The script is as follows:
set WMI = GetObject("WinMgmts:")
for each Disk in WMI.InstancesOf("Win32_LogicalDisk")
if Disk.DeviceID = "C:" Then
WScript.Echo "Instance:", Disk.Path_.Relpath , "Free space = " ,
Disk.FreeSpace
end if
next
I saved this script to disk.vbs and i run it using cscript command on
dos window.
cscript disk.vbs
This script runs on some machines perfectly. On some machines it gave
the following error : Microsoft VBScript runtime error: ActiveX
component can't create object 'GetObject'. I searched thru many google
groups and i found that the error might be that "host is missing WMI
capabilities".
I don't know how to enable this functionality. Is it a service which
is stopped on that particular machine? Is this some different error
altogether? Can anyone please help me out on this. I am new to
scripting so i appreciate ur help. Thanks.
Pranav Tag: Combo box is always on top of everything! Tag: 147022
Getting hta "refreshed" from script
I have an hta in which I change some text in a table element to tell the
user what is happening.
After changing the text to "Loading", the script moves onto an xml load and
transform.
The table does not seem to get re-displayed in time and the transform
functions seems to absorb all the resources while it happens (10 seconds).
After the transform, the table is updated again to "Viewing". This is the
first change that is rendered.
If I put a msgbox in front of the load and transform, when the message is
displayed, the table is updated.
If I comment out the load and transform, the table is updated too
Anyone know how I can force the rendering to happen before the transform
"takes over"
TIA
--
Rickety Tag: Combo box is always on top of everything! Tag: 147005
data verticaly
How to read a data from a file where record information
store verticaly into SQL? Tag: Combo box is always on top of everything! Tag: 147003
Last Logon for workstation in an NT DOMAIN
I have a list of computer names that I need to check for
the last date/time the device logged on to the NT Domain.
Please help!
Thanks! Tag: Combo box is always on top of everything! Tag: 146999
Script to import email addressess
Hi,
I had re-modify Richard's script (Thank you and his site
is http://www.rlmueller.net)and I am receiving an error
stating "The server rejected one or more recipient
addressess. The server reponse was: 550 5.1.1
<c:emails.txt>....User UnKnown" Not sure what has gone
wrong. I have a file "Emails.txt" in C:\ drive containing
my user's Email address. See below of the script I re-
modify from Richard.....
Option Explicit
Dim strFileName, strNTName, objShell, lngBiasKey, lngBias,
k
Dim objRootDSE, strDNSDomain, objDomain, objMaxPwdAge,
intMaxPwdAge
Dim objDate, dtmPwdLastSet, lngFlag, blnPwdExpire
Dim lngHighAge, lngLowAge, lngDate, dtmPwdExpires
Dim objConnection, objCommand, objRecordSet
Dim strFilter, strQuery
Dim strEmail, objEmail
Const ADS_UF_PASSWD_CANT_CHANGE = &H40
Const ADS_UF_DONT_EXPIRE_PASSWD = &H10000
' Specify the file of email addresses.
strFileName = "c:\emails.txt"
' Obtain local time zone bias from machine registry.
Set objShell = CreateObject("Wscript.Shell")
lngBiasKey = objShell.RegRead
("HKLM\System\CurrentControlSet\Control\" _
& "TimeZoneInformation\ActiveTimeBias")
If UCase(TypeName(lngBiasKey)) = "LONG" Then
lngBias = lngBiasKey
ElseIf UCase(TypeName(lngBiasKey)) = "VARIANT()" Then
lngBias = 0
For k = 0 To UBound(lngBiasKey)
lngBias = lngBias + (lngBiasKey(k) * 256^k)
Next
End If
' Determine domain maximum password age policy in days.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("DefaultNamingContext")
Set objDomain = GetObject("LDAP://" & strDNSDomain)
Set objMaxPwdAge = objDomain.MaxPwdAge
' Account for bug in IADslargeInteger property methods.
lngHighage = objMaxPwdAge.HighPart
lngLowAge = objMaxPwdAge.LowPart
If lngLowAge < 0 Then
lngHighAge = lngHighAge + 1
End If
intMaxPwdAge = -((lngHighAge * 2^32) _
+ lngLowAge)/(600000000 * 1440)
' Use ADO to search the domain for all users.
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOOBject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
' Filter to retrieve all user objects.
strFilter = "(&(objectCategory=person)(objectClass=user))"
strQuery = "<LDAP://" & strDNSDomain & ">;" & strFilter _
& ";sAMAccountName,pwdLastSet,userAccountControl,mail;subtr
ee"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 100
objCommand.Properties("Timeout") = 30
objCommand.Properties("Cache Results") = False
' Enumerate all users. For users whose password can expire,
' determine when the password expires.
Set objRecordSet = objCommand.Execute
Do Until objRecordSet.EOF
strNTName = objRecordSet.Fields("sAMAccountName")
lngFlag = objRecordSet.Fields("userAccountControl")
blnPwdExpire = True
If (lngFlag And ADS_UF_PASSWD_CANT_CHANGE) <> 0 Then
blnPwdExpire = False
End If
If (lngFlag And ADS_UF_DONT_EXPIRE_PASSWD) <> 0 Then
blnPwdExpire = False
End If
' Only continue if the password can expire.
If blnPwdExpire = True Then
' Determine when password last set.
lngDate = objRecordSet.Fields("pwdLastSet")
Set objDate = lngDate
dtmPwdLastSet = Integer8Date(objDate, lngBias)
' Continue only if password was ever set.
If dtmPwdLastSet > #1/1/1601# Then
' Determine when the password expires.
dtmPwdExpires = DateAdd("d", intMaxPwdAge,
dtmPwdLastSet)
' Determine if password expires within the next 10
days.
If dtmPwdExpires < DateAdd("d", 10, Now) Then
If dtmPwdExpires < Now Then
' Password already expired.
Else
' Password expires in the next 10 days.
strEmail = strFileName
If strEmail <> "" Then
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "icmpbell@yaoo.com
objEmail.To = strEmail
objEmail.Subject = "Network Password"
objEmail.TextBody = "The network password for
user " _
& strNTName & strFileName & " will expire "
& dtmPwdExpires
'==This section provides the configuration information for
the remote SMTP server.
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/se
ndusing") = 2
'Name or IP of Remote SMTP Server
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sm
tpserver") = "ns1.yahoo.com"
'Server port (typically 25)
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sm
tpserverport") = 25
objEmail.Configuration.Fields.Update
'==End remote SMTP server configuration section==
objEmail.Send
End If
End If
End If
End If
End If
objRecordSet.MoveNext
Loop
' Clean up.
objConnection.Close
Wscript.Echo "Done"
Function Integer8Date(objDate, lngBias)
' Function to convert Integer8 (64-bit) value to a date,
adjusted for
' local time zone bias.
Dim lngAdjust, lngDate, lngHigh, lngLow
lngAdjust = lngBias
lngHigh = objDate.HighPart
lngLow = objdate.LowPart
' Account for bug in IADslargeInteger property methods.
If lngLow < 0 Then
lngHigh = lngHigh + 1
End If
If (lngHigh = 0) And (lngLow = 0) Then
lngAdjust = 0
End If
lngDate = #1/1/1601# + (((lngHigh * (2 ^ 32)) _
+ lngLow) / 600000000 - lngAdjust) / 1440
' Trap error if lngDate huge.
On Error Resume Next
Err.Clear
Integer8Date = CDate(lngDate)
If Err.Number <> 0 Then
Err.Clear
Integer8Date = #1/1/1601#
End If
On Error GoTo 0
End Function
User's email address is not the same as user NT name
(userid). For example, email address for user NT name
(Ian) will have an email address (icmpbell@yahoo.com). I
thought I maybe able to use Richard's script to call my
file "emails.txt" and be able to associate which email
address belong to that user NT name and then send a
notification to the user that his/her user NT name will
expired on this date. I apologize if I am not explaining
correctly.
Let say I have a file "emails.txt" containing
icmpbell@yahoo.com. A script will look into "emails.txt"
file and distinguished this email's address associated to
userid "Ian", then send an Email Notification to Ian that
his password will expired on November 28, 2003 at 10:38:06.
First, I will write a script using Richard's script to
output a file of ALL the userid that will expire within 10
days, then I have to manually produce "emails.txt" file,
unless someone know a script that can import those email
addresses to the rightful userid.
Do anybody know if my "emails.txt" may need to contain
both userid and email address in order for the script to
function? If so, how? Is it per line based on my sample
below.......
Ian
icmpbell@yahoo.com
Or do it need to be listed with a comma like this......
Ian, icmpbell@yahoo.com
Very appreciated for your time and willingness to assist
me.
Thank you,
Ian Campbell
Amature Developer Tag: Combo box is always on top of everything! Tag: 146990
copy file
Hello,
I'm new to this, trying to make a copy of a file in the same folder as the
original but with a new name. I've found that CopyFile doesn't work for the
same directory. And because of certain restrictions, sometimes the pathing
will be UNC, so I can't shell out & use the command line 'copy' command.
Is my only option some kind of file-copy to a new directory, file-rename,
file-move back? These are binary files, so I haven't tried using the
createfile methods - should those work?
TIA.
-Dave Tag: Combo box is always on top of everything! Tag: 146987
Creating users, and their home directory
Hi All,
I have a list of 90 users that I need to import into AD. I wrote a script
that does this but it doesn't create their home folder automatically. So
for instance, if I set the user's home folder to \\servername\share\folder,
and set it to a Z drive or something, that folder is not created. However,
when I manually create, or copy a user, it does create that folder
automatically (with the appropriate permissions etc.). Is there an easy way
to get it to create that home folder automatically, without having to make
the script do all of that work? Maybe a copy of an existing user? There is
an article on MSDN about copying a user, but only for SELECTED attributes.
I want ALL of the attributes copied (except username of course).
Thanks,
Pair Tag: Combo box is always on top of everything! Tag: 146984
Display Status Window with Wsh Logon Script
I have a simple yet successful logon vbscript for windows 2000.
However, i would like to display the results/progress in a status
window at runtime when a user log's on to his/her pc. I have seen some
scripts using ie documents but most of the script I have found is a
football field long and does not work with my script. Can somebody
post or refer me to simple code that only displays the results and
status of what is happening (i.e. like in batch files)? Nothing fancy,
just straight forward code that works?
Thanks much! Tag: Combo box is always on top of everything! Tag: 146972
Disable Keyboard & mouse
Dear all
i would like to disable the funtion of keyboard & mouse during my script is
running so that the user could not change the focus of the running program.
can anyone tell me how to write it???
i've search the microsoft, msdn & google but nothing can help.
thank you all in advanced.
: ) Tag: Combo box is always on top of everything! Tag: 146969
Possible to search PST files with VBS?
Is it possible to search a series of PST files with VBS for a
perticular string?
will GetObject work on a PST file? Tag: Combo box is always on top of everything! Tag: 146963
InStr - Searching Logs for strings? Any help?
Wondering if someone can show me a working example of the InStr
function.
I'd like to seach a log file on various remote servers for successful
exit codes.
the examples i've tried recently only work if the string is exactly
For example the log file with a line like
11:11:54 11/01/2003 033867563 RADCONCT EXIT STATUS = [857]
I can get InStr to work if I enter all that exactly but not if I'm
only searching for RADCONCT EXIT STATUS = [857]
Thanks Tag: Combo box is always on top of everything! Tag: 146961
authentification
Hello,
we have subscribed to a web site that need a user/password IIS
authentification every time you connect to it.
I'm looking for a script that will make the connexion automatically (by
filling the 'user/password' field)
thanx for any help and idea.
Nova Tag: Combo box is always on top of everything! Tag: 146958
Using VBScript to run Find in Excel
I would like to use VBScript to find a value that is a variable in
Excel. I assign WSval as the variable to hold the data I need to
locate in column 1 of my Excel file. The problem is in my Do Loop
where I say "If val = (WSval) Then". I don't think val is being
compared to the actual data WSval is holding but rather the word
WSval. My code looks like this:
On Error Resume Next
Const ForReading = 1
Const TristateFalse = 0 'Opens the file in ASCII format
Dim wshShell
Set wshShell=CreateObject("Wscript.Shell")
Set oFS = CreateObject("Scripting.FileSystemObject")
oFS.DeleteFile "N:\pardus\pingresults.txt", True
tIP=InputBox("Enter the IP address: xxx.xxx.xxx.xxx")
wshShell.run ("cmd ~")
Wscript.Sleep 500
wshShell.SendKeys "ping -a " & tIP & ">N:\Pardus\ping.txt ~"
Wscript.Sleep 4000
wshShell.SendKeys "Exit ~"
aFile = "N:\Pardus\ping.txt"
Set f = oFS.OpenTextFile(aFile, ForReading, True)
f.SkipLine
f.Skip(10)
WSval = f.Read(4)
'RUN QUERY AND SEARCH FOR MATCHING WS NUMBER
Set xl = CreateObject("Excel.Application")
xFile = "I:\My Documents\databases\queries\Query from Trackit.dqy"
xl.WorkBooks.Open xFile
xl.Visible=True
xl.DisplayAlerts = False 'Prevents prompt about overwriting resume.xlw
WScript.Echo "Read from text file " & WSval
r = 1 'row
c = 1 'column
Set oSheet = xl.ActiveWorkbook.Worksheets(1)
oSheet.Select
Do
val = oSheet.Cells(r,c).Value
WScript.Echo "Read from Excel file " & val
If val = (WSval) Then
WScript.Echo val
xl.Application.Quit
Exit Do
Else
r = r + 1
End If
Loop
Thanks in advanced for any suggestion/help!
Steve Tag: Combo box is always on top of everything! Tag: 146957
users and folders
I need to write/find a script that will bulk import
around 1500 users creating users and home drives on a
windows 2003 server.
Any help would be welcome Tag: Combo box is always on top of everything! Tag: 146956
Timer before continue with script
Hi
Is it possible to have a timer in a "while not rsResults.EOF"
I want to wait 1 second before returning the next record from that statement
above.
What would the code look like in asp?
Thanks Tag: Combo box is always on top of everything! Tag: 146953
An easier way to write this code?
Is there an easier/shorter way to write this code?
Test1 = Request.Form("Test1")
Test2 = Request.Form("Test2")
Test3 = Request.Form("Test3")
Test4 = Request.Form("Test4")
if Test4 = "Yes" and Test3 = "Yes" and Test2 = "Yes" and Test1 = "Yes" then
Result = 5
elseif Test4 = "Yes" and Test3 = "Yes" and Test1 = "Yes" then
Result = 5
elseif Test4 = "Yes" and Test2 = "Yes" and Test1 = "Yes" then
Result = 5
elseif Test4 = "Yes" and Test1 = "Yes" then
Result = 5
elseif Test3 = "Yes" and Test2 = "Yes" and Test1 = "Yes" then
Result = 4
elseif Test3 = "Yes" and Test1 = "Yes" then
Result = 4
elseif Test3 = "Yes" then
Result = 4
elseif Test2 = "Yes" and Test1 = "Yes" then
Result = 3
elseif Test2 = "Yes" and Test1 = "No" then
Result = 1
elseif Test4 = "No" and Test3 = "No" and Test2 = "No" and Test1 = "Yes" then
Result = 2
elseif Test1 = "No" then
Result = 0
end if Tag: Combo box is always on top of everything! Tag: 146941
Best way to enumerate installed applications
Hi there,
How can I list the applications installed on Win98 machines...? The list
displayed by Add/Remove programs would be a good start... anyone know how to
get this? I'd preferably like to know the executable path and name as well
as the application friendly name.
Any other suggestions for auditing PC software...?
Note that this is preliminary work in preperation for implementing SMS
Server 2003 so no point suggesting I use a server based tool like SMS...
Cheers Tag: Combo box is always on top of everything! Tag: 146938
scrolling popups
Hi,
Does anyone know how to set the scroll
attribute on a popup. For instance if I
write this:
set p=window.createpopup
p.document.body.scroll="yes"
p.show 0,0,100,100
I don't see any scroll bars. I know a popup
can have scroll bars because if I write it
this way I not only see scroll bars but a
sunken border as well:
set p=window.createpopup
p.document.write "x"
p.show 0,0,100,100
? Tag: Combo box is always on top of everything! Tag: 146936
vbs send at commands to serial port
I am trying to write a visual basic script that will be
able to send "at-commands" to the serial port.
I found all commands for the gsm-modem to send sms, but I
am still looking for a way to send the commands. I have
tried to use the mscomm32.ocx through an object, but
without success.
Any help? Tag: Combo box is always on top of everything! Tag: 146912
Bulk change of AD Remote Access permission attrib
Hi,
Trying to do a bulk change of the AD attribute for RAS Permission from
"Deny" to "Allow". Have looked up the Technet script centre on this and
have come up with:
Set objUser = Get Object ("LDAP://cn= etc...correct LDAP path)
objUser.Put "msNPAllowDialin", TRUE
objUser.SetInfo
While this changes this particular attribute as seen in ADSI Edit, it does
not change the AD Users and Computers user account "Dial In" tab attributes
at all. I have no need for any of the other attributes mentioned in the
script centre article and do not want them set. Manually changing the
"Dial In" tab to "Allow Access" changes only the "msNPAllowDialin" booleen
to TRUE but changes no other attributes mentioned in the same Technet
article.
Obviously another attribute to set but unknown what. AD is mixed mode.
Thanks in advance for any assistance. Tag: Combo box is always on top of everything! Tag: 146909
Open File dialog
Hi,
Some days ago, I've posted a message to NG, a question about how to call a
windows OpenFile dialog, which McKirahan response it with a code example
(listed below).
Now, these example doesn't work well for me, because I need that valid
selection are only for files and not for folders.
And this example works fine if selected item is a folder, but if the
selected item is a file, the BrowseForFolder method return null.
Any suggestions or workaround???
Option Explicit
On Error Resume Next
Dim strBFF
Dim objSHL
Set objSHL = CreateObject("Shell.Application")
Dim objBFF
Set objBFF = objSHL.BrowseForFolder(&H0,"Open File",&H4031,&H0011)
strBFF = objBFF.ParentFolder.ParseName(objBFF.Title).Parent
WScript.Echo objBFF
Set objBFF = Nothing
Set objSHL = Nothing
WScript.Echo strBFF
Thanks.
M.- Tag: Combo box is always on top of everything! Tag: 146892
VBScript Logon Script Error
When using the VBScript Join function to map users to folders based on
group membership, on some Windows 2000 computers I get a runtime error
on join and others I don't. If I remove the join function, the PC's
that didnt work, now work and the ones that did work with join no
longer work. I am confused. What am I missing?
Set wshNetwork = CreateObject("WScript.Network")
Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)
' strGroups = LCase(Join(CurrentUser.MemberOf))
' strGroups = LCase(CurrentUser.MemberOf) Tag: Combo box is always on top of everything! Tag: 146888
WshShell issue with WScript
I'm writing code for a VB Script task in a SQL Server DTS
package. Snagged the following code to run a command line
app and want to use the bit where it uses WScript.Sleep to
wait until the executable has finished.
However, both in the DTS task and if I place the following
code in a VB standard .exe I get a run-time error when I
reference WScript.
What's going on? Note, the command line exe does get
called and does run.
Code:
Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec("path to .exe")
Do While oExec.Status = 0
WScript.Sleep 100
Loop
WScript.Echo oExec.Status
Set oExec = Nothing
End Sub Tag: Combo box is always on top of everything! Tag: 146882
Need to write script/batch file to delete selected files
I have a server that we use as a file repository for our daily reports.
The reports are *.txt files, all of them. They come from another domain,
and are "canned" reports that I have no control over.
Each day, we have up to 35-40 of these reports, and the naming convention
has been:
98129918.txt
where:
98 = year
12 = month
99 = denotes the Month End file, which I need to save
18 = unit reporting
The daily outputs the exact same naming convention, with the exception of
the third node (the 99 above) corresponding to the day of the month (00 to
31).
There are over 70,000 files in this directory, taking up 12 gigs on a hard
drive, so the function needs to be automated.
I need to write a script or batch file to save all of the xxyy99zz.txt
files, and to delete all of those not matching that filter from a date
beginning say around 1/1/2002. Anything prior to 1/1/2002 would need only
the month-end files (the ones with ____99__.txt naming), and anything after
that would need to exist until such time I modified the script to have
another cut-off date.
Anyone have any ideas as to how to accomplish this? I am not very fluent in
WSH.
You can respond via the newsgroup, but do not reply to the address, as it is
not valid thanks to the pounding of the Swen virus. Email me at
schathamNO@FREAKINGyahooSPAM.com remove NO FREAKING SPAM to respond....
Thanks
S Tag: Combo box is always on top of everything! Tag: 146880
Check out this important pack
--hrwwzveeqgddbpuq
Content-Type: multipart/related; boundary="yuotwnxyyvfbgkwxa";
type="multipart/alternative"
--yuotwnxyyvfbgkwxa
Content-Type: multipart/alternative; boundary="qkolkanq"
--qkolkanq
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Microsoft User
this is the latest version of security update, the
"November 2003, Cumulative Patch" update which resolves
all known security vulnerabilities affecting
MS Internet Explorer, MS Outlook and MS Outlook Express
as well as three new vulnerabilities.
Install now to protect your computer
from these vulnerabilities, the most serious of which could
allow an attacker to run executable on your system.
This update includes the functionality =
of all previously released patches.
Microsoft Product Support Services and Knowledge Base articles =
can be found on the Microsoft Technical Support web site.
http://support.microsoft.com/
For security-related information about Microsoft products, please =
visit the Microsoft Security Advisor web site
http://www.microsoft.com/security/
Thank you for using Microsoft products.
Please do not reply to this message.
It was sent from an unmonitored e-mail address and we are unable =
to respond to any replies.
----------------------------------------------
The names of the actual companies and products mentioned =
herein are the trademarks of their respective owners.
Copyright 2003 Microsoft Corporation.
--qkolkanq
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
<HTML>
<HEAD>
<style type=3D'text/css'>.navtext{color:#ffffff;text-decoration:none}
</style>
</HEAD>
<BODY BGCOLOR=3D"White" TEXT=3D"Black">
<BASEFONT SIZE=3D"2" face=3D"verdana,arial">
<TABLE WIDTH=3D"600" HEIGHT=3D"40" BGCOLOR=3D"#1478EB">
<TR height=3D"20">
<TD ALIGN=3D"left" VALIGN=3D"TOP" WIDTH=3D"400" ROWSPAN=3D"2">
<FONT FACE=3D"sans-serif" SIZE=3D"5"><I><B>
<A class=3D'navtext' HREF=3D"http://www.microsoft.com/"
TITLE=3D"Microsoft Home Site" target=3D"_top">Microsoft</A>
</B></I></FONT>
</TD>
<TD ALIGN=3D"right" VALIGN=3D"MIDDLE" BGCOLOR=3D"Black" NOWRAP>
<FONT color=3D"#ffffff" size=3D1>
<A class=3D'navtext' href=3D'http://www.microsoft.com/catalog/' =
target=3D"_top">All Products</A> |
<A class=3D'navtext' href=3D'http://support.microsoft.com/' =
target=3D"_top">Support<