Use VB to update XML
I am trying to accomplish the following; I have an XML script that gets
uploaded to a server and then imports the fields to a webpage, what I am
trying to do is see if it is possible to change the fields in the xml script
with VB. I have created an outlook form that the users will fill out and I
would like to have the script look at the values in the text box and then
change the line in the xml script to read the value. Here is an example of
what I would like to do.
The outlook form has the following field: Description - Lenders Cover Letter
The xml script has this line <Description>XXXXXXXXXXXXX</Description>
I would like the script to change the description in the xml code.
<Description>Lenders Cover Letter</Description>
Is this possible to do? The xml script will be in the body of the message
when it is e-mailed to the site.
Thanks
Gavin... Tag: Display # of Users on our Web Site Tag: 158532
Delete Files by date
Hello,
I need to delete files in a certain folder by current date minus 2.
I do not know how to do this - I've searched the archive and the web....
All suggestions will be greatly appreciated.
Thanks in advance,
Bill Burke Tag: Display # of Users on our Web Site Tag: 158524
RunAs Alternatives
Hello,
We are constructing a script that will be launched from the end of the
domain login script in our AD environment. This script will query the
registry for the latest critical updates, determine which are missing and
install the missing updates. We have it working, except that we have to
reference a local Administrator/password when using the RunAs command to
install any missing patches. This Admin/Password pair is in plain text in
the script, and for security reasons, we only want to have one local
administrator per workstation. Is there a way with VBScript to hide (hash)
a domain account password, or install a patch locally while logged on as a
member of the Local Users group? Basically, the ciritical updates need to
be installed by a local administrator, and we need a way to run these
updates from a VBScript login as that local administrator while not
compromising the seecurity of the system. Any thoughts greatly
appreciated...!!
Thanks,
Chris
twinked@seajay.com Tag: Display # of Users on our Web Site Tag: 158523
Want more than 1,000 results from AD Query
Please help me with the script below. I'm using it to list all the computers from the Servers OU in a specified domain in Active Directory. Unfortunately, the script (which is a modified version of Listing 5.30 in the Microsoft Windows 2000 Scripting guide) only returns the first 1,000 entries. We have more than 1,000 computers in my enterprise. What do I need to do to retrieve all computers and not just the first 1,000? If I can't retrieve an unlimited number of computers, can I turn some setting up to an obscenely high number like 2,000,000 and accomplish the same goal? All help is appreciated
-raj
--------------------------------------------------------------------------------------------------------------------------------------------
Option Explici
On Error Resume Nex
'************************************
'* Explicitly Defined Variables
'************************************
Dim objConnectio
Dim objComman
Dim objRecordSe
Dim fqd
Dim o
'Establish and initialize connection to Active Directory Databas
Set objConnection = CreateObject("ADODB.Connection"
objConnection.Open "Provider=ADsDSOObject;
Set objCommand = CreateObject("ADODB.Command"
objCommand.ActiveConnection = objConnectio
'Search command passed to active director
objCommand.CommandText =
"<LDAP://ou=Servers,dc=my,dc=domain,dc=net>;(objectCategory=computer)" &
";name,operatingSystem;subtree
Set objRecordSet = objCommand.Execut
While Not objRecordSet.EO
fqdn = objRecordSet.Fields("Name"
os = objRecordSet.Fields("operatingSystem")
Wscript.Echo os & " " & fqd
objRecordSet.MoveNex
Wen
'Close Active Directory Connectio
objConnection.Close Tag: Display # of Users on our Web Site Tag: 158522
retrieve computer account in active directory
Hi
I would like to know how to get a list of computer's account in active directory
have you a sample please ?
thank
balou Tag: Display # of Users on our Web Site Tag: 158519
Time Sync
Is there a script available to set the time synchronization of XP and 2K
workstations to a designated timeserver? Or against the authentication
server's time?
THanks Tag: Display # of Users on our Web Site Tag: 158518
Onunload server side code
Hi,
There is probably a very simple answer to this, but i can't seem to
find it.
I have an asp page which moves files on the server. What i need is the
server side code which moves the files i.e...
If strSelectedpdf <> "" Then
ObjFSO.Movefile Oldfile, Newfile
End If
...to be run when the user clicks submit and the user is taken to the
next page. At the moment it works if the forms action is to the
current page beacause the variables have been populated with the
user's input and the script is re run when the page is opened again,
but i want the code to be run as the page is left so i can direct them
to a results page.
I imagine it would be something along the lines of
Sub window.onunload()
If strSelectedpdf <> "" Then
ObjFSO.Movefile Oldfile, Newfile
End If
end sub
But this doesnt work.
Can anyone suggest an answer??
Luke Tag: Display # of Users on our Web Site Tag: 158516
add printerdriver to remote machines problem
Hello all,
I've got major difficulties to add a printer driver to a remote
machine.
If I want to add "windows 2000 build-in" drivers, all works fine, but
if I want to add I driver which I downloaded from the internet (e.g.
HP Business Inkjet 2300 PCL 5c driver) I always get the error
message "printer rundll command failed".
I use the command line below:
rundll32 printui.dll,PrintUIEntry /ia /c\\machine /m "HP Business
Inkjet 2300 PCL 5c" /h "Intel" /v "Windows 2000" /f
C:\printerdrivers\windows 2000 drivers\HP business inkjet
2300\Drivers\PCL5\Win2k_XP\English\hpw2300b.inf
I'm 100% sure that the modelname is correct (I looked it up in the
inf file) and also the location of the inf file is correct).
It's weird that this works perfectly for the "windows 2000 build-in"
drivers (where I use the standard %windir%\inf\ntprint.inf inf
file) and not for other printer inf files, or is there something I
overlooked?
Tips and help are very welcome,
thanks in advance,
Joeri Tag: Display # of Users on our Web Site Tag: 158515
all kind of files
Hello,
how can I realize to look for all exists files in a directory.
Actually I want look for a special word for every founded file . What
have I to heed if I'm working in a local net?
Many thanks for help Tag: Display # of Users on our Web Site Tag: 158513
Reading very large files with VB Script
I know it sounds insane but i need to read a 2GB file and then spin it
around i.e. put the front at the back and the back at the front.
I would like to do this using script. Is this possible? I am trying at the
moment but i run out of memory.
TIA
Pat Long Tag: Display # of Users on our Web Site Tag: 158512
view excel file using asp
Dear al
i wornder if anybody help me.
i want to view the excel file in asp pages. i used code as
<a href="Test.Xls" target=_blank>Excel File</a
but it is giving two option 1) Open from current location
2) Save the file
but i just want to view the file in new window. also when i opened the file and if i want to open the file second time, it is giving the error that the file is opend
i just want to view the file like how the pdf file displays in asp
so please suggest me the soln for the same
with regard
vaibhav Tag: Display # of Users on our Web Site Tag: 158507
TCP/IP settings from vbscript
what code does one use to display the tcp/ip settings in a nice window? i wrote a simple script to change tcp/ip setings for my users when they are at home or at work. after the function completes i would like to display the settings in a message box or popup and not goto a command window and run ipconfig from the script
thanks Tag: Display # of Users on our Web Site Tag: 158501
local computer group membership from an OU of computers?
I have been trying get get a script that will get the membership from the local computer's Administrators group by using an
OU full of computers. I can return the Administrators group membership from my local computer and a list of computers from an OU, can't quite figure out how to do both with resorting to AD Users & Computers and going from computer to compute
Any thoughts
Gabe Tag: Display # of Users on our Web Site Tag: 158499
excel getobject not working
1. set excel = getobject("test.xls")
error: cannot find file- or classname:'getobject'
2. set excel = getobject(,"excel.application")
excel.workbooks.open("pathname\test.xls")
error: ...xls could not be found
3. set excel = getobject("","excel.application")
excel.workbooks.open("pathname\test.xls")
error: ...xls could not be found
I am trying to dynamically store data from a .hta-file to an excel
file, that is already open. With the above results. The .hta-file and
the .xls file are in the same directory. Even when i hardcode the path
i get the same result.
Is this the bug Michael Harris wrote about in a posting from
1999/09/18 (Subject: Open Excel 2000 from htm fails!):
"It also fails for Excel 2000, WSH2 beta, and the version 5.0 vbscript
engine.
The failure isn't when creating the object, only when referencing any
property
or method. Of course there's not much point in creating it if you
can't use it.
...So, when you use CreateObject("Excel.Sheet") and then try to
reference it in any
way, it fails.
If you try the GetObject("","Excel.Sheet") alternative method, it also
fails.
But if you use WScript.CreateObject or GetObject instead, it works.
Of course,
this isn't a solution available from (local) html or an hta. So it
would appear
that there's a bug in the vbscript 5.0 CreateObject/GetObject methods
that is
not in the wscript versions."
Or am i doing something wrong? What can i do to achieve that i can
store data from a .hta file in an excel file?
I use:
- wsh version 5.6
- vbscript v.??
- internet explorer v.6
- windows xp pro
- excel 2002
Any help would be appreciated
gr Jan Tag: Display # of Users on our Web Site Tag: 158497
Response.Write not writing anything
Hi,
I have an asp page that imports delimited text files into a database. One
of our users has rather large text files. Once all these files are
imported the page prints the word "Success" to the screen.
This no longer works when importing the large files. If I shorten the
number of files imported so it takes just a few minutes the word "Success"
appears and all works fine. If I alter the asp back to import all the
files (takes about 10 minutes) the browser sits at the page loading screen
indefinably.
This script creates log files as it goes so I can see that all the files
are imported successfully (that's why I know it takes about 10 minutes : )
just that the web page fails to report this.
After the last import I use Response.Write "Success".
I have tried Response.Flush, Response.End and played with the WriteBlock
command. None of these make any difference. Any ideas on how fix this?
Thanks
Dominic Godin Tag: Display # of Users on our Web Site Tag: 158485
how to call CreateProcessWithLogonW from vbscript
I am "very" new to vbscript.
Is there a way via an object to call CreateProcessWithLogonW from vbscript?
thank you for your help
johnp Tag: Display # of Users on our Web Site Tag: 158481
VBScript error 800A0401 'Expected end of statement' on 'Open ... For Input ...'
Hi,
I tried this code :
FileName = "C:\temp\SC.csv"
Open FileName For Input as #1
Do Until EOF #1
Input #1, datastring
Loop
Close #1
and I get this message :
Windows Script Host
Error: Expected end of statement
Code: 800A0401
Source: Microsoft VBScript compilation error
I can't find out where I made a mistake...
Can anyone help me ?
Thanks Tag: Display # of Users on our Web Site Tag: 158478
Parsing a NTBackup Log file
I am trying to Parse ntbackup log files. does anyone have a script out
there that will parse a ntbackup log properly? I am having trouble
getting it to work.
Thanks
Robert Tag: Display # of Users on our Web Site Tag: 158474
Unkown code source
Hi
Can somebody please point my tired brain in the right direction....I coded
this ages ago but I'm totally lost as to what it means or what it is! Thick
I know but it will come to me as soon as someone points out the obvious!
Its from an ASP page...I know what it does but is it vb or what?
strRecText = displayCrLf(objRS("RecText"))
displayCrLf < what the heck is display?
Cheers
A thickoid Tag: Display # of Users on our Web Site Tag: 158471
Urgent Help Please!
Hi guys,
I have a problem and would love your help.
Users have been added to the Power Users Group in a Windows 2003 Domain.
They all run eTrust InoculateT Antivirus.
When you log on as one of these users, you are able to stop the antivirus
services.
Is there any way to deny them the ability to stop these 2 services?
Thanks.
Simon
--
---------------------------------------------------------------------
"Are you still wasting your time with spam?...
There is a solution!"
Protected by GIANT Company's Spam Inspector
The most powerful anti-spam software available.
http://mail.spaminspector.com Tag: Display # of Users on our Web Site Tag: 158470
Scanning Servers For Available Drive Space?
I'm need to scan various remote servers for the available drive space of all
drives on a each server.
Executing the script from my machine I'm able to capture the drive info for
remote servers if I pass the script a list of server names and drive letters
i.e. \\servername\c$
But, given the number of servers I have to scan and not knowing what drives
are used on each server I'd prefer to simply use a list of server names and
dynamically determine which drives are used on that server and subsequently
capture the available drive space for each.
As far as I can tell the fso.Drives collection is only relevant to the local
machine. Is there a way to collect the available drive info on a remote
server - in vbs or otherwise??
Thanks in advance.
KC Tag: Display # of Users on our Web Site Tag: 158466
cscript error...?
Hi,
When I run my vbs script I get this error:
CScript Error: Loading you setting failed. (Acess is denied)
I think I found a cooresponding message in the wbemcore.log file:
Error 80041002 occured while executing queued request
Does anyone have any idea what might cause this problem? This script used to
work, then I fried my motherboard and had to reinstall. I'm running Windows
2000 server.
Thank you,
Robert Stober Tag: Display # of Users on our Web Site Tag: 158464
Newbie question: selchange event oh Monthview control firing by itself every 2 minutes ?
I have a very simple html page with the Monthview control on it (btw, I'm
using the latest control from the VB6 SP6 if that makes a difference) and
the selchange event is firing by itself every 2 minutes or so without any
reason.
What am I misssing here ?
Any advice would be highly appreciated.
Thanks in advance.
Steve
<OBJECT ID="MonthView1" WIDTH=151 HEIGHT=115
CLASSID="CLSID:232E456A-87C3-11D1-8BE3-0000F8754DA1"
CODEBASE="http://activex.microsoft.com/controls/vb6/MSCOMCT2.CAB#version=6,1
,97,82"
<param name="_Version" value="393216">
<param name="ForeColor" value="16711680">
<param name="BackColor" value="16777215">
<param name="BorderStyle" value="0">
<param name="Appearance" value="0">
<param name="MousePointer" value="99">
<param name="Enabled" value="1">
<param name="OLEDropMode" value="0">
<param name="MaxSelCount" value="2">
<param name="MonthColumns" value="1">
<param name="MonthRows" value="1">
<param name="MonthBackColor" value="16777215">
<param name="MultiSelect" value="0">
<param name="ScrollRate" value="0">
<param name="ShowToday" value="1">
<param name="ShowWeekNumbers" value="0">
<param name="StartOfWeek" value="662831106">
<param name="TitleBackColor" value="8912896">
<param name="TitleForeColor" value="16777215">
<param name="TrailingForeColor" value="-2147483631">
<param name="MaxDate" value="2958465">
<param name="MinDate" value="-53688">
<param name="_ExtentX" value="4286">
</object>
</script><script language="VBScript">
Sub month1_config()
set omnth = document.MonthView1
omnth.font.name = "tahoma"
omnth.font.size = "7"
end sub
Sub Window_OnLoad()
month1_config
end sub
Sub MonthView1_selchange(StartDate, enddate, Cancel)
msgbox startdate & now()
end sub
</script> Tag: Display # of Users on our Web Site Tag: 158461
Get browser's Window Handle?
Hi:
Is there a VBScrip function to get the Windows Handle of the browser?
Thanks
Polaris Tag: Display # of Users on our Web Site Tag: 158458
Where to EXEC this VB Script to populate into Access DB
I am trying to create tables using sample scripts below... could someone point me to where I could populate this into Access DB
Much Appreciated
-Lawrenc
Dim ERwinWorkspace As Workspac
Dim ERwinDatabase As Databas
Dim ERwinTableDef As TableDe
Dim ERwinField As Fiel
Dim ERwinRelation As Relatio
Set ERwinWorkspace = DBEngine.Workspaces(0
Set ERwinDatabase = ERwinWorkspace.OpenDatabase(sERwinDatabase
' DELETE TABLE "F_Operating_Expense
ERwinDatabase.TableDefs.Delete "F_Operating_Expense
' CREATE TABLE "F_Operating_Expense
Set ERwinTableDef = ERwinDatabase.CreateTableDef("F_Operating_Expense"
Set ERwinField = ERwinTableDef.CreateField("f_operating_expense_id", DB_INTEGER) Tag: Display # of Users on our Web Site Tag: 158448
Newbie(ish) needs clarification on array indexes and string functions
I'm new to vbscript and web programming but not programming in general (c
and c++ mainly)
From what I read so far, I gathered vb uses zero-based arrays where a
declaration of
myarray(5)
creates an array from 0 to 5. The upper bound of 5 seems odd to me from my
background, but I think that's right(?)
But I was getting frustrated when I couldn't get the following to work:
For c = 0 to 5
Document.Write(Mid("abcdef", c, 1) & "<br/>")
Next
Turns out I had to change the initial counter from to go from 1 to 6.
Am I wrong about zero-based indexes and upper bounds, or is this a quirk of
string functions in VBscript? Tag: Display # of Users on our Web Site Tag: 158443
Briefcase update
Hi,
Does sombody have an idee how to automatic a Windows briefcase folder with
a script
something like
Set Brief = createobject("Briefcase")
Brief.path="c:\BC"
Brief.update
Jan Tag: Display # of Users on our Web Site Tag: 158441
parsing IE instances
Hello,
I am beginner in VBScript programming and i need a VBScript code which
parses the IE instances in order to get their HTML content.
I know that i can get the HTML code from a Web Browser or IE object with
"IEObj.Document.Body.InnerHTML", but i don't know if i can connect to
existing IE instances in order to read the HTML code of the current page.
I appreciate any helpful information.
Regards,
Cretu Lucian Tag: Display # of Users on our Web Site Tag: 158439
RegObj.dll - Probs with Remote Reg Update in BINARY
Hi Everyone,
Just wondering if anyone has any experience with RegObj.dll ..
Looks like a great tool, but has pretty poor documentation ..
Anyway ...
I'm trying to do this:
Set objRegObj = WScript.CreateObject("RegObj.Registry")
Set objRemoteRegistry = objRegObj.RemoteRegistry("PC_NAME_HERE")
Set objValue =
objRemoteRegistry.RegKeyFromString("\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft")
DataValue = 101010101
objValue.Values.Add "a", DataValue, 3
' 1 = REG_SZ, 2 = REG_EXPAND_SZ, 3 = Binary ...
However, no matter what format I set DataValue as, I keep getting a "Type
Mismatch" error.
I can get String data to be written without any problem, just not BINARY
data.
I've put in the following different data formats:
DataValue = "10101"
DataValue = 10101
DataValue = Array("1","0","1","0")
DataValue = Array(1,0,1,0)
DataValue = &H800
DataValue = array(&H800, &H800)
but NOTHING seems to work ..
Anyway, thanks for any help you can offer ..
Cheers'
JediK9 Tag: Display # of Users on our Web Site Tag: 158438
Windows 2003 Domain - Denying users the ability to stop eTrust Antivirus services on their workstations
Hi guys,
I have a problem and would love your help.
Users have been added to the Power Users Group in a Windows 2003 Domain.
They all run eTrust InoculateT Antivirus.
When you log on as one of these users, you are able to stop the antivirus
services.
Is there any way to deny them the ability to stop these 2 services?
Thanks.
Simon
--
---------------------------------------------------------------------
"Are you still wasting your time with spam?...
There is a solution!"
Protected by GIANT Company's Spam Inspector
The most powerful anti-spam software available.
http://mail.spaminspector.com Tag: Display # of Users on our Web Site Tag: 158434
Remove a menu from the desktop right click menu
Hi guys,
I have a specific need to remove a few entries when I right click on the
desktop, in an area of free space, and the context menu comes up. One of
these is 'Graphics Options' for the video card.
I dont know how or where to find out how to remove this option from the
context menu.
Any help greatly appreciated.
Simon
--
---------------------------------------------------------------------
"Are you still wasting your time with spam?...
There is a solution!"
Protected by GIANT Company's Spam Inspector
The most powerful anti-spam software available.
http://mail.spaminspector.com Tag: Display # of Users on our Web Site Tag: 158433
Windows XP Start Menu
Hi guys,
Im trying to find out if there is a way in vbscipt to add the computer name
to the top portion of the XP start Menu.
That is:
When you click on the start button for Windows XP and the fly up shows your
username at the top in blue, can you add the computer name next to your user
name there somehow with vbscipt?
Any help greatly appreciated.
Simon
--
---------------------------------------------------------------------
"Are you still wasting your time with spam?...
There is a solution!"
Protected by GIANT Company's Spam Inspector
The most powerful anti-spam software available.
http://mail.spaminspector.com Tag: Display # of Users on our Web Site Tag: 158432
How to invoke a function in ActiveX control ?
Hi:
New to Scripting. I have an ActiveX control (PopReporter.Dll), in which
there are a few functions defined. How to invoke one of the functions in
using VB Script? I know the ClassID of the control and the function name:
int GetTotal (char* pszCityName).
One more question, the control does not show up in the ActiveX Control Test
Center (Insert New object), even though it has been registered (it shows up
in the OLE object Viewer).
Thanks in advance for any input.
Polaris Tag: Display # of Users on our Web Site Tag: 158431
Help with string breakup
I am bouncing on the upper limit up with sending emails to smtp server at
about 300, I do not whant to increase amount of email messages on server
config.
I have a vbscript that pulls emails address's from an sqldb as a
concatinated string ie.
fred@address.com;jack@address.com;bill@address.com;dan@address.com etc..
I need to break up thatstring into blocks of 100 so that i can send multiple
emails instead of 500+ address in BCC field
Anyone have an idea whats the best way to do it.
Don Tag: Display # of Users on our Web Site Tag: 158416
dictionary Add and recordsets
I'm looking up employee data and get a record set named assoc_r
Call GetAssociateDataByNameCheckBoth(Connection, assoc_rs
Then I want to put this data in a hash (scripting.dictionary) and pass the hash to a generic sub that adds a record to a databas
Call RecordHash.Add ("ID",assoc_rs("ID")
The problem is that it seems the actual recordset is put in the hash not the value of the field. If I close assoc_rs bad things happen in the Sub I pass the hash to
I tried assoc_rs.fields("ID") to no avail
I don't want to keep the recordset open and I don't want to create a temp var such a
t=assoc_rs("ID"
Call RecordHash.Add ("ID",t Tag: Display # of Users on our Web Site Tag: 158413
how to limit string length with RegExp?
Greetings,
I need to limit a string length between 1 to 2
characters. For the pattern I have
...
RE.IgnoreCase
RE.Pattern = "[a-z]{2}"
I want to capture like "a" or "aa" but not "aaa", or
capture "ab" ok, but not "abc" (more than 2 chars)
or "abb", etc. I can never figure out how to limit the
number of chars occuring in the pattern. Any suggestions
appreciated how to be able to limit the length of the
string between 1 to 2 chars (or just what the rule is for
limiting how many chars can occur in a pattern).
Thanks,
Steve Tag: Display # of Users on our Web Site Tag: 158410
Outlook server setting
We will be migrating from exchange 5.5 to 2003 in about 10 days. We're
toying with different solutions to update all (600) clients' outlook server
setting via domain logon script which will then launch a .bat file.
The only change that needs to be made on the clients config is the exchange
server name in outlook when they login to the domain. If the script could
actually check entry first and only make the change if the old server name
present.
Thanks for any advice. I dabble in different scripting but am far from
savvy enough to handle this one.
tab Tag: Display # of Users on our Web Site Tag: 158408
send a string to the clipboard?
Is there a way to send text to the clipboard using a vb script?
I want to be able to send a string to the clipboard so it will be available
once the script is done running.
Thanks. Tag: Display # of Users on our Web Site Tag: 158403
Coping files
Hi all,
sorry for the repeat, but the originals have fallen off my news server.
I am moving some VB Scripts over to a WinXP machine and have found they have
stopped working.
I had some code (supplied from this news group some time back) that gave me
a copy dialog box when copying files. Under XP this code no longer works. It
does not copy anything.
Can some KIND soul give me something that will work under XP.
The code I have been using (in part) is;
Const FOF_SIMPLEPROGRESS = "&H400"
Set fso = CreateObject("Scripting.FileSystemObject")
Set oShell = WScript.CreateObject("Shell.Application")
Destination="c:\test" : source="c:\temp\*.*"
Set DFldr = oShell.NameSpace(Destination)
DFldr.CopyHere source, FOF_SIMPLEPROGRESS
I have also been supplied with the FOF_SIMPLEPROGRESS value of 256 (&H100)
but that did not work under XP either.
Cheers, Bill. Tag: Display # of Users on our Web Site Tag: 158399
VBScript & ADO
Hi all,
Is it possible to run a VBScript client side with access to an Access
Database? If so where should I look to learn the syntax.
I can use ADO in VBScript through ASP, however I want to develop a small
script to run from the desktop.
Cheers, Bill. Tag: Display # of Users on our Web Site Tag: 158389
Unique Browser ID
I'm working on a web app that will be run on a server farm- so session level
variables are out. I keep running into a need for a way to uniquely identify
the user's browser "session" (i.e. a value that changes whenever the user
browses to the site through a new browser window). I'm guessing the
browser's process ID would work in combination with his IP.
Is there a way to acquire such a value through script, either from the host
or the client side? Tag: Display # of Users on our Web Site Tag: 158383
What does this script say?
I copied at :
http://www.devguru.com/Technologies/wsh/quickref/wscript_application.html
I want to understand what it is trying to do. When I run the script, the msg
said "They are equal".
If somebody can explain how to make it say "they are different", I might
understand better.
================================================
Set objWScript = WScript.Application
If WScript = objWScript Then
WScript.Echo "They're equal"
Else
WScript.Echo "They're different"
End If
--
alan Tag: Display # of Users on our Web Site Tag: 158381
Solution: Active Directory, create User, with mailbox and SMTP Address from Exel file
Hi,
I'm working in a rather big society in Italy, and some days ago my
boss ask me for a script that add a user, insert into a group, create
his mailbox, add an SMTP address and let the user use the mailbox
immediately.
After two days of work, searching the internet and on some books, I
completed it, the script it's fully working now, it's very FAR from
being perfect, but
it also log everything in a file "output.txt".
If you want to use this script "as is" you have only to change the
initial variabiles and create data file INPUT.XLS as:
name,surname,password,group,accountName,smtpAddress in each column.
you can omit smtpAddress .
To use it you need a Windows XP/2000/2003 workstation in the
destination domain, Excel installed and you have to log as domain
Admin
I hope it can be useful to somebody, sorry for the comments and the
log in italian.
Davidhoff
====================START: CreateUser-Mailbox.vbs=================
'Definizione Variabili
Const NomeFile = "INPUT.XLS" 'Nome del file Exel di
input
Const strOutputFile="output.txt" 'Nome del file di
output/Log
DomainNameDc = "DC=domain,DC=com"
ServerDC = "DomainControllerName" 'Nome del domain controller
strDomain="domain.com" 'Dominio dove creare gli
account
'Dati di Exchange per la creazione della MailBox
strSmtpDomain = "@domain.it" 'Dominio SMTP per la
creazione dell'SMTP Address 'nome.cognome@...'
strMailboxStore = "Mailbox Store (ExchangeMachineName)" 'Nome del
Mailbox store dove creare la mailbox
strStorageGroup = "First Storage Group" 'Nome dello Storage Group
strExchangeServer = "ExchangeMachineName" 'Nome del server
di Exchange
strAdministrativeGroup = "First Administrative Group" 'Nome
dell'Administrative Group
strExchangeOrg = "ExchangeORG" 'Nome dell'organizzazione
Exchange
Public UtenteNonCreato
Public Errati
Public DominioClient
Public DomainController
Public ServerDC
Public DomainNameDc
Public strAccountDomain
strAccountDomain = "@" & strDomain
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' ----------------- main() ------------------------
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Const OPEN_FILE_FOR_APPENDING = 8
DIM Totale
Errati=0
Totale=0
Mailbox=0
LogMessage " "
Logmessage ">==== Inizio esecuzione dello script: " & Now()
'Seleziona il tipo di comando da inviare
Wscript.Echo( "Script per la creazione di utenti all'interno del
dominio '" & strDomain & "'" & vbCrLf _
& "File di input: " & NomeFile & vbCRLF & vbCrLf &
"Digita 'ok' per continuare" & vbCrLf )
WScript.StdOut.Write(">")
WScript.StdIn.Read(0)
strOk = WScript.StdIn.ReadLine()
If (UCase(strOK) <> "OK") Then
Logmessage ">==== Esecuzione annullata: " & Now()
WScript.Quit
End If
LogMessage "Esecuzione su Domain Controller: " & ServerDC
set ofs=wscript.createobject("scripting.FileSystemObject")
strInputFile = ofs.GetAbsolutePathName(NomeFile)
LogMessage "Utilizzo file di input: " & strInputFile
LogMessage " "
on error resume Next
FindDomain
'Open input file
'Start EXCEL and display it to the user
Set oXL = WScript.CreateObject("EXCEL.application")
'oXL.Visible = True
'Open the workbook passed in the command line
oXL.workbooks.open strInputFile
'Activate the Add page
oXL.sheets("Add").Activate
'Put the cursor in the starting cell
oXL.ActiveSheet.range("A1").Activate
'Step to the next row
'oXL.activecell.offset(1, 0).Activate
'Until we run out of rows
Do While oXL.activecell.Value <> ""
'Lettura delle celle nella riga di input
strName = TRIM(oXL.activecell.offset(0, 0).Value)
strSurname = TRIM(oXL.activecell.offset(0, 1).Value)
strPassword = TRIM(oXL.activecell.offset(0, 2).Value)
strGroup = TRIM(oXL.activecell.offset(0, 3).Value)
strAccount = Trim(oXL.activecell.offset(0, 4).Value)
strSmtpAddress1 = Trim(oXL.activecell.offset(0, 5).Value)
Totale= Totale + 1
Wscript.Echo (vbCrLf & "Creazione Utente '" & strName & " " &
strSurname & "'")
LogMessage " "
LogMessage "Creazione Utente " & strName & " " & strSurname
CreateUser strName, strSurname, strAccount, strPassword, strGroup,
strSmtpAddress1
'Step to the next user...
oXL.activecell.offset(1, 0).Activate
Loop
LogMessage " "
LogMessage "Utenti totali: " & totale
LogMessage "Utenti inseriti correttamente: " & totale - Errati
LogMessage "MailBox create: " & Mailbox
'Done. close excel spreadsheet
Wscript.Echo(vbCrLf & "Fine esecuzione." & vbCrLf & vbCrLf & "Utenti
errati: " & Errati & vbCrLf _
& "Utenti inseriti: " & Totale - Errati &
vbCrLf _
& "MailBox create: " & Mailbox)
Logmessage "<==== Termine esecuzione dello script: " & Now()
oXL.application.quit
Set objFileSystem = Nothing
'Definizione Funzioni
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' Sub FindDomain ()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub FindDomain ()
Set rootDSE = GetObject("LDAP://RootDSE")
DominioClient = rootDSE.Get("defaultNamingContext")
ParzDomainController = Replace(DominioClient,"DC=",".")
DomainController = ServerDC & Replace(ParzDomainController ,",","")
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' Sub CreateUser ()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub CreateUser (strName,strsurname,strAccount,strPassword,strGroup,strSmtpAddress1)
Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000
DomainName = "DC=" & ServerDC & DomainNameDC
DisplayName = strName & " " & strSurname
UtenteNonCreato=0
on error resume Next
account = strAccount
IF Searchuser (account) = 0 Then
Set objOU = GetObject("LDAP://cn=users,"& DomainNameDC)
If Err.Number <> 0 Then
Wscript.Echo("*** '"& DisplayName &"'" & " - Utente non creato.
Riferimenti errati. Errore=" & CStr(Err.Number) & _
" " & CStr(Err.Description))
LogMessage "*** " & DisplayName & " - Utente non creato.
Riferimenti errati. Errore=" & CStr(Err.Number) & _
" " & CStr(Err.Description)
UtenteNonCreato=1
Err.Clear
Errati=Errati+1
Exit Sub
End If
'Cerca il gruppo a cui aggiungere l'utente. Se non esiste non crea
l'utente
Set objGroup = GetObject("LDAP://cn=" & strGroup & ",cn=users," &
DomainNameDC)
If Err.Number <> 0 Then
Wscript.Echo("*** '"& DisplayName &"'" & " - Utente non creato.
Gruppo non esistente: '" & strGroup & "'" & vbCrLf _
& "Errore= " & CStr(Err.Number) & " " &
CStr(Err.Description))
LogMessage "*** " & DisplayName & " - Utente non creato. Gruppo
non esistente: " & strGroup & vbCrLf _
& "Errore= " & CStr(Err.Number) & " " &
CStr(Err.Description)
UtenteNonCreato=1
Err.Clear
Errati=Errati+1
Exit Sub
End If
Set objUser = objOU.Create("User", "cn=" & strName & " " & strsurname)
objUser.Put "sAMAccountName", account
objUser.Put "givenname", strName
objUser.Put "sn", strSurname
objUser.Put "displayName", DisplayName
objUser.Put "userPrincipalName", account & strAccountDomain
objUser.SetInfo
objUser.SetPassword strPassword
objUser.AccountDisabled = False
objUser.SetInfo
'Imposta 'password never expire'
objUser.userAccountControl = objUser.userAccountControl Or
ADS_UF_DONT_EXPIRE_PASSWD
objUser.SetInfo
'Aggiunge l'utente al gruppo
objGroup.Add(objUser.AdsPath)
objGroup.SetInfo
Set objGroup = Nothing
Wscript.Echo("Creato utente: '" & DisplayName & "' - Group= '" &
strGroup & "'")
LogMessage "Creato utente: '" & DisplayName & "' - Group= '" &
strGroup & "'"
' Crea la MailBox
strUrL = "LDAP://CN="& strMailboxStore &",CN=" & strStorageGroup &
",CN=InformationStore," & _
"CN=" & strExchangeServer & ",CN=Servers,CN=" &
strAdministrativeGroup & ",CN=Administrative Groups," & _
"CN=" & strExchangeOrg & ",CN=Microsoft
Exchange,CN=Services,CN=Configuration," & DomainNameDc
TimeInterval = 10000
NumofTry = 9
iCounter = 0
' A seconda della grandezza della rete, l'aggiornamento del Directory
potrebbe impiegare alcuni secondi
' Proviamo a creare la mailbox con tentativi ogni 10 secondi per 1,5
minuti
Do While iCounter < NumofTry
' Crea la mailbox all'interno del MailBox Store
bContinue = CreateNewUserMailbox(objUser, strUrL,
DisplayName)
' Continua se CreateNewUserMailbox ha successo
If bContinue Then Exit Do
iCounter = iCounter + 1
' attende prima di riprovare
wscript.sleep(TimeInterval)
Loop
' Se non riesce a creare la mailbox da errore
If iCounter >= NumofTry Then
wscript.echo "*** Errore nella creazione della mailbox: "
& DisplayName & "."
LogMessage "*** " & DisplayName & " - MailBox non creata.
" & vbCrLf _
& "Errore= " & CStr(Err.Number) & " " &
CStr(Err.Description)
bContinue = False
Exit Sub
End If
If strSmtpAddress1 <> "" Then
'crea l'alias nome.cognome@domain
strSmtpAddress2 = Lcase(Replace(strName," ","") & "." &
Replace(strsurname," ","") & strSmtpDomain)
AddSmtpAddress objUser,strSmtpAddress1,strSmtpAddress2
Set objUser = Nothing
End If
Else
WScript.Echo("*** '" & DisplayName & "'" & " - Utente non creato.
Account '" & account & "' già esistente.")
LogMessage "*** " & DisplayName & " - Utente non creato. Account " &
account & " già esistente."
Errati=Errati+1
UtenteNonCreato=1
end IF
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' Sub CreateNewUserMailbox ()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function CreateNewUserMailbox(objUser, strLDAPUrl,strName)
On Error Resume Next
CreateNewUserMailbox = False
' Variables
Dim objMailbox 'As CDOEXM.IMailboxStore
' Get the IMailboxStore interface.
Set objMailbox = objUser
' Create a mailbox for the recipient on the specified Exchange
server.
objMailbox.CreateMailbox strLDAPUrl
'Enable immediate-logon for the user.
objUser.Put "msExchUserAccountControl", 2
' Save changes to the user object.
objUser.SetInfo
' Error handling.
If Err.Number <> 0 Then
WScript.Echo("*** '"& strName &"'" & " - MailBox non creata. "
& vbCrLf _
& "Errore= " & CStr(Err.Number) & " " &
CStr(Err.Description))
LogMessage "*** " & strName & " - MailBox non creata. " &
vbCrLf _
& "Errore= " & CStr(Err.Number) & " " &
CStr(Err.Description)
' Clean up.
Set objUser = Nothing
Set objMailbox = Nothing
CreateNewUserMailbox = False
Exit Function
End If
' Clean up.
Set objMailbox = Nothing
WScript.Echo("'" + strName + "' Mailbox creata.")
LogMessage strName & " - MailBox creata. " & vbCrLf
Mailbox = mailbox + 1
CreateNewUserMailbox = True
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' Sub AddSmtpAddress ()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function AddSmtpAddress(objUser,strSmtpAddress1,strSmtpAddress2)
Const ADS_PROPERTY_APPEND = 3
'// This adds a non-primary address. for primary use "SMTP:"
objUser.PutEx ADS_PROPERTY_APPEND, "proxyAddresses", array ("smtp:" &
strSmtpAddress1)
objUser.SetInfo
LogMessage "Aggiunto SMTP Address: " & strSmtpAddress1
WScript.Echo("Aggiunto SMTP Address: " & strSmtpAddress1)
objUser.PutEx ADS_PROPERTY_APPEND, "proxyAddresses", array ("smtp:" &
strSmtpAddress2)
objUser.SetInfo
'LogMessage "Aggiunto SMTP Address: " & strSmtpAddress2
'WScript.Echo("Aggiunto SMTP Address: " & strSmtpAddress2)
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' Sub Searchuser ()
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function Searchuser (strSearchUser)
strConnect = "LDAP://" & DomainController
set oContainer = GetObject(strConnect)
searchpath = oContainer.ADsPath
set oConnect = CreateObject("ADODB.Connection")
set oCommand = CreateObject("ADODB.Command")
'apre la connessione
oConnect.Provider = "ADsDSOObject"
oConnect.Open "Active Directory Provider"
Set oCommand.ActiveConnection = oConnect
strCN = strSearchUser
oCommand.CommandText = "SELECT samAccountName FROM '" & searchpath
& "' WHERE objectClass='user' AND samAccountName = '" & strSearchUser
& "'"
set rs = oCommand.Execute
'scorre il record set
if rs.EOF and rs.BOF then
Searchuser = 0 ' Crea l'utente
else
Searchuser = 1 'non crea l'utente
end if
end Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' Sub LogMessage()
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Sub LogMessage(Msg)
'Apre il file di scrittura
Set objFileSystem = CreateObject("Scripting.fileSystemObject")
Set objOutputFile = objFileSystem.OpenTextFile(strOutputFile,
OPEN_FILE_FOR_APPENDING,True)
'WScript.Echo msg
objOutputFile.WriteLine msg
objOutputFile.Close
End Sub
====================END: CreateUser-Mailbox.vbs================= Tag: Display # of Users on our Web Site Tag: 158380
ADSI SID-type attribute write
Hello everybody
I'm not still able to fill one attribute of SID-type when creating new user. (it's msExchMasterAccountSID). Is that any possibility to fill SID-type attribute using VBScript, or I have to use ldf file (as in http://support.microsoft.com/default.aspx?scid=kb;EN-US;278966
Thanx Tag: Display # of Users on our Web Site Tag: 158378
Msgbox or email Notification Function
Does anyone know if its possible to include something in the script so
that the script can determine if it was started by a user or the
sceduled task? The reason for this is that I would like to use MSGBOX
if the user manually started the script to display a notification, and
email if the script was started from a sceduled task event.
TIA,
Colin Tag: Display # of Users on our Web Site Tag: 158376
ADO: How to create database & table?
1. I know how to create *.mdb in VB using DAO. Is it possible to create
*.mdb in VBScript?
2. Is it possible to create a table withing an existing database *.mdb in
VBScript WITHOUT using SQL statement "create table ..."?
3. Is it possible to copy structure of an existing table in a database *.mdb
in VBScript WITHOUT using SQL statement "select * into newtable from
oldtable ..."? Tag: Display # of Users on our Web Site Tag: 158367
how to mail merge with word perfect
Is there a way to open up a Word Perfect object and perform a mail merge
using script?
I can do this with MS Word with the following code:
Dim objWord, objDoc
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open(TemplatePath)
objDoc.MailMerge.OpenDataSource DataPath
objDoc.MailMerge.Execute
objDoc.Close False
objWord.Visible = True
Is there a 'Word Perfect' equivalent to the above code?
Any clues would be appreciated. Thanks. Tag: Display # of Users on our Web Site Tag: 158363
script to enamurate os and installed MS Office version
hello,
I need a script that would enumerate OS and Installed software on member
computers and move computer accounts with specified software to specified
OU.
Thank you!
Eimis Tag: Display # of Users on our Web Site Tag: 158357
I have seen messages showing the number of individuals on a site at one time. Does anyone know how can I do this
"Tony" <nahsfca@zianet.com> wrote in message
news:811490B0-3FBF-46DC-9B94-DE66F16BE28B@microsoft.com...
> I have seen messages showing the number of individuals on a site at one
time. Does anyone know how can I do this?
>
> Thank You id Advance
>
> Tony