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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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: HTA Help 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://" & strServer &
"/LanmanServer,FileService")
For Each objShare In objFs
strList = strList & vbCr & LCase(objShare.name) & vbTab &
UCase(objShare.Description)
Next
' End code snippit
My problem is that I need to know what other class members/methods are
available for the "FileService" (instanced as objFs) In the example
above, we use objShare.name and objShare.Description during the loop.
In which documentation would I find a list of the other class
methods/variables for objShare? I am at wits end, just trying to find
the documentation
Thanks in advance
Tim Tag: HTA Help Tag: 181725
Issues with Scripting.FileSystemObject
Hi,
I'm using the above function to capture an image on a regular basis and
I am having some problems. The piece of code in question is designed to
capture an image and save it to a specified location. It as run as a
scheduled task so that it is captured at defined intervals.
The code in question runs perfectly on all Windows XP machines that I
have tried, but does not function as it should on my server running
Windows Server 2003 Web Edt. Where the code comes unstuck on
WinServ2003 is when it goes to converting the binary data it obtained
from accessing the image to text and writing it to the file.
The code in question looks like this:
<code>
Dim Inet, strHTML
strHTML = "http://URL" & "/filename.ext"
BinarySaveURL strHTML, "C:\filename.ext"
Function GetHTTPFile(File)
Dim DLText
Set DLText = CreateObject("WinHttp.WinHttpRequest.5.1")
DLText.Open "GET", File, True
DLText.Send
If DLText.WaitForResponse(5) = True Then
GetHTTPFile = BinToStr(DLText.ResponseBody)
End If
end function
Function BinToStr(Binary)
Dim I
Dim StrOut
For I = 1 To LenB(Binary)
StrOut = StrOut & Chr(AscB(MidB(Binary, I, 1)))
Next
BinToStr = StrOut
End Function
Sub BinarySaveURL(URL, fn)
'Create an Http object, use any of the four objects
Dim Http
Set Http = CreateObject("WinHttp.WinHttpRequest.5.1")
'Send request To URL
Http.Open "GET", strHTML, False
Http.SetCredentials "username", "password", _
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
Http.Send
'Get response data As a string
ss = Http.ResponseBody
Dim FS
Set FS = CreateObject("Scripting.FileSystemObject")
'Create text stream object
Dim TextStream
Set TextStream = FS.CreateTextFile(fn)
'Convert binary data To text And write them To the file
TextStream.Write BinToStr(ss)
End Sub
</code>
It should be noted that WinServ2003 is creating the file in question,
but writes no data to it.
Can anyone explain why this piece of code will run perfectly on WinXP
and not WinServ 2003, and what might need to be done either within the
code or on the server in question to allow this to work. All and any
help/insight appreciated.
Kind Regards,
Michael Harris Tag: HTA Help Tag: 181723
Check WMI Connectivity
This is a multi-part message in MIME format.
------=_NextPart_000_01FA_01C5CB4A.58582FC0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi all,
I want to check WMI Connection to all PCs in my domain. Script code is =
as following:
For Each strComputer in arrComputers
Set objWMIService =3D GetObject("winmgmts:\\" & strComputer =
&"\root\cimv2") '(*)
If Err.Number > 0 Then
WScript.Echo strComputer & " - Unable to connect to WMI. Error " =
& Err.Number & "-" & Err.Description
Err.Clear
Else
WScript.Echo strComputer & "Connect to WMI: OK!"
End If
Next
WMI, DCOM, COM+ services are running well in all PCs. Domain Group =
Policy forces Windows Firewall in all PCs to open port 135 & 445.
There're times that WMI Connection to some PCs cannot be successful =
because Domain Group Policy are not applied at the PCs. So when the =
script runs, it stops at line (*) about 1 hour (If you choose Properties =
at WMI Control in Computer Management, you will have to wait a long =
time).
This issue occurs in all Wins XP SP2 & Wins 2K SP4.
This issue can be solved by running command "gpupdate /force" OR =
"secedit /refreshpolicy ..."
I want to decrease time to wait PCs' WMI unconnectable. I want to know =
whether a PC is connectable or not immediately. There is any way?
Thanks
------=_NextPart_000_01FA_01C5CB4A.58582FC0
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.2900.2722" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi all,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I want to check WMI Connection to all =
PCs in my=20
domain. Script code is as following:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2>For Each strComputer in =
arrComputers</FONT></DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2> Set =
objWMIService=20
=3D GetObject("winmgmts:\\" & strComputer &"\root\cimv2")=20
'<STRONG>(*)</STRONG></FONT></DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2> If =
Err.Number >=20
0 Then<BR> WScript.Echo strComputer =
& "=20
- Unable to connect to WMI. Error " & Err.Number & "-" =
&=20
Err.Description<BR> =20
Err.Clear<BR> Else<BR> =
=20
WScript.Echo strComputer & "Connect to WMI: =
OK!"<BR> End=20
If</FONT></DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2>Next</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>WMI, DCOM, COM+ services =
are running well=20
in all PCs. Domain Group Policy forces Windows Firewall in all PCs to =
open port=20
135 & 445.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>There're times that WMI Connection =
to some PCs=20
cannot be successful because Domain Group Policy are not applied at the =
PCs. So=20
when the script runs, it stops at line (*) about 1 hour (If you choose=20
Properties at WMI Control in Computer Management, you will have to wait=20
a long time).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>This issue occurs in all Wins XP SP2 =
& Wins 2K=20
SP4.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>This issue can be solved by running =
command=20
"gpupdate /force" OR "secedit /refreshpolicy ..."</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I want to decrease time to =
wait PCs' WMI=20
unconnectable. I want to know whether a PC is connectable or =
not=20
immediately. There is any way?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV></BODY></HTML>
------=_NextPart_000_01FA_01C5CB4A.58582FC0-- Tag: HTA Help Tag: 181722
setting registry permissions
I can use subinacl.exe /keyreg
\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Security
/grant=Administrators=F to change the permissions on my registry but it
does not propagate to the children of the registry key, any ideas how I
can get it to propagate to children? Tag: HTA Help Tag: 181719
Re: Communications Between 2 Sites
"Rafael Chemtob" <rchemtobb@nospam.yahoo.com> wrote in message
news:uh79V6qyFHA.3256@TK2MSFTNGP09.phx.gbl...
> Hi,
> i need to be able to have 2 sites communicate together. Here are the
details
> of how it works:
> 2 Domain names:
> www.abc.com
> www.def.com
> 1. The user is in www.abc.com and receives a cookie. the value in the
> cookie is unique.
> 2. On www.abc.com, there is a file called "return.asp"
> (http://www.abc.com/return.asp) which receives 2 parameters.
> a. MID
> b. CID
> 3. The user clicks on a link to go to www.def.com.
> 4. Once the user is on www.def.com and navigates to a certain page that
> contains an MID parameter and a CID parameter. The user would remain at
the
> www.def.com but it needs to communicate to the www.abc.com the MID and
CID.
>
> I've tried different things like placing a 1 pixel image on the
www.def.com
> site (<img src="http://www.abc.com/return.asp?MID=123&CID=456" width=1
> height=1> and that doesn't work.
> Any ideas?
> please advise.
> rafael
>
>
Can't you just pass the values in the QueryString?
That is,
http://www.def.com/your_link.asp?MID=123&CID=456
Then have "your_link.asp" access them via
Request.Qu