Permssions error
Hi All,
I am running the following vbs on my machine and it works
perfectly when I run it locally. ie, specify strComputer
= "."
however, when I specify another machine in the network, I
get permission denied 'GetObject'. I am an admin on the
remote machine I am calling. What could mbe the problem?
Thanks in advance
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer
& "\root\cimv2")
Set colQuickFixes = objWMIService.ExecQuery _
("Select * from Win32_QuickFixEngineering")
For Each objQuickFix in colQuickFixes
Wscript.Echo "Computer: " & objQuickFix.CSName
Wscript.Echo "Description: " & objQuickFix.Description
Wscript.Echo "Hot Fix ID: " & objQuickFix.HotFixID
Wscript.Echo "Installation Date: " &
objQuickFix.InstallDate
Wscript.Echo "Installed By: " &
objQuickFix.InstalledBy
Next Tag: New IE window Tag: 139858
Returning arrays from a .vbs file
My question is: how is it possible for a .vbs file to return a variant array of strings when called from another .vbs
file?
I have a .vbs file which consists of about 20 calls to independent Functions, each of which returns an array of 4
strings. After this a short section disseminates the returned information. Each Function is about 30 lines long.
For maintainability, instead of one huge Main.vbs file, I'd like to have a small Main.vbs and have each function call
go out to its own small standalone .vbs file. These calls could be synchronous or asynchronous, but after all the
results are in, I need to summarize the returned arrays. Can you suggest a way that's better than my overkill IE
idea which follows? By the way, each .vbs file, including Main.vbs, utilizes an OCX that I have written and this OCX
would be happy to cooperate.
Can you do better than?:
Main.vbs creates and prepares an instance of IE. Each Function (located in its own .vbs file) finds this same
instance and when the Function is done, it writes its array somewhere into this IE instance which the caller
(Main.vbs) can then access.
In a better version, each FunctionN.vbs file would do something like Set myOcxInstance = GetObject(,"myOcx.Tool") and
then I could accumulate the variant array of strings into the OCX, but upon searching, I have read that this
GetObject does not like to work with OCXs (the OCX contains forms, but they are not shown when accessed in this
manner) so I thought I'd ask before chasing after the wrong tree to bark up.
Thanks,
Csaba Gabor from New York Tag: New IE window Tag: 139855
Problems Using UPDATE to modify multiple and non sequential records - a giant conundrum from a total novice....
The records in my database are displayed in a form as follows:
%>
<form action="report-ammend1.42.asp" method="post"name="form">
<table border=1>
<%
x = 1
while RS.EOF=false
%>
<tr><td><input type="hidden" name="SprogNo<%= x %>"
value="<%Response.Write RS.Fields("SprogNo")%>"><% response.write
(RS.Fields("SprogNo"))%></td>
<td><input type="text" name="Report<%= x %>" value="<%Response.Write
RS.Fields("Report")%>"></td>
<td><input type="text" name="rep2<%= x %>" value="<%Response.Write
RS.Fields("rep2")%>"></td></tr>
<%
x = x + 1
RS.movenext
Wend
By specifying integer values for x in the form action file, the
correct data is always udated to the correct record:
Dim DB
Set DB = Server.CreateObject ("ADODB.Connection")
DB.Open ("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA
SOURCE=C:\Inetpub\wwwroot\test\test.mdb")
'Dim rs
Set rs = Server.CreateObject ("ADODB.Recordset")
rs.Open "SELECT * FROM SprogTbl", DB, 2, 2
rs.movefirst
for x = 1 to 3
rs.Fields("SprogNo") = Request.Form("SprogNo" & x)
rs.Fields("Report") = Request.Form("Report" & x)
rs.Fields("rep2") = Request.Form("rep2" & x)
rs.update
RS.movenext
Next
rs.movefirst
However, I need this to work for any (undefined) no. of records and
the records may have been queried to display non-sequential records
for the database.
I can't make any of the three solutions I can think of work:
1. If I could make the field SprogNo (which contains the unique ID
no.) rs.response write into x as an integer, then each record would be
automatically numbered. I would then need some kind of "for each x"
loop before the rs.update statements. Just putting:
Response.Write RS.Fields("SprogNo")=x
in place of x = x+1 doesn't do it........
2. I've also tried tying the update to a WHERE statement. But, the
following will work for a databse of one record only:
Dim strSQL
strSQL = "UPDATE SprogTbl SET Report = '" & Report & _
"', rep2 = '" & rep2 & _
"' WHERE ((SprogTbl.SprogNo)='" & SprogNo & "');"
DB.execute(strSQL)
.... however, I've had no success trying to iterate it's functions
starting with rs.movefirst and then a while rs.EOF=false 'rs.movenext
loop.
3. Finally, I thought it might be worth trying to get the WHERE
statement (above) into the rs.Fields("SprogNo") =
Request.Form("SprogNo" & x) statement. So far all attempts have fallen
foul of syntax errors. e.g. rs.update WHERE ((SprogTbl.SprogNo)='" &
SprogNo & "');
The last two solutions would still require making the update repeat
for each of the fields in some kind of a loop.
Any help gratefully recieved...... Tag: New IE window Tag: 139854
Why does Createobject work on one computer but not another?
I have the following code in a Visual Basic 6 standard exe project. On
my computer, the development computer, it works fine.
Dim ObjH as variant
Set objH = CreateObject ("Shell.Application")
However, when the same line of code is executed on another computer,
it gets a run time error "object variable or with block variable not
set". This line of code is basically instantiating an object variable
to point to an object application in the class named shell. Is there
a Visual Basic reference or dll required to use this line? Does
anyone know why this is occurring and what I can do to fix it. Thanks
in advance. Tag: New IE window Tag: 139846
For Next iterations
Hi all,
Is there any 'trick' anyone knows to control a For Next to pass to the next
iteration in VBScript? ..Similar to the 'continue' keyword of C and
C++?
Thanks in advance..
-BB Tag: New IE window Tag: 139845
win32_print* on clusters
Hi there,
It seems that the win32_printer and win32_printjob classes are not directly
available on clusters. So what approach should be used in enumerating those
instances on clustered printservers?
Thanks,
--
SLE Tag: New IE window Tag: 139844
detect occurrence of two words in a text with regexp
Hi,
I'm searching for a pattern allowing to detect if a text
has occurrence of two words (say word1 and word2),
consecutive or not. I don't want a logical OR where
(word1)|(word2) would be the solution. I want the two
words being simultaneously in the text.
So the text could be
"some words word1 some other words word2 or word1word2 or
word1 word2"
I accept to not detect word2 being before word1 like
word1...word2...word2...word1
I almost found a pattern with :
re.global=true
(word1)\s*(word2)|(word1)(\s+\w+)+\s+(word2)
and why not be more complex with testing word1 and word2
being at the beginning of words like
word1abc and word2xyz
so the pattern will be
(word1\w*)\s*(word2\w*)|(word1\w*)(\s+\w+)+\s+(word2\w*)
If I dump the matchcol, I find each word1 and word2 listed
but the matchcol.count doesn't give the right number of
(word1, word2) pair occurrence.
That's because the expression word1 words word2 words
word1 words word2
is counted for one single occurrence as if it was :
word1 (all words including word1 and word2 ignored) word2
Only the first word1 and the last word2 are taken into
account.
But the returned submatch content is
word1 words word2 words word1 words word2
so any word1 and word2 is catched.
I get also the same result with :
(word1)(\s\w+)*\s*(word2)
So I'm happy to know the two words are in the text but I
can't use the result for replacing the words because I
don't know where they are.
Since I want to change the color of word1 and word2 in
red, I must know the exact location.
Is there any other way? or I must use the following
process :
- detect the presence of the two words (wherever they are)
- do a re.replace(text, "word1", "<font
fontcolor=red>word1<font>
- do the same with word2
Thanks for any help Tag: New IE window Tag: 139834
Using queried date to serach for data
I'm having a problem with my asp pages. I have the first page set up
to search for data by date and shift. The dates are retrieved by a
query of all dates that are in the database, meaning that if a date has
no data, then that date will not show up in the select box. The shift
is a simple select box with three options in it. When I hit submit, if
there's a date that has the same shift as another date, the date and
the data from that date that posted first will show up, even if I
selected another date. Here's the code below and do you all have any
ideas how this might be happening and ways to correct it. Thanks for
any help I can get.
First Page
<%
'Sets up the connection between the page and the database
Set Connection = Server.CreateObject("ADODB.Connection")
Connection.Mode = 3
dbDir = Server.MapPath("fpdb/sacshifttest.mdb")
Connection.Open "DBQ=" & dbDir &"; Driver={Microsoft Access Driver
(*.mdb)}; DriverID=25;FIL=MS Access;"
'Queries for the data from that day
SQLStmt = "SELECT DISTINCT dateRecord FROM SacShiftTest "
Set RS = Connection.Execute(SQLStmt)
%>
..
<td><select name="dateRecord">
<%
do while not RS.EOF
daDate = RS.Fields("dateRecord").Value%>
<option value="dateRecord"><% = daDate %>
<%
RS.MoveNext
Loop
%>
<% Connection.close %>
Next Page:
<%
dateRecord = Replace(Request("dateRecord"), "'", "''")
sacShift = Replace(Request("sacShift"), "'", "''")
'Sets up the connection to the database
Set Connection = Server.CreateObject("ADODB.Connection")
Connection.Mode = 3
dbDir = Server.MapPath("fpdb/sacshifttest.mdb")
Connection.Open "DBQ=" & dbDir &"; Driver={Microsoft Access Driver
(*.mdb)}; DriverID=25;FIL=MS Access;"
SQLStmt1 = "SELECT * FROM SacShiftTest WHERE dateRecord = " & dateRecord
& " AND sacShift='" & sacShift & "' AND testnum='1' "
Set RS1 = Connection.Execute(SQLStmt1)
%>
--
Posted via http://dbforums.com Tag: New IE window Tag: 139827
nt 4 user list
I need to generate a list of every user in their domain, and the home
directory listed for each user.
This is a (large) Windows NT 4.0 domain.
Thanks,
Jay Tag: New IE window Tag: 139824
Formatting or inserting breaks into Textarea using innerHTML
AAAAARRRGGGHHHHHHH!!!!!!!!!!!!!!!!
Sorry, but thats how much I was frustrated when I could not get a
simple thing to work on a static html page using javascript. I just
wanted to insert a line break into the textarea dynamically. Here is
the piece of code that will not work... but will give you a "unknown
runtime error". If you remove the "<br>"s, it will work.
<html>
<head>
<script language="JavaScript">
function writeText() {
document.all.myTextArea.innerHTML =
"Hello<br>" + "sometext" + "<br>Hello";
//THIS WONT WORK EITHER:
//document.all.myTextArea.innerHTML =
// "Hello\n" + "sometext" + "\nHello";
}
</script>
</head>
<body>
<table>
<tr><td id="mytd"><textarea
id="myTextArea"></textarea></td></tr>
<tr><td><input type="submit" name="submit" value="submit"
onClick="writeText();"/></td></tr>
</table>
</body>
</html>
But Internet Explorer did not like it. I visited a lot of newsgroups
and tried different things. I've tried replacing line breaks ("\n")
with <br>s and what not... but we wont go into it. What I am trying
to
say here is that I could not find a way to format the text inside a
text area. After hours of research, I just ended up doing something
like this... which by the way occured to me when I was finishing up
my
Dominos pineapple pizza. The workaround was to include the whole
textarea inside the javascript and write them into the TD using the
innerHTML of the TD at runtime. I sincerely hope that this will help
someone solve a similar issue and save them a lot of trouble.
=========
SOLUTION:
=========
Here is the code that I came up with to work around this situation...
//THIS IS THE WORKAROUND: (result is the id of TD, so you are
basically inserting html that CONTAINS the textarea into the TD
instead of writing text to the textarea. i.e., you are writing the
whole textarea into the TD at runtime)
<html>
<head>
<script language="JavaScript">
function writeText() {
var rslt;
rslt = "<textarea id=\"myTextArea\">";
rslt += "Hello\n" + "sometext" + "\nHello";
document.all.mytd.innerHTML = rslt + "</textarea>";
}
</script>
</head>
<body>
<table>
<tr><td id="mytd"> <textarea id="myTextArea"></textarea>
</td></tr>
<tr><td><input type="submit" name="submit" value="submit"
onClick="writeText();"/></td></tr>
</table>
</body>
</html>
GOOD LUCK!!!
You are welcome.
Jawad Shaik Mohammed
Stryker Instruments
Kalamazoo, MI
Ph: (269) 323-7700 x3500 Tag: New IE window Tag: 139812
Learnig VB Script
Hello,
I´am a good VB 6 programer and now I will learn differences between VB and
VBS. Has somebody a good tip for a book or internet based learning?
THX
Thomas
mailto:twohlgemuth@hilcom-online.de Tag: New IE window Tag: 139800
Looking for resources/archives of vb scripts?
Hello,
Could someone direct me to some comprehensive vb
archives on the web? Just trolling for some scripts that
may be of use:-)
TIA Tag: New IE window Tag: 139798
Newbie question: GetObject & CreateObject
hi,
i want to execute this wmi code on an html page:
Set objComputerSystem =
GetObject("winmgmts:{impersonationLevel=impersonate}!root/cimv2").ExecQuery(
"select * from Win32_ComputerSystem")
For Each instanceComputerSystem In objComputerSystem
Manufacturer = Trim(instanceComputerSystem.Manufacturer)
Model = Trim(instanceComputerSystem.Model)
ComputerName = Trim(instanceComputerSystem.Caption)
RAM = CLng(((instanceComputerSystem.TotalPhysicalMemory) / 1024) /
1024)
User = instanceComputerSystem.UserName
User = Mid(User, InStr(1, User, "\") + 1, Len(User))
Next
Set objComputerSystem = Nothing
but of course i got an error (activeX component can not get an object)
i tried with createobject, i changed security parameters but with no
results.
any idea please ?
Javier Tag: New IE window Tag: 139794
How to manage the "system" user
Hi guys,
I need to move the system user to a custom xp local group.
I tried the normal method that applies to any ordinary local users but
it does not seems to work.
I had a look at MS technet site but found nothing regarding this
issue.
Does anybody know how to deal with this user ?
Any help is appreciated !
Thanx
Bar Tag: New IE window Tag: 139788
Split domain from email add
Hi,
I need to extract the domain from any email address
entered into my form.
e.g. for someone@somewhere.com i want to be able to take
the string and extract only the somewhere.com part to pass
into a function.
Can anyone please advise me of the best way to do this.
Thanks in advance,
Nev. Tag: New IE window Tag: 139779
newbie question
I have a task that is due soon. My question is: i have to
copy certain files from nt 4 wks to a network share, then
copy them back from the network share to the new
workstation that will be xp.
is there anything i need to worry about or be considered
about?
thanks for you help
Thomas Tag: New IE window Tag: 139776
trouble with process wscript.exe
Hi,
I have a big problem when i run my vbs script on several server (not all
server). My script is automaticaly run every 1 hour. When i m looking in
task manager, the process wscript.exe appear around 300 times ! So sometime
the server crashs if i don't kill any process 'wscript.exe'. I enable the
option "kill the script" about 600 second elapsed.
Why this problem appear ? Please have you an idea ?
Thanks in advance
Arnaud Tag: New IE window Tag: 139775
starting executable in login script
I want to run an executable from a .vbs login script that starts up our
virusscanner installation/update.
What is the correct syntax to run an executable from this script?
Thx. Tag: New IE window Tag: 139774
Dazed and Confused....
Hi.
I'm using an Access 2002 DB and ASP. For the purposes of this post, the
simplied SQL statement in question is:
UPDATE dbtable SET status=" & xstat (xstat is yes/no)
The exact same code works just fine on at least a dozen different
servers in the US. It's part of a common function I use all the time.
I have a client in Brazil . When they run this code their server throws
an error...
Microsoft JET Database Engine erro '80040e10'
Nenhum valor foi fornecido para um ou mais parâmetros necessários.
(No value given for one or more necessary parameters)
BUT, I'm 100% certain that the field names and types are correct, and as
I said above, this code works fine on many servers in the US
If I hardcode: UPDATE dbtable SET status=True... it works fine.
If I hardcode:
xstat=True
SQLx="UPDATE dbtable SET status=" & xstat
response.write SQLx
The code fails with the error I mentioned... and the SQLx string looks
like: UPDATE dbtable SET status =Verdadeiro (which means True in
Brazilian)
Go figure. Any ideas what I must do to have the Engine/database
recognize the foreign language equivalent of True?
Tim
--
Posted via http://dbforums.com Tag: New IE window Tag: 139763
Delete A File Using VBScript?
I have a script (that I got from this group, thank you for this) that
creats an Excel file from my an SQL statement. The problem is if the file
already exists, it errors off. I would like to do just a 'blind' delete of
the file so the Create doesn't error off. Is there a way delete a file in
VBScript?
Thanks
Chris Tag: New IE window Tag: 139757
Multithreading with script control?
Hi all,
I am developing a multi-threaded server-application in VB. (How this? I am
using a C++ service that is instantiating VB-Objects on different
threads...)
I need to add scripting to my application. I am currently using the Script
Control. Are there any issues running this control (which is not placed on a
form but only created as an object instead) on several threads?
Is it possible to implement the IActiveScriptSite interface in VB? I could
not find a type library where this is defined.
Thanks very much for your help!
Matthias Moetje Tag: New IE window Tag: 139756
Insert a line into a Txt file
I want to be able to read a text file and find the line that reads:
"Domain"=""
Once found, I want to insert a line below it that reads: MTU=800
How do you write this in VB? Tag: New IE window Tag: 139746
Scripts for explorer and desktop settings?
Hello,
Does anyone know where i can find a script to set
Windows
Explorer>Tools>Folder Options> General Tab & View Tab to
select the following boxes:
General>Active Desktop>Use Windows classic desktop
General>Web View>Use Windows classic folders
General>Browse Folders>Open each folder in same window
General>Click Items as Follows>Single-click to open an
item/underline icon titles consistent with my browser
View>Files and Folders>
* Display compressed files and folders with alternate
color
* Display the full path in the address bar
* Display the full path in title bar
* Show Hidden files and folders
* Launch folder windows in a seperate process
* Show file attributes in detail view
In addition I'm looking for a script to set
* the auto arrange desktop icons option on/off
* "Show small icons in start menu" ?
* set the screen resolution to 800x600 with "True Color"
32bit
* display large font sizes from the display
properties>advanced tab
TIA
--
\\||//
(@@) Pardon the intrusion...
__ooO_()_Ooo_____________________________
_|_____|_____|_____|_____|_____|_____|___
___|_____|_____|_____|_____|_____|_____|_
_|_____|_____|_____|_____|_____|_____|___
.oooO Oooo.
( ) ( )
\ ( ) /
\_) (_/ Tag: New IE window Tag: 139745
Corporate Disclaimer
I started out trying to follow through a Microsoft Knowledge Base
article
317680 "How To: Add a disclaiamer to Outgoing SMTP Message in Visual
Bacic Script
I got it to work sending a test disclaimer. But I don't know how to
write a "Sample disclaimer added in VBScript."
This is from:
<SCRIPT LANGUAGE="VBScript">
Sub ISMTPOnArrival_OnArrival(ByVal Msg, EventStatus)
TextDisclaimer = vbCrLf & "DISCLAIMER:" & vbCrLf & "Sample Disclaimer
added in a VBScript."
HTMLDisclaimer = "<p></p><p>DISCLAIMER:<br>Sample Disclaimer added in
a VBScript."
If Msg.HTMLBody <> "" Then
'Search for the "</body>" tag and insert our discliamer
before that tag.
pos = InStr(1, Msg.HTMLBody, "</body>", vbTextCompare)
szPartI = Left(Msg.HTMLBody, pos - 1)
szPartII = Right(Msg.HTMLBody, Len(Msg.HTMLBody) - (pos - 1))
Msg.HTMLBody = szPartI + HTMLDisclaimer + szPartII
Msg.TextBody = Msg.TextBody & vbCrLf & TextDisclaimer &
vbCrLf
Else
Msg.TextBody = Msg.TextBody & vbCrLf & TextDisclaimer &
vbCrLf
End If
'Commit the content changes to the transport ADO Stream object.
Msg.DataSource.Save ' Commit the changes into the transport Stream
pEventStatus = cdoRunNextSink
End Sub
</SCRIPT>
I've started reading up on WSH and cscript but not making any specific
progress.
Just a lot of error messages. Any help or maybe the name of a good
beginner book would be great. Tag: New IE window Tag: 139736
validate what option is selected
How do u retrieve (for clientside validation)what option
is selected in a drop down list. I have spent all week
trying to find out. Why are all the code examples in my
script editor in jscript? Can i get a version that gives
its examples in vbscript? Could you also tell me the best
place to get axamples for vbscript because there arent any
at ms site.(If there is they didnt want anyone to find
them.) Tag: New IE window Tag: 139730
What was selected ?
<h5>The reason I've spent all weekend trying to find out
how to store what someone selects in this form is:</h5>
<select size="1" name="Reason" id="HelpMe" onchange
= "HelpMePlease">
<option>The code examples in the help files are not in
vbscript</option>
<option>Someone up there hates me</option>
<option>I really need to get a life</option>
</select>
<script language = "vbscript">
<!--
sub HelpMePlease
strAnswer = (insert your expert advice here)
msgbox strAnswer
end sub
-->
</script> Tag: New IE window Tag: 139729
Reading serial of CDROM remotely
Hi,
I am moving a cataloging application currently in VB6 to a web based ASP.NET
application. The first problem that I have though is how do I read the
serial number of the currently loaded CD remotely?
Any help would be appreciated.
Thanks,
John Tag: New IE window Tag: 139726
Loop
Hi,
When iterating through database, which loop statement is
the best?Because if i use "while...wend" it will give me
error when it reaches EOF and terminates with giving error
even if i use "While rs.eof=false" at the top of the
loop...any other better way...
"if...then..else" also doesnt help much...
TIA Tag: New IE window Tag: 139723
A script for formating hard drive
Is anyone knows the script for formating hard disk??? if it is, is
that can be run on Win2k Pro. and Win2k Ser. ???? Tag: New IE window Tag: 139715
Newbie ASP db question
Hi All,
I am learning database connectivity within ASP.
I have the following code but keep getting the error shown below.
--------------<snip>-------------------
Set dcnDB = Server.CreateObject("ADODB.Connection")
dcnDB.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
strDatabaseLocation dcnDB.Open
strSQL = "SELECT * FROM Current ORDER BY NewsItem"
Set rsQuery = dcnDB.Execute(strSQL)
Do While Not rsQuery.EOF
response.write rsQuery("NewsItem") & "<br>" & rsQuery("Source") &
"<br><br>"
Loop
--------------<end snip>----------------
Error Type:
(0x80004005)
Unspecified error
The error is with 'Set rsQuery = dcnDB.Execute(strSQL)'.
The database is a very simple Access 2000 file.
It has 4 tables; Current, Hold, National and International.
Each table has 2 fields. NewsItem and Source.
All the manuals I have say that it is right. Is there something special I
have to do with the Access database file in Access to make it compatible or
something?
Any help would be muchly appreciated.
Cheers, Bill. Tag: New IE window Tag: 139710
Deleting table rows at runtime
Hi,
I have a table that looks much like an inbox on most sites with the first
column having a checkbox and other columns containing data. I want to delete
those rows where the checkbox is checked at the client-side itself. I've
tried looping through the table body elements to check the state of each
checkbox but haven't been able to make it work. Anybody has any suggestions
how this would work?
Thanks,
Saranjit Tag: New IE window Tag: 139699
change select style
Hi
I need to change a <select style to multiple.
I know how to change it's style (document.FormName.SElectName.style=) but I
dont know how to change it to multiple .
Thanks Tag: New IE window Tag: 139693
error on Windows NT 4.0 server
I receive this error when trying to run a script on an NT 4.0 server:
ActiveX component can't create object: 'CDO.Message'
Is there an update I need to download and install on the server?
Here's my code:
sArgument = WScript.Arguments(0)
Set objEmail = CreateObject("CDO.Message")
objEmail.From = server@domain.com
objEmail.To = uuser@domain.com
objEmail.Subject = "my subject " & now()
objEmail.Textbody = "my text " & sArgument & " on " & now() & "."
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _
"nafepncsebe6.nr.ad.newellco.com"
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
Any help would be appreciated.
--
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 Tag: New IE window Tag: 139657
adrpt.vbs,adexport.vbs,adlogconvert.vbs
I need to get these sample scripts, supposed to be in site
server package however I cannot open any part of site
server to find these scripts. Any help would be
appreciated! Tag: New IE window Tag: 139655
Creating Exchange 5.5 Mailboxes via VBScript
I have this script that I will use to create mailboxes and so far it works
really well. The only problem I have is adding attributes like City, State,
Zip etc. Where can I find what Exchange directory calls them? For example
the LDAP attribute for Address field is actually postalAddress. I have full
access to the Exchange 5.5 server.
Another question is now when we create mailboxes through the Admin program
it creates an NS record for us. But the script does not do that. Any ideas
on how to do that through this script?
Here is the script:
'createmailbox.vbs
Const ADS_RIGHT_EXCH_MODIFY_USER_ATT = 2
Const ADS_RIGHT_EXCH_MAIL_SEND_AS = 8
Const ADS_RIGHT_EXCH_MAIL_RECEIVE_AS = 16
Const ADS_SID_WINNT_PATH = 5
Const ADS_SID_HEXSTRING = 1
Dim objMailbox, objContainer, strServer
Dim strAlias, strMTA, strMDB, strSMTPAddr, strDisplayName
Dim objSid, strSidHex, strComputer, strSite, strOrg
Dim objComputer, strUserID, strDomain
Dim objSec, objSD, objDACL, objAce
strServer = "SERVER"
strSite = "Site"
strDomain = "Domain"
strDisplayName = "Username"
strSMTPAddr = "user@rfsamericas.com"
strAlias = "Alias"
strUserID = "UserID" 'NT UserName
strAddress = "Address"
strCity = "City"
Set objComputer = GetObject("LDAP://" & strServer)
'get the organization
strOrg = objComputer.o
'get the recipients container for the site
Set objContainer = GetObject("LDAP://" & strServer & "/CN=Recipients,OU=" &
strSite & ",o=" & strOrg)
'get the SID for the account to be associated with the new mailbox
Set objSid = CreateObject("ADsSID")
objSid.SetAs ADS_SID_WINNT_PATH, "WinNT://" & strDomain & "/" & strUserID
strSidHex = objSid.GetAs(ADS_SID_HEXSTRING)
'create a new MailBox
Set objMailbox = objContainer.create("organizationalPerson", "cn=" &
strAlias)
'set display name and alias
objMailbox.Put "postalAddress", strAddress
objMailbox.Put "mailPreferenceOption", 0
objMailbox.Put "cn", strDisplayName
objMailbox.Put "uid", strAlias
objMailbox.Put "Home-MTA", _
"cn=Microsoft MTA,cn=" & strServer & ",cn=Servers,cn=Configuration,ou="
_
& strSite & ",o=" & strOrg
objMailbox.Put "Home-MDB", _
"cn=Microsoft Private MDB,cn=" & strServer & _
",cn=Servers,cn=Configuration,ou=" _
& strSite & ",o=" & strOrg
objMailbox.Put "MAPI-Recipient", True
'objMailbox.Put "rfc822Mailbox", strSMTPAddr
objMailbox.rfc822Mailbox = strSMTPAddr
objMailbox.Put "textEncodedORaddress", _
"c=US;a= ;p=" & strSite & ";o=" & strOrg & ";s=" & strAlias
objMailbox.textEncodedORaddress = _
"c=US;a= ;p=" & strSite & ";o=" & strOrg & ";s=" & strAlias
objMailbox.Put "Assoc-NT-Account", strSidHex
objMailbox.SetInfo
'create security objects
Set objSec = CreateObject("ADsSecurity")
Set objAce = CreateObject("AccessControlEntry")
Set objSD = objSec.GetSecurityDescriptor("LDAP://" & strServer & _
"/CN=Recipients,OU=" & strSite & ",o=" &
strOrg)
Set objDACL = objSD.DiscretionaryAcl
objAce.Trustee = strDomain & "\" & strUserID
objAce.AccessMask = ADS_RIGHT_EXCH_MODIFY_USER_ATT Or _
ADS_RIGHT_EXCH_MAIL_SEND_AS Or _
ADS_RIGHT_EXCH_MAIL_RECEIVE_AS
objAce.AceType = ADS_ACETYPE_ACCESS_ALLOWED
objDACL.AddAce objAce
objSD.DiscretionaryAcl = objDACL
objSec.SetSecurityDescriptor objSD Tag: New IE window Tag: 139654
Better / Difference JavaScript, VBScript - OT Discussion and observation
Is there just some things that JavaScript can do that VBScript cannot do ?
Vice versa?
Or are there some things that one is just flat out better for than the other
?
And within one web page, or asp page, can both be used and mixed or must a
page/asp page be one or the other.
I really dont want to take the time to learn both, since I am coding for
myself only, and I can usually tell by looking at code from either whats
going on.
Just wondering if one is better than the other, and if one will be
"unsupported" in any future time.
Thanks!
Jim Tag: New IE window Tag: 139647
how to pass a variable from closing WIndow
When one window is closing to opening another,
such as;
herf.location = "next.htm"
how to pass a variable to the next page from closing one.
Thanks in advance.
-----------------------------------------
Osamu Terao
Email: hag83950@ams.odn.ne.jp
----------------------------------------- Tag: New IE window Tag: 139635
Querying SSL expiry dates
Hi All,
Does anyone know a way of querying the certicate store to
return a list of expiry dates for the SSL certifcates held
within it? I am attempting to come up with a way of e-
mailing a warning a couple of weeks before a cert expires
but as yet have found little or no info on getting this
information.
I have found the blob entries in the registry for the
certs and when looking at the right column of the key you
can see the expiry dates listed, however how would you
convert a binary key from the registry to process the
info......
It's all a blurr....
Any help would be appreciated.
Many thanks, Aaron Tag: New IE window Tag: 139624
How do I do "For Each ... " minus one ?
How would you go about doing a For Each loop but only for all the
items in the array minus one ?
ie. (arrBasket is "Apple, Banana, Pear, Peach")
For Each varFruit In arrBasket
Msgbox varFruit
Next
So I want all the fruit apart from the Peach at the end...
cheers,
Steve
PS. I'm not doing a grocery script :¬) Tag: New IE window Tag: 139621
OE Newsgroups writing script question
This is a multi-part message in MIME format.
------=_NextPart_000_0026_01C3529B.532E0800
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Okay, maybe I really should be asking here and should be in an OE group =
or such. But I figure it makes the most sense since if anyone would =
know if would be fellow scripters.
When I type a script in OE for the newsgroups, when I type the =
following:
("\\servername\sharename"), OE automatically changes it to =
(\\servername\sharename)
so then I have to readd the beginning and end quote. Why is it doing =
that. How do I stop it. Sometimes I miss that it does it and it =
obviously messes up the script. It also does it when I do LDAP: etc. =
Any thought.=20
--=20
--=20
Regardless of whether my signature is long or short, I still welcome =
e-mails if you know my address but won't post it. But on the positive =
side, I don't try and impress by quoting others.
--=20
------=_NextPart_000_0026_01C3529B.532E0800
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>Okay, maybe I really should be asking =
here and=20
should be in an OE group or such. But I figure it makes the most =
sense=20
since if anyone would know if would be fellow scripters.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>When I type a script in OE for the =
newsgroups, when=20
I type the following:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>("<A=20
href=3D"file://\\servername\sharename">\\servername\sharename</A>"), OE=20
automatically changes it to (<A=20
href=3D"file://\\servername\sharename">\\servername\sharename</A>)</FONT>=
</DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>so then I have to readd the beginning =
and end=20
quote. Why is it doing that. How do I stop it. =
Sometimes I=20
miss that it does it and it obviously messes up the script. =
It also=20
does it when I do LDAP: etc. Any thought.</FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><BR>-- <BR>-- <BR>Regardless of whether =
my=20
signature is long or short, I still welcome e-mails if you know my =
address=20
but won't post it. But on the positive side, I don't try and =
impress by=20
quoting others.<BR>-- <BR></FONT></DIV></BODY></HTML>
------=_NextPart_000_0026_01C3529B.532E0800-- Tag: New IE window Tag: 139615
pass a variable
I know it's possible and probably very simple, but I'm not sure how to do
it.
I want to call a vbs file from a batch (.bat or .cmd) file and pass it a
simple 4 digit number to be used when setting the subject line of an e-mail
that the vbs file will send.
How do I go about doing this?
--
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 Tag: New IE window Tag: 139604
Copying
Hi,
I need a script, which you can copy a folder and subfolders and files from
the server to a client user everytime, when he connect to the network or log
on or log off. Could you please help? Thank you very much!!!!!
Luciano Tag: New IE window Tag: 139595
Determine Printer Port Description
I have a server that has IP printers installed on it, along with LPT,
serial etc. I would like a programmatic to determine what the port
type each printer is using.
For example, if I open up the printer properties of a printer and
click on the ports tab, I see all installed ports with a port
description. I was wondering if there was a programmatic way to
determine that description. Tag: New IE window Tag: 139593
Table
Hi,
I am reading data frm database and looking fw to display
them in a table(not in html <table>) but sth like grid..so
that i could identify the column header uniquly to insert
the data to the "location" tht i want...
i idea?or excellent resource that i can refer to?
TIA Tag: New IE window Tag: 139587
Howto: Run startup script once
Hi
How do I run a startup script just one time. If I use the RunOnce registry
key I'm required to login (which I'm not interested in). Is there another
reg key that I can use ?
Regards,
Jesper Tag: New IE window Tag: 139584
Internet / Intranet
Hello,
We are creating a favourites list for users of our INTRANET. In this regard
we should be able to distinguish if anyone is adding an intranet / internet
site since we cannot monitor internet sites.
Does anyone have any ideas how we can find out if a URL from IE is an
intranet address or an Internet address without using any configuration
files ?
Any help is appreciated.
regards,
Pratibha Tag: New IE window Tag: 139576
Formatting columns in spreadsheet object
Formatting columns in spreadsheet object
Hi,
Appended is a simple spreadsheet object I am creating in
classic asp.
I would like to make the spreadsheet appear more
attractive on the we page.
Now, I'm sure I can format the columns to make the
spreadsheet look pretty but I am having great difficulty
finding documentation that I can understand*.
What I am looking for is instruction on how to do simple
things lik emake column "I" appear as a date, how to make
the spreadsheet autosize itself when the page loads so
that the user does not have to drag the spreadsheet's
corner, how to make column "D" appear as currency, how to
make the columns align right, left, or center. Simple
things like that.
Can someone point me in the right direction?
Thanks,
--Terry
***
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="-//W3C//DTD HTML 4.0//EN">
<body onload="fnLoadData()">
<object id="Spreadsheet1" classid="CLSID:0002E510-0000-
0000-C000-000000000046">
</object>
</body>
<script language=VBScript>
Sub fnLoadData()
With Spreadsheet1
.Cells.Clear
.TitleBar.Caption = "Filter Inventory View"
.DataType = "HTMLURL"
.HTMLURL = "FilterInventoryResultSet.asp?RoomID=<%
=intRoomID%>"
.Range("A:K").AutoFitColumns
.Range("A:K").AutoFilter
.Range("A1:K1").Font.Bold = True
End With
End Sub
</script>
</html>
*For instance, I have been plowing through msdn articles
(like http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/vbaxl10/html/xlprofiltermode.asp ) and
going around in circles never finding just what I need.
To reply directly replace msdn . com with msn .com. Tag: New IE window Tag: 139573
Having trouble either writing to a file or opening file.
I created this script. Before I had a problem assigning the variable gpgcmd
but someone on this board helped me with this. Now I get the right value in
my variable but my program (gpg) is having a problem writing to the file
outfile with the filename being tempname2.
Any help wold be appreciated. Below is a sample of my script.
' create a unique temp file name
Set tempFso = CreateObject("Scripting.FileSystemObject")
tempname = tempFso.GetTempName
Set tempFso = Nothing
Set temp2Fso = CreateObject("Scripting.FileSystemObject")
tempname2 = temp2Fso.GetTempName
Set temp2Fso = Nothing
'Create Text File and give it temp name
SET objFso = CreateObject ("Scripting.FileSystemObject")
set infile = objFso.CreateTextFile(tempname, 8, true)
'Create Text File and give it temp name
SET obj2Fso = CreateObject ("Scripting.FileSystemObject")
set outfile = obj2Fso.CreateTextFile(tempname2, 8, true)
infile.write "Place Text Here"
infile.close
gpgcmd = "c:\\gnupg\\gpg -a -r UserName --encrypt -o " & tempname2 & " " &
tempname
set wshShell = CreateObject("WScript.Shell")
wshShell.Run gpgcmd ,1,false
set wshShell=Nothing Tag: New IE window Tag: 139555
Hello,
Is there a way to, on a dblClick event, open a new I.E.
window and display contents. I also want to control the
size of the window.
Brandon wrote:
> Is there a way to, on a dblClick event, open a new I.E.
> window and display contents. I also want to control the
> size of the window.