Run program in a loop through RunOnce/Ex
Gents
Need to learn more about use of RunOnce and RunOnceEx keys to achieve
the following. Any pointers or tips/suggestions will be greatly
appreciated.
I execute a vb script through RunOnce from Sysprep.inf, which is
designed to run Netdom.exe to add the computer to the domain in the
selected OU. On powering on the computer after sysprep, the script
runs to prompt the user to CONTINUE or EXIT the process of joining the
domain. The process is generally run and understood well by desktop
services technicians but occasionally the users end up connecting the
new syspreped pc to the network and choose to EXIT from the script(on
not knowing which OU to choose) thereby shutting down the PC (PC shuts
down on choosing to EXIT) and loosing the oppertunity to automatically
add the computer to the domain.
What I have been trying is, that on selecting EXIT, the execution of
the script is initiated againg by writing to RunOnce key(before the PC
shutsdown) but have been not successful as it seems that the entry is
made and executed at the same time resulting in no entry being there
for the next restart. I have tried RunOnceEx as well but works only
for the first time and subsequent EXITs and thereon restarts do not
retain the entry.
My intention is to keep this script to run every time during startup
till CONTINUE is selected so that the PC can not be used till
connected to the domain.
Please note that using RUN key is NOT an option as the process has to
be completed without releasing the desktop to the user. On successful
joining of the domain, the PC restarts and presents user with the
logon screen.
Please advise if more information is needed. I hope I am presenting
this query to the right group as most of you are LAN/Desktop
administrators.
Many thanks in advance.
Raja Tag: Can VBScript be used to manipulate an Excel spreadsheet ? Tag: 147174
sqlserver and active directory auth
Hi, I have a web application that retrieve authentication from a table in a
sqlserver database.
Today I have to authenticate users on company Active directory.
does anyone know how can i create a script that perform authentication on
active directory and return true or false?
My idea is to create a script executed by a store procedure that return true
or false.
Many thanks
F. Tag: Can VBScript be used to manipulate an Excel spreadsheet ? Tag: 147173
Determine Office VErsion and language
Hello,,
How can I use VBScript to determine the offece version and language.
Thank you Tag: Can VBScript be used to manipulate an Excel spreadsheet ? Tag: 147167
Script to set Primary Group
Can someone help me figure why my script is not working on
Windows 2000/2003 running Active Directory? I am receiving
a message that "the server is not operational" on line 18
which is "set objUser = GetObject("LDAP://" & strUserDN)".
I need help.
' This VBScript code first checks to see if the user's
primary group is already
' set to the specified group. If not it will a) add the
user to the group
' if not already a member and b) set the primary group id
to the group.
' ------ SCRIPT CONFIGURATION ------
strUserDN = Trim(InputBox("Enter UserID"))
strGroupDN = Trim(InputBox("Enter Primary Group to be
set"))
' ------ END CONFIGURATION ---------
Const ADS_PROPERTY_APPEND = 3
set objUser = GetObject("LDAP://" & strUserDN)
WScript.Echo
set objGroup = GetObject("LDAP://" & strGroupDN)
objGroup.GetInfoEx Array("primaryGroupToken"), 0
if objGroup.Get("primaryGroupToken") = objUser.Get
("primaryGroupID") then
WScript.Echo "Primary group for user already set to " &
strGroupDN
WScript.Quit
end if
intAddMember = 1
for each strMemberDN in objUser.GetEx("memberOf")
if LCase(strMemberDN) = LCase(strGroupDN) then
intAddMember = 0
Exit for
end if
next
if intAddMember > 0 then
objGroup.PutEx ADS_PROPERTY_APPEND, "member", Array
(strUserDN)
objGroup.SetInfo
WScript.Echo "Added " & strUserDN & " as member of " &
strGroupDN
end if
objUser.Put "primaryGroupID", objGroup.Get
("primaryGroupToken")
objUser.SetInfo
WScript.Echo "Changed primary group id of " & strUserDN & _
" to " & objGroup.Get("primaryGroupToken") Tag: Can VBScript be used to manipulate an Excel spreadsheet ? Tag: 147150
call .net class from vbscript
I know a .net class can be registered for COM, but can a VB-script use
CreateObject or GetObject and use a non-registered file location to get the
object?
Basically, can you call .net from COM directly from the assembly file,
without registering with com Tag: Can VBScript be used to manipulate an Excel spreadsheet ? Tag: 147139
CreateObject hangs
I just moved from Windows/ME to Windows/XP Prof. An ASP
script I've been running for my website no longer works.
It basically hangs on the setting of a CreateObject -- the
ASP times out. I've tried it both under PWS and IIS.
I've been thinking it was a security / permissions problem
but everything seems to be turned up. Interestingly, the
same CreateObject works as a VBS and VBScript works within
an ASP. It's just a combo of ASP & that CreateObject.
Your help is appreciated. My website's been down for a
month! Tag: Can VBScript be used to manipulate an Excel spreadsheet ? Tag: 147129
I need solution
Hi All,
My application uses Microsoft ScriptControl ActiveX.
I would like that a user could stop a running script by
clicking on
Stop button.
I need some solution for this.
May be is it possible to retrieve IActiveScriptSite
interface from
ScriptControl and use IActiveScript::Close?
Any ideas?
Thanks In Advance!
Jon.
http://www.naptaxes.com/AAJ/
[AllAmericanJobs - Searching jobs from your desktop and
automatically
sends resume.]
-----------------------------------------------------------
---------------------------------------------------------
. Tag: Can VBScript be used to manipulate an Excel spreadsheet ? Tag: 147123
Subscript out of range error
OK, this is VBA rather than VBScript, but I think the
problem is still apropos.
I've got a database in Access 97 that records the items
shipped and received for a warehouse. Because of the
nature of the operation, I can't know any advance how many
items will be included on a shipment - it could be 1, it
could be 50. (I think it's a reasonable thing to assume
that we'll never break 100 items per shipment.)
To accomidate, I've got a dynamic string array that stores
the values in VB. I've got 5 unbound text boxes, and my
form reads their values, increases the size of the array,
and adds the value the newly created slot. On my system
(the development PC), it works like a charm. I could add
15 or 20 things, and the items are added OK.
However, on the PCs down in the warehouse, they tell me
they will often get "Subscript out of range" errors -
sometimes two or three times in a row. The actual line
that throws the error is this one:
ReDim Preserve myArr(UBound(myArr) + 1)
The only difference I can think of is that on their
system, there could be a 15 or 20 minute wait period
between the times that they add items. Whereas when I test
it, I add all the items at once and process the thing.
Is there some kind of "time out" or something where VBA
will "forget" what was in the array? Or does anyone else
have a suggestion for another method by which I can
dynmically save multiple items in VBA? Tag: Can VBScript be used to manipulate an Excel spreadsheet ? Tag: 147122
HOW TO: Determine if a user is Disabled
I wrote a script a few months ago that we ran through our environment to
determine what local users existed on the workstations. If I found any
"non-approved" locally created (non-domain) users in the Administrators or
Power Users groups I disabled them. Now I want to go through and delete
those disabled users. Is there a scripting way to determine if a local user
is disabled?
Thanks,
Tom Tag: Can VBScript be used to manipulate an Excel spreadsheet ? Tag: 147111
WSH script execution problem
Hello,
I am using the script below to gather log files from a Windows 2000 server,
and store them on another server. The script below runs fine when executed
manually on the remote server, however, if I schedule this script as a task
through the task scheduler, the script will initiate, but will never
complete. I know that it starts, because I get a new instance of wscript.exe
when it fires. Is there any reason why this script would not run as a
scheduled task??
A little background may help....
The remote machine where the script is running is in a different domain than
the server where the log files are stored, and the script will actually run
as a scheduled task if I tell it to store the log file locally instead of
using the mapped drive section of code below. The funny part is that the
script runs as is when executed manually.....
Thanks in Advance!!
'Setup the parameters for which computer and what logs
strComputer = "SERVER_NAME"
Set objWmiService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Backup,Security)}!\\" & _
strComputer & "\root\cimv2")
'Setup a mapped drive to store the file
Dim WshNetwork, strShare, strUser, strPassword
strUser = "USERNAME"
strPassword = "PASSWORD"
strShare = "UNC_PATH_TO_SHARE"
Set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.MapNetworkDrive "Z:", strShare, false, strUser, strPassword
'Setup a unique path filename based on date
today = Now()
today = Replace(today, "/", "")
today = Replace(today, ":", "_")
today = Replace(today, " ", "_")
path = "Z:\" & today & ".txt"
localpath = "LOCAL_PATH\" & today & ".txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(path)
objFile.Close
'Open ServerCheck.txt for Writing
Const ForAppending = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
(path , ForAppending, True)
'Write header info to txt file
objTextFile.WriteLine("------------------------" )
objTextFile.WriteLine("Server Log File Report")
objTextFile.WriteLine("------------------------" & VBCRLF)
objTextFile.WriteLine("Script started: " & Now & VbCrLf)
Set colLoggedEvents = objWMIService.ExecQuery _
("Select * from Win32_NTLogEvent")
For Each objEvent in colLoggedEvents
if objEvent.type <> "0" then
objTextFile.WriteLine( "Category: " & objEvent.Category)
objTextFile.WriteLine( "Computer Name: " & objEvent.ComputerName)
objTextFile.WriteLine( "Event Code: " & objEvent.EventCode)
objTextFile.WriteLine( "Message: " & objEvent.Message)
objTextFile.WriteLine( "Record Number: " & objEvent.RecordNumber)
objTextFile.WriteLine( "Source Name: " & objEvent.SourceName)
objTextFile.WriteLine( "Time Written: " & objEvent.TimeWritten)
objTextFile.WriteLine( "Event Type: " & objEvent.Type)
objTextFile.WriteLine( "User: " & objEvent.User)
objTextFile.WriteLine VBCRLF
objTextFile.WriteLine
"##################################################"
objTextFile.WriteLine VBCRLF
end if
Next
objTextFile.WriteLine( "")
objTextFile.WriteLine ("Total Number of Events: " & colLoggedEvents.Count )
objTextFile.WriteLine( "**** System Log Check Completed *****" )
objTextFile.WriteLine( "")
'Close the file for Writing
objTextFile.WriteLine("Script Ended: " & Now)
objTextFile.Close
'Read log file
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
(path, ForReading)
strResponses = objTextFile.ReadAll
'Send mail Alert
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "SERVER@FIRSTDOMAIN.COM"
objEmail.To = "ME@SECONDDOMAIM.COM"
objEmail.Subject = "Server Log Checks"
objEmail.TextBody = "The server log file checks for SERVER_NAME are
complete. The file was stored here:" & VBCRLF
objEmail.TextBody = objEmail.TextBody & localpath & VBCRLF & "The Event logs
were then cleared on the server."
objEmail.TextBody = objEmail.TextBody & VBCRLF & "Listed Below are the
actual log files"
objEmail.TextBody = objEmail.TextBody & VBCRLF & VBCRLF & strResponses
objEmail.Send
objTextFile.Close
'Close the mapped drive
WshNetwork.RemoveNetworkDrive "Z:"
'Collect all the files
Set colLogFiles = objWMIService.ExecQuery _
("Select * from Win32_NTEventLogFile")
'Clear the log file on the server
For Each objLogfile in colLogFiles
objLogFile.ClearEventLog()
Next Tag: Can VBScript be used to manipulate an Excel spreadsheet ? Tag: 147107
EnumerateComputersNotLoggedInTheLastSixMonths.vbs
I found a Perl example, would anyone have a Vbs or WSH example of
something like this that goes against multiple DC's in a 2000 environment?
TIA
Mike Tag: Can VBScript be used to manipulate an Excel spreadsheet ? Tag: 147100
other version info: string table info in vbscript
I see that the System.Diagnostics object in .Net has
FileVersionInfo which returns the version information
that can be seen in the "other version information" field
in explorer in the properties dialog for a file... but is
there a way to access this information via vbscipt?
Specifically I want to get the Language field.
Thanks in advance!
-Jason Tag: Can VBScript be used to manipulate an Excel spreadsheet ? Tag: 147095
Checking for folder attributes
This is a multi-part message in MIME format
------=_NextPart_000_65241244
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Running a vbscript that queries a network share. Trying to exclude the
system folders (System Volume Information & Recycler) from being checked
by the script. When I run the script, I get an *Expected 'Then'* error
on the *If oSubFolder.Attributes* line with a code 800A03F9. Any help
is appreciated.
Here are the portions of the script
sSourceDir = "\\somefileserver\someshare"
Call FindOldFiles(oFS.GetFolder(sSourceDir))
'------------------------------------------------------
'
' Sub routine FindOldFolder
'
'------------------------------------------------------
sub FindOldFiles(oFolder)
Dim oSubFolder
For Each oSubFolder in oFolder.SubFolders
If oSubFolder.Attributes Not 4 Then
Call FindOldFilesInDir(oSubFolder)
End If
Next
End Sub
'------------------------------------------------------
'
' Sub routine FindOldFile
'
'------------------------------------------------------
sub FindOldFilesInDir(oFolder)
Dim oFile, oSubFolder
For Each oFile in oFolder.Files
If oFile.Attributes Not 4 then
If IsOlder(oFile, nDays) Then
nTotal = nTotal + 1
sFileList = sFileList & oFile.Path & vbCrlf
End If
End If
Next
End Sub
'--------------------------------------------------------
'
' Function IsOlder
'
'--------------------------------------------------------
Function IsOlder(oFile, nDays)
IsOlder=False
If DateDiff("d", oFile.DateLastAccessed, Now) > nDays Then IsOlder =
True
End Function
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
------=_NextPart_000_65241244
Content-Type: text/html; name="_alt.0"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="_alt.0"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4=2E0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html;=
charset=3Diso-8859-1">
<META content=3D"MSHTML 6=2E00=2E2800=2E1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Does anybody know of where I can get=
a script that
will take hardware inventory of computers on my network=2E =
And perferriably
software inventory also=2E </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>cheers=2E</FONT></DIV></BODY></HTML>
------=_NextPart_000_65241244-- Tag: Can VBScript be used to manipulate an Excel spreadsheet ? Tag: 147094
Hardware Inventory
This is a multi-part message in MIME format.
------=_NextPart_000_000B_01C3A913.19D443C0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Does anybody know of where I can get a script that will take hardware =
inventory of computers on my network. And perferriably software =
inventory also. =20
cheers.
------=_NextPart_000_000B_01C3A913.19D443C0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Does anybody know of where I can get a =
script that=20
will take hardware inventory of computers on my network. And =
perferriably=20
software inventory also. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>cheers.</FONT></DIV></BODY></HTML>
------=_NextPart_000_000B_01C3A913.19D443C0-- Tag: Can VBScript be used to manipulate an Excel spreadsheet ? Tag: 147091
ADO command parameter problem
Hi All,
Iam using code below with command object but on execution it is not
returning any recordset.
Can any one help.
Here is the code for your perusal..
Dim rs
dim cmd
dim productID
if request("Product")="" then productid=null else productID
=request("product")
set cmd = server.CreateObject("ADODB.Command")
cmd.CommandText="sp_stock_avail"
cmd.CommandType =adCmdStoredProc
cmd.Parameters.append cmd.CreateParameter ("@nMonth",
adInteger,adParamInput,,cint(request("FromMonth")))
cmd.Parameters.append cmd.CreateParameter ("@nYear",
adInteger,adParamInput,,cint(request("Year")))
cmd.Parameters.append cmd.CreateParameter ("@nReport_Dur",
adInteger,adParamInput,,cint(request("Period")))
cmd.Parameters.append cmd.CreateParameter ("@nProductID", adInteger,
adParamInput,,113)
cmd.Parameters.append cmd.CreateParameter ("@order_by",
adBSTR,adParamInput,,cstr(request("OrderBy")))
cmd.ActiveConnection=conn
set rs=cmd.Execute
and my stored procedure has these parameters..
CREATE PROCEDURE dbo.SP_Stock_Avail
@nMonth as int,
@nYear as int,
@nReport_Dur as int ,
@nProductID as int,
@order_by as varchar(200)
AS
Thanx in advance
Ritesh K Tag: Can VBScript be used to manipulate an Excel spreadsheet ? Tag: 147088
MoveTo and the new IESP1 update
Windows Update is back on line, and as ever, I updated my system, including
the patch to IESP1.
Now, an .hta of mine is not working properly - I am getting a security error
when using parent.moveTo(x,y).
This obviously has something to do with the security patch and I now need to
know what has been changed, and why, so that I can rewrite my software to
work around it!
Any ideas?
TIA
Martin Tag: Can VBScript be used to manipulate an Excel spreadsheet ? Tag: 147087
how to show html source in a popup
<script language=vbs>
set p=window.createpopup
p.document.body.style.overflow="scroll"
set x=p.document.body.createtextrange
x.text=document.all.tags("html").item(0).outerhtml
p.show 0,0,250,300
</script> Tag: Can VBScript be used to manipulate an Excel spreadsheet ? Tag: 147086
help...
Hi all, I´m new in VBScript and I´m trying that....
I select data from a database, after I do a while to show them in the
screen, and there is one textfield "txtday" to enter the number of
days, and then when click on "Save" botton I need to update the value
in the database. How do I check If I have more then one in the screen?
How do I check the quantity of days in each line to save in the
correct hdCodParametro in my database? How shoud be my Validate()
function to check each field and execute a procedure to save it in the
database?
I appreciate your help...
Thanks
sandra
<%
.
.
.
Set rsDados = Server.CreateObject("ADODB.RecordSet")
sSQL = "Select COD_PARAMETRO, DSC_PARAMETRO, DSC_VALOR_PARAMETRO from
PARAMETROS_0133T (nolock) where COD_PARAMETRO = 219 OR COD_PARAMETRO =
220"
retorno.Open sSQL, cnSQL
if retorno.EOF then
Set retorno = Nothing
response.write ("Error....")
end if
%>
<html>
<head>
<title>Title...title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="750" border="0" cellpadding="5" cellspacing="0">
<tr>
<td background="fundo_escuro_peq.gif"><font face="verdana"
size="2"><b><font color="#FFFFFF" size="1">::</font><font
face="verdana" size="2"><b><font face="verdana" size="2"><b><font
color="#FFFFFF" size="1">
Funcionário com nível de acesso
administrativo</font></b></font></b></font><font color="#FFFFFF"
size="1">
-> Atualizar Parâmetros</font></b></font></td>
</tr>
<tr>
<td height="365" valign="baseline">
<div align="center">
<form name="form1" method="post">
<table width="700" border="0" cellpadding="3" cellspacing="0">
<%
while Not retorno.Eof
%>
<tr>
<input type="hidden" name="hdCodParametro"
value="<%=retorno("COD_PARAMETRO")%>">
<td bgcolor="#DCECF5" width="602" class="LabelAsp"
name="txtDecr_Parametro"><%=retorno("DSC_PARAMETRO")%> </td>
<td width="86" bgcolor="#DCECF5">
<div align="center"><font face="verdana" size="2">
<input type="text" name="txtday" size="4" maxlength="4"
value="<%=retorno("DSC_VALOR_PARAMETRO")+contador%>"> <b> Day
</b></font></div></td>
</tr>
<%
retorno.MoveNext
Wend
retorno.close
cnSQL.close
%>
</table>
<p>
<input type="submit" name="Submit" value="Save"
onclick="Validate();return false;"><br>
</p>
</form>
</body>
</html> Tag: Can VBScript be used to manipulate an Excel spreadsheet ? Tag: 147079
Combo box is always on top of everything!
This is a multi-part message in MIME format.
------=_NextPart_000_0013_01C3A91C.36304F60
Content-Type: text/plain;
charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable
When I place a layer over something else containing a combo or text box, =
the
combo or text box remains on top. it looks terrible, and I can't seem =
to
find a way around this. Anyone know what to do?
Here is the simple example:
<html>
<head>
</HEAD>
<BODY>
<SELECT id=3Dselect1 name=3Dselect1 style=3D"z-index:1">
<OPTION>this is select box</OPTION>
</SELECT>
<div name=3D"div1" id=3D"div1"
style=3D"position:absolute;margin-left:-100;margin-top:0;z-index:10">
<table bgcolor=3D"Gainsboro" border=3D"1" width=3D100 height=3D100>
<tr><td>some text</td></tr>
</table>
</div>
</body>
</html>
Thank you for your answer,
Simon
Thanks,
Simon
------=_NextPart_000_0013_01C3A91C.36304F60
Content-Type: text/html;
charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-2">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>When I place a layer over something =
else containing=20
a combo or text box, the<BR>combo or text box remains on top. it =
looks=20
terrible, and I can't seem to<BR>find a way around this. Anyone =
know what=20
to do?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3D"Times New Roman" =
size=3D3>Here is the=20
simple=20
example:<BR><BR><html><BR><head><BR></HEAD><BR><BODY=
><BR><SELECT=20
id=3Dselect1 name=3Dselect1 =
style=3D"z-index:1"><BR><BR> <OPTION>this is=20
select box</OPTION><BR><BR></SELECT><BR><BR><div =
name=3D"div1"=20
id=3D"div1"<BR>style=3D"position:absolute;margin-left:-100;margin-top:0;z=
-index:10"><BR><BR> <table=20
bgcolor=3D"Gainsboro" border=3D"1" width=3D100 =
height=3D100><BR> =20
<tr><td>some=20
text</td></tr><BR> </table><BR></div><BR><=
;/body><BR></html><BR><BR>Thank=20
you for your answer,<BR>Simon</FONT><BR></DIV>
<DIV><BR><BR>Thanks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Simon<BR></DIV></FONT></BODY></HTML>
------=_NextPart_000_0013_01C3A91C.36304F60-- Tag: Can VBScript be used to manipulate an Excel spreadsheet ? Tag: 147076
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: Can VBScript be used to manipulate an Excel spreadsheet ? 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: Can VBScript be used to manipulate an Excel spreadsheet ? 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: Can VBScript be used to manipulate an Excel spreadsheet ? 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: Can VBScript be used to manipulate an Excel spreadsheet ? 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: Can VBScript be used to manipulate an Excel spreadsheet ? 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: Can VBScript be used to manipulate an Excel spreadsheet ? 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: Can VBScript be used to manipulate an Excel spreadsheet ? 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: Can VBScript be used to manipulate an Excel spreadsheet ? 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: Can VBScript be used to manipulate an Excel spreadsheet ? 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: Can VBScript be used to manipulate an Excel spreadsheet ? 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: Can VBScript be used to manipulate an Excel spreadsheet ? 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: Can VBScript be used to manipulate an Excel spreadsheet ? 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: Can VBScript be used to manipulate an Excel spreadsheet ? 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: Can VBScript be used to manipulate an Excel spreadsheet ? Tag: 147005
data verticaly
How to read a data from a file where record information
store verticaly into SQL? Tag: Can VBScript be used to manipulate an Excel spreadsheet ? 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: Can VBScript be used to manipulate an Excel spreadsheet ? 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: Can VBScript be used to manipulate an Excel spreadsheet ? 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: Can VBScript be used to manipulate an Excel spreadsheet ? 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: Can VBScript be used to manipulate an Excel spreadsheet ? 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: Can VBScript be used to manipulate an Excel spreadsheet ? 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: Can VBScript be used to manipulate an Excel spreadsheet ? 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: Can VBScript be used to manipulate an Excel spreadsheet ? 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: Can VBScript be used to manipulate an Excel spreadsheet ? Tag: 146961