List and remap shares
Well, batch has failed me, Perl will work but the users don't have it
installed. So my next step is vbscript, but I don't see it done.
What I need to do:
First: prompt a user for his userid and password assigned to him for a
remote file server.
Second: Given a few alternative names for the server, get a list of all
drive letters mapped to network shares on a server and the share they
point to. For example, for ServerX.saplings.us they may have
x: \\serverx.saplings.us\sharex
y: \\serverx\sharey
w: \\127.0.0.1\sharew
They could be using a short name, the full name, or the ip address. So
I will hardcode all 3 values in my script.
Thirdly, go through and disconnect all those shares.
Lastly, go through and reconnect each share, but this time use the
server name I designate(so I can get them all pointing to the same name)
and the userid and password he specified(so we can avoid having a bad
password stored with one of those shares, technically not possible but
it seems it is anyway)
I checked the script repository and didn't see anything, so figured I'd
post here before hacking on it myself. Tag: Error Handling... Tag: 181861
extracting text from a .htm document
I am a very experienced user of VBA but I know virtually nothing of
windows programming or file scripting (although I do understand the
basic filesystemobject commands). I'm using the help files in VBA
for OpenAsTextStream, but it isn't working.
I have over 500 .htm files from which I would like to extract the
text either into text files or into string variables so that I can do
further processing. This will save me the trouble of having to open
each of the htm files and save each as a text file manually. [Note
that if there is a better way to accomplish the above than the
OpenAsTextStream method, PLEASE let me know. ]
But when I try to use OpenAsTextStream, my problem is that I try to
use the following code from the VBA help file to extract the text and
put the text into a text file, but I get an error:
Dim f, fs, g, h, ts, j
Dim str2 As String
Const ForReading = 1, ForWriting = 2, ForAppending = 3 Const
TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Set fs = CreateObject("Scripting.FileSystemObject")
fs.CreateTextFile "c:\testfile.txt"
Set f = fs.getfile("c:\testfile.txt")
Set ts = f.OpenAsTextStream(ForWriting, TristateUseDefault)
str2 = "\\OurNetworkedDell\C\MyMainFolder\ASpecificFile.htm"
Set g = fs.getfile(str2)
Set h = g.OpenAsTextStream(ForReading, TristateUseDefault)
j = h.readall [this command gives an error]
How do I get from the command OpenAsTextStream to extract the text in g
and "write" it into f which is the text file "c:\testfile.txt"
Thank you!!!!! Tag: Error Handling... Tag: 181860
connection to ad
Hi,
how can I connect to AD when I just have a domain and a user id? Up to
now I have just found examples where everything is known, like cn, dn,
etc. But as I just mentioned I just know the domain and a user id. With
RootDSE and DefaultNamingContext I can find out the full domain, but it
seems that I have to know cn, too (and in some examples I can provide a
ldap server name. So I'm a bit confused how to correctly connect to AD).
Can anybody give me a hint on that, or recommend me a goog tutorial (I
haven't found anything really explaining on that at msdn or google, as
most examples are for asp.net and I have to use vbscript)
Thanks in advance.
Best regards,
Andi Tag: Error Handling... Tag: 181857
Registry error
Hello,
I have an Access database on a website, records of which display in a
table in an .asp page.
I have a form to add records that works fine, both on my localhost and
on the ISP's server.
However, I have this .asp page to display database records from which to
choose one to update. It replaces the "ID" field with a radio button,
which when selected takes the user to another form to amend the record.
------------------------------------------------------------------------
<%
Dim Conn, Rs, sql
Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("results.mdb")
sql= "SELECT * FROM tbl2005 order by date1;"
Rs.Open sql, Conn
Response.Write "<FORM name='Update' method='post' action='update_form.asp'>"
Response.Write "<table border=0 cellspacing=1 cellpadding=1 bgcolor=white>"
Response.Write "<tr>"&"<th colspan='2' align='left'
bgcolor=#dec45a>"&"Date"&"</th>"&"<th
bgcolor=#dec45a>"&"Day"&"</th>"&"<th
bgcolor=#b0e0e6>"&"Event"&"</th>"&"<th bgcolor=#9fcf8b>"&"A
Grade"&"</th>"&"<th bgcolor=#a0a0a4>"&"B Grade"&"</th>"&"<th
bgcolor=#8ac5ff>"&"C Grade"&"</th>"&"<th
bgcolor=#dec45a>"&"NTP"&"</th>"&"</tr>"
if NOT Rs.EOF then
Do While not Rs.EOF
Response.Write ("<tr>")
Response.Write ("<td bgcolor=#ffffbf>"&"<input type='radio' name='ID'
value="&Rs("ID")&">"&"</td>")
Response.Write ("<td bgcolor=#ffffbf>"&Rs("date1")&"</td>")
Response.Write ("<td bgcolor=#ffffbf>"&Rs("day")&"</td>")
Response.Write ("<td bgcolor=#ddf4ff>"&Rs("event1")&"</td>")
Response.Write ("<td bgcolor=#cce6cd>"&Rs("Agrade")&"</td>")
Response.Write ("<td bgcolor=#f0f0f0>"&Rs("Bgrade")&"</td>")
Response.Write ("<td bgcolor=#bbe9ff>"&Rs("Cgrade")&"</td>")
Response.Write ("<td bgcolor=#ffffbf>"&Rs("NTP")&"</td>")
Response.Write ("</tr>")
Rs.MoveNext
Loop
else
Response.Write("No records found")
end if
Response.Write("<tr>"&"<td colspan='3' align='left'>"&"<input type
='submit' name='submit' value='Select competition' >"&"</td>"&"</tr>")
Response.Write "</table>"
Rs.Close
Set Rs = Nothing
Set Conn = Nothing
%>
-------------------------------------------------------------------------
This script works OK on my localhost, but when I try it on my ISP's
server, it gives the following error message:
"Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver]General error Unable to open
registry key 'Temporary (volatile) Jet DSN for process 0x9cc Thread
0x740 DBC 0x9e5ce3c Jet'.
select_update.asp, line 25"
Is there a problem with the vbscript (something I can alter to fix), or
is this a problem with the ISP's server and registry access?
--
Cheers
Colin Wilson
------------------------------------------------------------------
Trentham Golf Club: http://www.trenthamgolf.com
------------------------------------------------------------------ Tag: Error Handling... Tag: 181854
Help with parsing string
Hi all,
Hope someone can help me with this..I have a string that I'm capturing using
the StdOut.ReadAll method, problem is the string contains two lines and I
only need the value example below - 4,708 and 425.3 "not MB":
Estimated number is: 4,708
Estimated size is is : 425.3MB
I've used the code below to get the first value but it also returns the
bottom part of the string. Do I need to use the Split function?
Code:
i = InStrRev(strLogOut, "is:")
strValb = "Value = " & Mid(strLogOut, i + 3)
WScript.Echo strValb
Ouput:
Value = 4,708
Estimated size is : 425.3MB
Thanks in advance.
-Sip Tag: Error Handling... Tag: 181853
HTA Help
Good evening,
1st off, I wasn't sure where to post HTA question, if this is complete the
wrong forum could someone please redirect me to a more appropriate one.
2nd and the question - I was wondering if someone could show me a sample HTA
which uses radio buttons to control what is displayed in another part of the
HTA. I have created a simple HTA which is split into 4 sections - Header,
Footer, right and left. In the Left section is a series of radio buttons. I
would like to be able to control the Right section based on what the user
selects in the Left section. For instance, if the use selects the 1st radio
button I would like a teaxt box to appear so they can enter a value and a
button to run a script...
Could someone either give me a sample script to learn from or direct me to a
webpage that can educate me on this subject.
Thank you very much.
Daniel Tag: Error Handling... Tag: 181848
wmi - filtering auditing entries to text file
Hi,
I am trying to collect logs using wmi of auditing entries in the event
viewer of domain controllers.
I noticed that the security auditing correctly logs the GUID of the
policy being modified; unfortunately when I collect it using wmi this
name, and others, are lost and replaced by different value like
%{bf967a76-0de6-11d0-a285-00aa003049e2}.
How do I retain these important information ? Can I use any other tools
?
Thanks and Regards Tag: Error Handling... Tag: 181844
Referencing Shell.Application in a wsf script
Hello,
I tried to poke around a bit with "Shell.Application". Because of the
possibility to include typelib informations with the reference tag, I
created a wsf-script with this content:
<?xml version="1.0" encoding="windows-1252" ?>
<package>
<job>
<reference object="Shell.Application"/>
<script language="vbscript">
<![CDATA[
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder(0, "Example", 0, ssfPERSONAL)
]]>
</script>
</job>
</package>
But this didn't worked. The error was something like "reference from
{50a7e9b0-70ef-11d1-b75a-00a0c90564fe} could not be included". (The
message was in german so I have to translate). The problem was solved
with the line
<reference guid="{50a7e9b0-70ef-11d1-b75a-00a0c90564fe}"/>
instead of the orginal line. Why did the reference tag with the
object-attribute not work?
Regards,
Tobias Tag: Error Handling... Tag: 181842
ASP Page moved to IIS 6.0 no longer works
I'm in the process of moving an application from IIS under Windows 2000 to a
new server running Windows 2003 and IIS 6.0. One of the pages uses the
wshell.script object to execute a batch file that executes ftp commands from
a text file.
This one page no longer works. I have tweaked the permissions for the asp
page, batch file, cmd.exe and ftp.exe so that I no longer get permission
denied errors. The page is served with a result code of 200 but simply does
nothing.
The batch file doesn't appear to contain any errors as I can execute it from
a command prompt with no problem. It produces output which is just ignored on
the old server.
Heres the relevent ASP code:
Dim oScript
Set oScript = Server.CreateObject("WSCRIPT.SHELL")
oScript.Run "c:\progra~1\dqcomp~1\dqvista\users\shared\PDI\ftpfaxflag.bat"
I've also tried the following:
' Call oScript.Run ("ftp.exe -s:" & Server.Mappath("ftpcmds.txt")
Here's the batch file:
ftp -s:c:\progra~1\dqcomp~1\dqvista\users\shared\pdi\ftpcmds.txt
Here's the ftpcmds.txt file:
open <mainframe name>
<usercode>
<password>
cd <mainframe directory>
lcd \progra~1\dqcomp~1\dqvista\users\shared\pdi
put faxflag.txt FLAGTEST
quit
Any help will be greatly appreciated. Tag: Error Handling... Tag: 181840
Check Reg script
Any one an example of a script that I can attach in GPO Login to check if
the value exists in the registry if = yes then go to next procedure if=no
then run the particular setup.exe file.
Thanks. Tag: Error Handling... Tag: 181838
automate profile swop: roaming to local
sorry to trouble you all again but you don't happen to know how to automate
the change that you can do to peoples profiles: swopping them from roaming to
local.
For example: in system if you click the user profile tab you can change the
type to local from roaming for the domain users
What I need to do is, maybe in group policies automate this for all domain
user instead of doing one by one.
reason their taking for every to load across the link
I've tried console root>local computer policy>computer
configuration>Administrative template>system>user profile
and then clicking on 'only allow local user profiles'
but this block my users logon scripts - which is no good
any ideas? Tag: Error Handling... Tag: 181837
Conditional Window Close
Hello,
I would like to have a script that closes a specific window if it
opens. I'm able to easily do this in Winbatch as well as Autoit, but
can't seam to figure it out in VBScript.
Anyone have any ideas on how to do this?
Thanks in advance for your assistance!
-=Paraleptropy=-
http://www.neflyfishing.net
0 Limit,Catch -n- Release
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =---- Tag: Error Handling... Tag: 181826
number formatting
I have a field returned from a query. This field will either be a number or
a string, the string will be a code that explains why there is no number. I
use a function to sort that out (see bottom of this post)
Now I have a number 94.8892254 in str
If I run FormatNumberIfNumeric(str) I get "95" I should get "95.00". How
do I fix this?
Thanks
MIke
Function FormatNumberIfNumeric(str)
If Isnumeric(str) then
FormatNumberIfNumeric = FormatNumber(str, 2, -1, 0, 0)
Else
If str = "" or ISNull(str) then
FormatNumberIfNumeric = "<b>???</b> "
Else
FormatNumberIfNumeric = str & "boo"
End If
End If
End Function Tag: Error Handling... Tag: 181823
RDP logn script override?
Firstly greetings everyone,
I've got a slight problem:
scenario:
I've got 2 sites using 1 SBS box for logon authentication rights to the
domain.
1 site has 1 set of scripts allowing them to access the drives in their
building and the same for the users in the other building.
My problem is that when the users logon to the RDP boxes I have setup for
them to access data in the opposite site they take their logon scrip with
them which of cause scripts the completely inappropriate drives.
has anyone found a solution for this problem?
thank you in advance
OSL Tag: Error Handling... Tag: 181821
removing non network printers from a computer
Hi.
We have a small script that we run on cumputers that log in to the
domain, the script deletes all printers and then addes a few.
We have a slight problem with the deletion of printers.
When the printer is not a network printer, the script will stop with the
error (here for the printer "Microsoft Office Document Image Writer":
Script: c:\thescript.vbs
Row: X
Col: Y
Error: This network connection
Code: 800708CA
Source: WSHNetwork.RemoveNetworkDrive
The script looks like this and the row that generates the error is the
one marked with "*".
' Begin removing all installed network printers
Set clPrinters = objWshNetwork.EnumPrinterConnections
For i = 0 to clPrinters.Count - 1 Step 2
'wscript.echo clPrinters.Item(i+1) + " deleted."
* objWshNetwork.RemovePrinterConnection clPrinters.Item(i+1), true, true
Next
Any suggestions on how to avoid removing non network drives?
/kb Tag: Error Handling... Tag: 181819
IE Favorites Rediection
I need a script to redirect a users IE Favorites to a central location on a
file server. Just as we have the option to redirect a users My Documents,
Desktop and Apllication Data folder from his profile.
I need the script desperately. Tag: Error Handling... Tag: 181818
Event log SQL query problem
Hi all,
I have a problem using a select statement when querying event logs. I use
the following statement:
------
Set colLoggedEvents = objWMIService.ExecQuery _
("Select * from Win32_NTLogEvent Where (LogFile = 'Security' And
EventType = '5')" & _
"Or (LogFile = 'System' And EventType = '1')")
------
When executing I only get entries from the Security event log.
Before I tried this statement:
------
Set colLoggedEvents = objWMIService.ExecQuery _
("Select * from Win32_NTLogEvent Where (EventType = 1 Or EventType =
5)")
------
When executing that one I only receive entries from the Application log,
which is - I guess - the first one that is analyzed by the script.
So please could someone tell me if and how I could get entries from multiple
event logs with one query?
TIA,
The Kirschi Tag: Error Handling... Tag: 181816
File Not Found Error - UNC?
Afternoon,
I am working through getting a script to grab a file name and the date
it was last modified and am not having any luck with the UNC it would
appear. The script is below and it is erroring on the line below:
Set DatZipFile = fso.GetFile(DatFilePath + Text)
If I msgbox (DatFilePath + Text) the path is correct. I have tried
using the files collection method but I can't properly filter for the
file im looking for. Any help would be greatly appreciated
Cheers
Rob.
-----------------------------------------------------------------------------
set shell = createobject("wscript.shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")
const DatFilePath="\\server\c$\Program
Files\McAfee\ePO\3.0.1\DB\Software\"
set TheArgs = WScript.Arguments
NetworkD = TheArgs.Item(0)
NetworkDrive = NetworkD + ":"
WshNetwork.MapNetworkDrive NetworkDrive,"\\server\c$"
cmd = "%comspec% /c dir dat-*.zip /b | sort"
shell.currentdirectory = NetworkDrive + "\Program
Files\McAfee\ePO\3.0.1\DB\Software\"
set dir = shell.exec(cmd)
text = ""
do while true
if not dir.stdout.atendofstream then
text = text & dir.stdout.readall
end if
if dir.status = 1 then exit do
wscript.sleep 100
loop
WshNetwork.RemoveNetworkDrive (NetworkDrive),true
set shell = Nothing
set WshNetwork = Nothing
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Set DatZipFile = fso.GetFile(DatFilePath + Text)
Modified = DatZipFile.DateLastModified
------------------------------------------------------------------------------ Tag: Error Handling... Tag: 181815
include folder prior to a folder in a vbscript
I'm loving this Mp3Playlister_multiList vbs script. (
http://www.interclasse.com/scripts/Mp3Playlister_multiList.php) It
creates playlists recursively, but I have one request. Since I have
my mp3's arranged by c:\Artist\Album, the script saves as Album.m3u.
Could someone help modify it for me to save as Artist - Album.m3u.
I'm thinking that it would be modified here...
Sub createAndSavePlaylist(arrFiles, foldName)
Dim txt, txtFile, txtPath
'-- m3u file path
txtPath = dicPlaylistsPath.item(sScannedFoldName) & foldName &"."&
sPlaylistExt
'-- create m3u file (ASCII)
If Not fso.FileExists(txtPath) Then
Set txtFile = fso.CreateTextFile(txtPath,true,false) 'ASCII !!
End If
Set txtFile = fso.GetFile(txtPath)
Set txt = txtFile.OpenAsTextStream(ForWriting, 0) 'ForWriting , 0 for
ASCII (-1 for Unicode)
'-- write m3u entries
txt.write Join(arrFiles, vbCrLf)
txt.close
Set txtFile = nothing
End Sub
I'd greatly appreciate it. thanks, James Tag: Error Handling... Tag: 181809
vb script for click a button on a open program window
I am really new to vbscript, I have a program that loads when my
computer starts up. After windows has loaded, the program has a form
that has two buttons on it. One is "Hide" the other is "Close Program".
I would like to write a vb script that ran at startup as well and would
automatically click the "Hide" button on this program when it loaded. I
am first just trying to write the vbscript for clicking the Hide button
on the open form. then I will figure the adding it to the start up. If
anyone new of any examples that would help me or could provide some
general code I would greatly appreciate it. Tag: Error Handling... Tag: 181807
Moving VBScript to HTML or HTA
<lenghty post>
Hi all!
I have a VBScript that I'm using to set my computer up to wake me up in the
morning - basically an excuse to teach myself some basic scripting. Here's
the meat of the script:
"""""""""""""""""""""""""""""""""""""""
Dim objShell, objFSO, objTSOut, strDay, strMonth, strYear, strHour,
strMinute, strNow
strDay = InputBox("Enter day of month")
strMonth = InputBox("Enter the month")
strYear = InputBox("Enter the year")
strHour = InputBox("Hour")
strMinute = InputBox("Minute?")
strNow = Date
Set objShell = WScript.CreateObject("WScript.Shell")
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
Set objTSOut = objFSO.CreateTextFile ("C:\Batch\SetAlarm.cmd",true)
objTSOut.WriteLine "Schtasks.exe /Create /S COMPUTER /RU user /RP password
/SC ONCE /SD " _
& strYear & "/" & strMonth & "/" & strDay & " /TN WakeUpCall_" & strNow & "
/TR C:\Batch\ScheduledWakeupCall.vbs /ST " & strHour & ":" & strMinute &
":00"
objTSOut.Close
objShell.Run "C:\Batch\SetAlarm.cmd"
"""""""""""""""""""""""""""""""""""""""""""""""
So, it's actually a script that collcts info and creates a cmd file that
uses the 'Schtasks.exe' command to set up a scheduled task in Windows. The
task it schedules is in this case script that starts Media Player with a
specific playlist - a pretty nice way to wake up in the morning. :-)
Now, I would like to move this to a HTML or HTA file, just to see how it
works, and to get a nicer user interface. What I'm after is: how to get user
input from radio buttons, drop down boxes and so on, instead of the input
boxes I get with a vbs file. I have no clue how to capture the input from
forms, so I'm flying blind here and need some help. Any ideas??
TIA,
Örjan
</lengthy post> Tag: Error Handling... Tag: 181806
After Update/ on change
Hi
currently i am developing a few data access pages to enable users to enter
data from an intranet.
i am more than confortable in developin access databases but have only
recently touvhed upon DAP. I can program with access using VBA.
What i would like to do is the following:
a) When the record has been saved successfully to be able to display an
message box. I have been using VBScript and the function MsgBox, but nothing
appears, this has been used in the event After Update on the MSODSC object.
Any body know how to do this?
b) The Save button i would like to be disabled unitl a user makes changes or
creates a new record. i am presuming that i would be using the onchange
event, how could i do this?
many thanks
D Tag: Error Handling... Tag: 181802
FSO
Can i retrieve the file owner name by FSO?
i wish to show it at my asp page.
the page shows the files list in a folder.
Thanks.
tony Tag: Error Handling... Tag: 181794
Writing and debugging VBS
Hi everyone
I've used the Visual Basic Editor in Word and Excel 2003 and have decided to
delve into VBS. I've managed to copy script samples from various sites,
paste them into Notepad and save the file with a .vbs extension. Needless
to say, the samples do what they're supposed to but, if I modify the code to
do something slightly different, it either works or it doesn't. If it
doesn't, an error messagebox is displayed which gives an idication of where
the error is.
I wonder if there's any software available to allow me to step through the
VBS and identify exactly what's happening as it runs, just as I can with the
VB editors in Word and Excel. I don't know if there's anything on my laptop
already (XP Pro SP2) or if I'd need third party software. Whilst experts
here are just that, I'd find it hard to believe that they can just generate
a perfect piece of complicated code out of thin air or debug it, almost as
if it's running in their heads!
Thanks for your time and patience. Tag: Error Handling... Tag: 181791
Adding old domain user to Local Admins group
Hey folks,
I wonder if anyone knows of a script to do the following:
After migrating a workstation from an NT to an AD domain, I want to read
which old-domain-users are members of the Local Admins group and add their
new-domain accounts into that group.
Been looking for ages and haven't found anything yet.
Thanks and best regards,
Ferg. Tag: Error Handling... Tag: 181789
Adding old domain user to Local Admins group
Hey folks,
I wonder if anyone knows of a script to do the following:
After migrating a workstation from an NT to an AD domain, I want to read
which old-domain-users are members of the Local Admins group and add their
new-domain accounts into that group.
Been looking for ages and haven't found anything yet.
Thanks and best regards,
Ferg. Tag: Error Handling... Tag: 181788
Run method in ASP - app hidden....
Hi all!
I'm trying to move a VBScript to ASP. One of the problems I'm having is when
using the run method. I don'tr seem to be having any syntax or permission
errors, but the app I'm trying to run from the asp page isn't visible. I
thought the code failed all together, but when opening task manager, I can
se that the app is indeed running (under the 'IWAM_computername' account),
only it's not visible. Any ideas what I'm doing wrong? I'm running the app
like this in the asp page:
<%Set objShell = Server.CreateObject("WScript.Shell")%>
<%objShell.Run "notepad.exe", 3%>
I've tried different values for 'window style', but it doesn't seem to
matter. I done quite a bit of scripting using VBScript, but am totally new
to using it in asp.
Any input appreciated!
TIA,
Örjan Tag: Error Handling... Tag: 181780
Error when using CreateObject in client side VBScript.
Hi there
Apologies if this is not quite the correct group but I am having trouble
trying to create various objects using the VBScript CreateObject function
inside a client side HTML page. The following is the complete code of a test
page that I put together.
'===============================================
<html><head><title>Test CreateObject</title>
<script language=VBScript>
Dim objNetwork
On Error Resume Next
Err.Clear
Set objNetwork = CreateObject("WScript.Network")
If Err.Number <> 0 Then
MsgBox Err.Description
Else
MsgBox objNetwork.UserDomain
End If
Set objNetwork = Nothing
</script></head><body>
This is a test
</body></html>
'===============================================
Whenever I open this page, the CreateObject function errors and the
displayed error message is "ActiveX component can't create object". I have
tried creating various other ActiveX objects (eg Excel.Application) but
still get the same error. I know that this code is the correct syntax etc
because I have run it successfully in a VBS file (without the HTML
obviously).
I have tested the code on three machines with the following specs. All
display the same error message.
1. WinXP, SP2, IE6.0.2900
2. WinXP, SP1, IE6.0.2800
3. Win2k, SP4, IE6.0.2800
I've had a look at IE's security settings and found no problems there. Had a
look at the Local Security Policy but also found nothing. I've also had a
bit of a poke around on the internet and couldn't find anything significant
that would indicate what the problem could be.
If anyone could help me out on this, it will be greatly appreciated.
Regards
David Tag: Error Handling... Tag: 181777
vbs script for Excel to color rows
I was wonder if someone would mind writting me a small script to help me
out. I have a HUGE spreadsheet that has one colum which is numbered
sequentially, but any number may be repeated 2 or mor times. There are
many other colums which contain data, so this will help with readability.
Example:
1
1
1
2
2
3
3
3
3
4
4
5
5
5
5
I want to color each *row* (not the cell, but the whole row) of the same
number the same color. Here is my "program logic" in psudeo-code
Rowcolor = 1
Currentcontents = value of current cell
Nextcontents = value of current cell
Do while value of current cell is not blank
If nextcontents = currentcontents then
Set row color = rowcolor
Move down one cell
Nextcontents = value of current cell
Else
Rowcolor = rowcolor + 1
Currentcontents = nextcontents
End if
End Do
I'm sure this is very simple for those who know vbs - I just don't and
can't find anyother way to accomplish this. Doing it manually would
take FOREVER as the spreadsheet has over 30,000 rows.
Thanks very much to anyone will to help out!!!
Mike Tag: Error Handling... Tag: 181772
Item Cannot be Found in Collection
For over 3 years I have used the same Question and Answer Web Page without
any changes to the page or Access Database.
Three weeks ago I started getting the Item Cannot be Found in Collection
halt after I did a Microsoft update.
The Record has 47 fields that are updated for test surveys by the activities
educators in our school district. 33 Fields are Long Integer, 13 are Byte
Fields and one a Text Field.
Does anyone know what was changed that would all of a sudden give me this
halt.
Thanks for the help in advance!
Granny Tag: Error Handling... Tag: 181768
VB script, batch, or C++ for text file creation program
Hello all. I'm trying to compile a text file from two different
existing text files and input from the user.
For example:
text1.txt says "It was the best of times it was the worst of times."
text2.txt says "To be or not to be that is the question."
When the program is run, a prompt would ask the user to write a
sentence.
The program would then create a new file named text3.txt that would
create a text file that would read:
It was the best of times it was the worst of times.
Now is the winter of our discontent <or whatever the user enters at a
prompt>
To be or not to be that is the question.
I'm trying to decide the best vehicle to use to write this program. It
doesn't matter to me if its run in a GUI environment or from the
console. I'm rusty with my file manipulations in C++, which is the
language I'm most familar with. Neither batch nor vbscript look overly
difficult to pick up and I would like to use either of them if they
lend themselves better to the task at hand.
What do all of you think?
Thanks a lot for the advice Tag: Error Handling... Tag: 181767
WMI - Filter auditing categories
Hi,
I'm not able to find the IDs that map to the various Auditing
categories. As you know WMI uses these IDs to filter on the category
but where do I find these IDs. I know that for example Account
Management uses ID 7, what about other categories ? To be more specific
I need the ID for Directory Service Access.
Thanks and Regards Tag: Error Handling... Tag: 181762
Write back to AD script.
Is there a script that will display Full Users name and Telephone number and
ask user to change the number if not correct and write back to AD. Tag: Error Handling... Tag: 181760
Page not able to display
Dear Experts,
I am trying to link one of my menu to a login screen of my program. After I
create the hyperlink to open the page which is a login page, instead of the
login page display in the window, the entire code is being displayed. I have
checked with the previous code which I don't find difference.
Below is my code:
<table border=0 cellpadding='1' cellspacing=1 width="150"><tr><td width='16'>
<font size="3" face="Times New Roman"><img src='text.gif' width='16'
height='16' hspace='0' vspace='0' border='0'></font></td><td>
<font face="Times New Roman" size="3">
<a target="master" href="Leave_system/applyforleave.asp">Leave
Application</a></font></td></tr></table>
However, when I use CTRL+ click the link in Design mode, the page does
display on the Preview pane. How could or may be the problem to this issue?
Thank you very much.
Regards,
Seok Bee Tag: Error Handling... Tag: 181758
navigating a child window in IE
Hi,
I have some info that needs to be uploaded to a vendor's web app every
day, which I'd like to automate this. I am a vbscript newbie. I'm
running into problems when I click on a link which pops up another
window. It seems like the commands I issue afterwards are still going
to the original window. How do I get the script to operate on the
child window?
Set oMSIE = CreateObject("InternetExplorer.Application")
oMSIE.navigate "http://www.myvendor.com"
oMSIE.visible=1
Do Until oMSIE.ReadyState = 4 wscript.sleep 10 : Loop
Set oIEDoc = oMSIE.Document
oIEDoc.links(4).click
' (Child window comes up here and I want commands after this point
' to be directed to it.)
Do Until oMSIE.ReadyState = 4 wscript.sleep 10 : Loop
oIEDoc.getElementById("textUpload").value = "123456789"
Thanks! Tag: Error Handling... Tag: 181754
Determine exchange server name
Hi Group,
I am using a small script which uses the CDO.message object to send emails.
The server name is configured by "server.domain.com".
However, for security considerations, it appears that the exchange
administrator regularly changes the name and/or IP of the exchange server.
Our outlook 2003 client doesn't seem to have a problem with this as the
server name is automatically updated in the Outlook Profile.
However, my scripts fail and I was wondering how Outlook was determining
what was the new location of exchange server on the network. Is there a
script for doing that?
TIA Tag: Error Handling... Tag: 181752
Implement a read-only class memeber as a Function or a Property?
Hi,
Where does one draw the line between Property Get and Function? They both
do exactly the same thing, do they not?
When should I use Property Get, and when should I use Function?
Jamie Tag: Error Handling... Tag: 181744
Running a logon script under another account
Does anyone know how to run a .vbs logon script under a different account
than the account that's logging in? The reason I need to do this is that
the script installs a software package if it's not already installed on the
machine that the user is logging onto. The Active Directory Group Policy
restricts software installation to domain administrators, so I wanted to run
this script with elevated priviledges to get around this restriction imposed
by the Group Policy. Has anyone effectively dealt with a similar issue?
Some background info:
--All client machines are Windows XP Pro
--Main AD Server (Global Catalog) is 2003. Other domain controllers are
2003 and 2000 Tag: Error Handling... Tag: 181741
Convert SAM to DN with input/output files
All-
I am trying to add on to a small script I saw posted by Richard
Mueller (www.rlmueller.net).
His script takes the current logged on user's logon name and
determines and displays the DN.
I am attempting instead to have the script read a list of logon names
(sam account names) and go out and determine the DN for each. Output
to be written to a results text file.
I am getting a type mismatch error and I can see the problem is
related to strNTName but I'm not sure how to correct it.
Here is Richard's script (this one works):
Set objNetwork = CreateObject("Wscript.Network")
strNTName = objNetwork.UserName
' Determine DNS domain name from RootDSE object.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
' Use the NameTranslate object to find the NetBIOS domain name from
the
' DNS domain name.
Set objTrans = CreateObject("NameTranslate")
objTrans.Init 3, strDNSDomain
objTrans.Set 1, strDNSDomain
strNetBIOSDomain = objTrans.Get(3)
' Remove trailing backslash.
strNetBIOSDomain = Left(strNetBIOSDomain, Len(strNetBIOSDomain) - 1)
' Use the NameTranslate object to convert the NT user name to the
' Distinguished Name required for the LDAP provider.
objTrans.Init 1, strNetBIOSDomain
objTrans.Set 3, strNetBIOSDomain & "\" & strNTName
strUserDN = objTrans.Get(1)
Wscript.Echo "User DN: " & strUserDN
++++++++++++++++++
Here is the script I am attempting to get working (but not quite there
yet):
Const ForAppending = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("c:\results.txt", ForAppending, True)
'Opens existing file for reading list of target names
Const INPUT_FILE_NAME = "C:\users.txt"
Const FOR_READING = 1
'Opens file and reads all data in file
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(INPUT_FILE_NAME, FOR_READING)
strNames = objFile.ReadAll
objFile.Close
'Separates file by carriage return/line feed
strNTName = Split(strNames, vbCrLf)
' Determine DNS domain name from RootDSE object.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
' Use the NameTranslate object to find the NetBIOS domain name from
the
' DNS domain name.
Set objTrans = CreateObject("NameTranslate")
objTrans.Init 3, strDNSDomain
objTrans.Set 1, strDNSDomain
strNetBIOSDomain = objTrans.Get(3)
' Remove trailing backslash.
strNetBIOSDomain = Left(strNetBIOSDomain, Len(strNetBIOSDomain) - 1)
' Use the NameTranslate object to convert the NT user name to the
' Distinguished Name required for the LDAP provider.
For Each strName In strNTName
objTrans.Init 1, strNetBIOSDomain
objTrans.Set 3, strNetBIOSDomain & "\" & strNTName
strUserDN = objTrans.Get(1)
objTextFile.WriteLine "User DN: " & strUserDN
Next
objTextFile.Close
+++++++++++++++++++++++++
Any ideas?
Thanks. Tag: Error Handling... Tag: 181738
error sending mail
Hello.
I have a following code:
=============================================
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "subject"
objMessage.Sender = "email@adres.com"
objMessage.To = "email@adres.com"
objMessage.TextBody = "BODY"
'==This section provides the configuration information for the remote
SMTP server.
'==Normally you will only change the server name or IP.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"smtp.server.com"
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
'==End remote SMTP server configuration section==
objMessage.Send
======================================================
The code used to work. But now I get error message "The transport
failed to connect to server"
code: 80040213
source: cdo.message.1
Can somebody point me in direction to solve this?
Thanks
Martin Tag: Error Handling... Tag: 181734
InstanceModificationEvent not working
Hi,
I am tryin to figure out why my script isn't working. The script should
notify me when a file changes. However, it only notifies me about Creation or
Deletion events. I am running XP. Has anyone an idea?
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("SELECT * FROM __InstanceOperationEvent WITHIN 10 WHERE " _
& "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _
& "TargetInstance.GroupComponent= " _
& "'Win32_Directory.Name=""C:\\\\Scripts""'")
Do While True
Set objEventObject = colMonitoredEvents.NextEvent()
Select Case objEventObject.Path_.Class
Case "__InstanceCreationEvent"
WScript.Echo "A new file was just created: " & _
objEventObject.TargetInstance.PartComponent
Case "__InstanceDeletionEvent"
Wscript.Echo "A file was just deleted: " & _
objEventObject.TargetInstance.PartComponent
Case "__InstanceModificationEvent"
Wscript.Echo "A file was just modified: " & _
objEventObject.TargetInstance.PartComponent
End Select
Loop Tag: Error Handling... Tag: 181730
bolding text in email output
I am using vbscript to generate SMTP emails. I define the To, From,
Subject and body of the email with variables.
I then set the message variables:
With iMsg
Set .Configuration = iConf
.To = SMTPAddressTo
.From = SMTPAddressFrom
.Subject = Subject
.TextBody = Body
End With
In the body of the email I need some of the text to be bolded or
underlined. I can't figure out how to make this happen. I've tried to
use <b> and </b> but it's not working.
So, if I have something along the lines of the following, and want to
bold the word "must", how would I do it?
Body = "All children must do their homework"
Thanks, Tag: Error Handling... Tag: 181727
Enumerating network shares
Hey all,
I need to write a simple script that will enumerate all of the shares
on our file servers, and the number of user accounts with permissions
to each share. The purpose is to evaluate which shares can be deleted
to free up disk space by deleting shares with fewer than 10 users.
I have found some simple VBScript and JScript code that will enumerate
all of the shares on a given server like so:
' Begin code snippit
set objFs = GetObject("WinNT