Share security setting
I am facing a problem regarding setting permissions on a share present
on a remote machine. I make a share on the remote machine and then I
have to set the access rights on that. I get the error "Not Found"
when I try to access the newly created share's
Win32_LogicalShareSecuritySetting to modify the Security Descriptor
for the share. How should I go about setting the access rights on the
new share? Tag: rename share and change its properties Tag: 160826
Changing the System Time
Hi,
Could anybody inform me how to change the system time. I am pretty sure that
I can catch the current system date with Date() and if incorrect change as
needed using date functions but I haven't figured out how to write back to
the system. Could anybody help with this.
Any help much appreciated.
Thanks
David Tag: rename share and change its properties Tag: 160824
vbscript to launch Outlook
Hi,
Does anyone have a vbscript that will launch Outlook?
Thanks,
Scott Tag: rename share and change its properties Tag: 160822
VBS debug
I need a debugger for VBScript but I have to use QPR API in my scripts
(QPR is a software I use).
Someone know how can I link QPR API to the debugger?
Thanks
Simone Tag: rename share and change its properties Tag: 160819
AD field names
Can anyone help me out with a few Active Directory field names, how to
find them, or what they are? I'm struggeling to find the the names
for;
- the user profile logon script
- the terminal services profile path
- I would also like to return the list of security permissions, and
the list of groups each user is a member of, but I have a feeling,
being a list they will be more complicated to return.
So far what I have works fine for the easy bits ( account name, email
address, NT profile path). I am building a database of User data for
our ID dept, and this part grabs info from AD, I will run this
regularly to update me DB. Here is some of what I have so far,
hopefully that will help you see what I'm doing.
Set oFSO = CreateObject("Scripting.FileSystemObject")
' Use ADO to search Active Directory.
Set oConnection = CreateObject("ADODB.Connection")
Set oCommand = CreateObject("ADODB.Command")
oConnection.Provider = "ADsDSOObject"
oConnection.Open "Active Directory Request"
Set oCommand.ActiveConnection = oConnection
' gets the DNS domain.
Set objRootDSE = GetObject("LDAP://RootDSE")
strConfig = objRootDSE.Get("configurationNamingContext")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
classFilter = "(&(objectCategory=person)(objectClass=user))"
strType = "user"
strAttributes = "sAMAccountName,objectClass,ADsPath,lastLogon,distinguishedName,userAccountControl"
sQuery = "<LDAP://" & strDNSDomain & ">;" & classFilter & ";" &
strAttributes & ";subtree"
oCommand.CommandText = sQuery
oCommand.Properties("Page Size") = 1000
oCommand.Properties("Timeout") = 60
oCommand.Properties("Cache Results") = False
Set oResults = oCommand.Execute
' Loop through oResults(the AD objects) and print out the results
Do Until oResults.EOF
Set oGroup = GetObject("LDAP://" & strDNSDomain)
Set oUser = GetObject(oResults.Fields("ADsPath"))
' Output results
Set file = oFSO.OpenTextFile(sLogFile, 8, True)
file.Write("SAM account name: " & oUser.SAMAccountName & "; ")
file.Write("E-mail address: " & oUser.Mail & "; ")
file.Writeline("User profile path: " & oUser.ProfilePath & "; ")
oResults.MoveNext
file.Close
Loop
oConnection.Close
At the moment all I think I'm after is the field that I would append
to oUser, eg something like oUser.LogonScript to return the logon
script, however it's not 'LogonScript' and I have tried everything I
can think of. I know there fields exist as I have filled them out in
AD in some cases myself.
Any help would be greatly appreciated.
Thanks Tag: rename share and change its properties Tag: 160814
Active X component can't create object
When I try to run the following script:
strRemoteComputer = "COMPUTER.NAME"
strWorkerScript = "Set_Default_Printer.vbs"
Set objWshController = WScript.CreateObject("WshController")
Set objRemoteScript = objWshController.CreateScript(strWorkerScript,
strRemoteComputer)
objRemoteScript.Execute
I get the following error:
---------------------------
Windows Script Host
---------------------------
Script:
Line: 4
Char: 1
Error: ActiveX component can't create object
Code: 800A01AD
Source: Microsoft VBScript runtime error
Any ideas on what I can do to solve this would be very welcome. I have
Administrative permission on the target computer so I'm pretty sure that is
not the culprit. The local script is in the same directory as the remote
run script too.
Thanks in advanced!
Mike A. Tag: rename share and change its properties Tag: 160807
Regisration wall for static pages?
Could anyone offer some pointers on how to use a registration wall or email
address to control access to a myriad of static pages we have running on
multiple sites on our remote web host....
I have built a 'pinch point' web form wall that the user has to go
through...see here: http://www.catamarans.com/sales/promotions/
I set four paramenters: From Url, From Section, Target url, target
section....BUT...there is no underlying database.......I am looking for a
simple solution that would probably
work off a basic inventory and customer database but it needs to be
flexible...I would assume if the user has already registered he would only
have to enter his email address the next time...
but is even this asking too much.....
Anyway, would appreciate any advice on the above.
Best Regards
Jason
The Catamaran Company
www.catamarans.com Tag: rename share and change its properties Tag: 160803
NTFS Permissions
Hello,
Using the capabilities of VBScript, is there way to determine the NTFS
permissions assigned to either a file or directory? Tag: rename share and change its properties Tag: 160802
Problem with Arrays and VBScript
Attempting to load an array from a recordset. When I do a Ubound on
this array, it returns the number 2, this can't be. I have 23 records
in the array because I can print the items as they are loaded and have
verified that they are loading.
Any ideas?
"
dim userid_fk,sqlstmt,rs,x,i,checkVar
dim rsArray()
userid_fk = session("s_userid")
set rs=Server.CreateObject("adodb.Recordset")
connectme="DSN=psu_dsn"
datelastupdate = date
timelastupdate = time
SQLstmt = "select distinct
user_tbl.firstname,user_tbl.lastname,class_tbl.title "
sqlstmt = sqlstmt + "from user_tbl,class_tbl,class_user_inter_tbl "
sqlstmt = sqlstmt + "where user_tbl.user_id =
class_user_inter_tbl.user_id and "
sqlstmt = sqlstmt + "class_tbl.class_id =
class_user_inter_tbl.class_id "
sqlstmt = sqlstmt + "order by
user_tbl.lastname,user_tbl.firstname,class_tbl.title"
rs.open SQLstmt, connectme
x=0
do while not rs.eof
firstname = rs("firstname")
lastname = rs("lastname")
title = rs("title")
redim rsArray(2,x)
rsarray(0,x) = lastname
rsarray(1,x) = firstname
rsarray(2,x) = title
rs.movenext
x=x+1
response.write x
loop
response.write ubound(rsArray)
rs.close
end sub
" Tag: rename share and change its properties Tag: 160800
AutoIT and VBScripts
Good Evening,
I am trying to find out if anyone can help me out with this solution.
I want to execute a .vbs script from a AutoIT script.
Is this possible?
Thanks in advance Tag: rename share and change its properties Tag: 160796
Any way to get running process command argument?
I use this code to look at properties of a process
Set objWMIService = GetObject("winmgmts:" & _
"{impersonationLevel=Impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Process
...")
For Each objItem in colItems
Wscript.Echo objItem.Name
...
The Name or Caption property shows the command such as notepad.exe.
ExecutablePath shows the full path. If the process is "notepad
myfile.txt", how do I see "myfile.txt"? I looked at all properties of
Win32_process and none shows that info. Thanks for help.
Yong Huang Tag: rename share and change its properties Tag: 160795
Modify pwdLastSet
Hello all,
Is it possiable to set the AD user attribure "pwdLastSet" to a
predetermined date (e.g. 127343762156911250 = 7/15/2004 10:43 AM)
Thank you. Tag: rename share and change its properties Tag: 160791
Regular Expression Problem
I'm trying to learn Regular expressions and can't seem to find out how
to perform the following.
From the following text, I want to capture everything between the Word
"QUESTION" and the character "?" and store it in a variable called Q1,
Q2, Q3, etc...
Here is the text:
<snip>
QUESTION 1 You want to provide complete redundancy for all data stored
on your
hardware RAID-5 disk array. You install a second hardware RAID-5 disk
array. You
want to create a mirror of the original array on the new array.
However, when you rightclick
the free space on the new array in Disk Management, you see no option
to create a
new volume or a mirrored volume.
Before you create a mirrored volume on the new array, what should you
do?
A. Convert both arrays to dynamic disks.
B. Create an empty single extended partition on the new disk array.
C. Create a single unformatted primary partition on the new disk
array.
D. Format the new disk array as a single NTFS primary partition.
E. Format the new disk array as a single NTFS logical drive in an
extended partition.
Answer: A
QUESTION 2 You install a second modem on a Windows 2000 Server
computer
configured with Routing and Remote Access. Dial-in users report that
they are unable to
connect to the server by using the new modem.
What should you do to help find out the cause of the problem?
A. Use the Routing and Remote Access snap-in to find out whether the
ports for both
modems are operational.
B. From a command prompt, run the Net Config Server command.
C. From a command prompt, run the Net Statistics command.
D. Use Regedt32 to view the Error Control value in the
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\RemoteAccess key.
Answer: A
QUESTION 3 You are the network administrator of a Windows 2000
network. Your
network contains five Windows 2000 Server computers and 100 Windows
2000
Professional computers. You want to deploy an update for an
application that is used on
the Windows 2000 Professional computers. You want users to
automatically install the
update when they log on to the domain.
What should you do?
A. Create a distributed file system (DFS).
Place the application update in the root folder of the DFS.
B. Create a Microsoft Windows Installer package for the application
update.
Configure RIS to use the package.
C. Create a Microsoft Windows Installer package for the application
update.
Apply the package to the Local Computer Policy on all of the
computers.
D. Create a Microsoft Windows Installer package for the application
update.
Apply the package to a Group Policy.
Answer: D
<snip>
Does anyone know how to caputre all character between two items? Tag: rename share and change its properties Tag: 160788
passing a variable to the registry
I'm trying to put the %computername% variable as a value to a key in
the registry, but the application that uses that key inputs it as
%computername% in the application and not the actual computername.
Should you be able to use variables in the registry? I have looked
everywhere for this info. The closest I came is finding a link to a
freeware utility (REGENV) that supposedly does it, but the link was
dead.
I didn't know which forum to ask this question in. These types of
newsgroups seem to know more then your average windows newsgroup.
Thanks,
Scott Tag: rename share and change its properties Tag: 160785
JavaScript - VBScript - VBArray
Wow, been using VBScript forever. Just recently started using Javascript more
and more (I used to do a lot of Javascript, but switched because we weren't
allowed to where I work...now we can).
So, now that I have the knowledge of the scripting objects, I tried implementing
the Scripting.Dictionary object in JavaScript (passing it back and forth to
VBScript contained in an IE window). Ya know, you have to go through a few hoops
to get the Dictionary to function properly in Javascript.
IE:
var dict = new ActiveXObject('Scripting.Dictionary');
dict.Add('Key1', 'Value1');
dict.Add('Key2', 'Value2');
dict.Add('Key3', 'Value3');
var keys = new VBArray(dict.Keys()).toArray();
var vals = new VBArray(dict.Values()).toArray();
// To iterate through the arrays using an index...
for (var i = 0; i < keys.length; i++) {
// Just storing the value into a buffer.
buf += '\n' + keys[i] + ' = ' + vals[i];
}
Kinda nuts eh? Darn SafeArrays.
Mythran Tag: rename share and change its properties Tag: 160778
EnumValues method of the
Hi,
I need some help understanding how to use the EnumValues method of the
stdregprov class. I used stdregprov ok with a Moniker on my machine but now
I need to use it with WbemScripting in order to connect to remote servers
passing explicit user /pw credentials.
Thanks,
Yaniv Tag: rename share and change its properties Tag: 160773
ADsSecurity.dll
Hello all,
does ADsSecurity work on a windows 2000 server? I can only seem to make
it work in XP
When i run my script on a windows 2000 server i get the following error
message:
<ERROR>
C:\tmp\regkeyperms.vbs(102, 1) Microsoft VBScript runtime error: ActiveX
compone
nt can't create object: 'ADsSecurity'
<\ERROR>
THank you alll for your help Tag: rename share and change its properties Tag: 160772
WScript.Arguments()
Hi,
I have a command line script that accepts arguments. The problem I face is I
fell to use the functions IsNull & IsEmpty in order to validate the
arguments. I receive the follwoing error: Microsoft VBScript runtime error:
Subscript out of range.
I do not wish to restrict the user to supply all 4 arguments by using the
Count property but instead I need to know if a specific argument is empty.
Thanks,
Yaniv Tag: rename share and change its properties Tag: 160770
Regular expression question
I'm trying to learn Regular expressions and can't seem to find out how
to perform the following.
From the following text, I want to capture everything between the Word
"QUESTION" and the character "?" and store it in a variable called Q1,
Q2, Q3, etc...
Here is the text:
<snip>
QUESTION 1 You want to provide complete redundancy for all data stored
on your
hardware RAID-5 disk array. You install a second hardware RAID-5 disk
array. You
want to create a mirror of the original array on the new array.
However, when you rightclick
the free space on the new array in Disk Management, you see no option
to create a
new volume or a mirrored volume.
Before you create a mirrored volume on the new array, what should you
do?
A. Convert both arrays to dynamic disks.
B. Create an empty single extended partition on the new disk array.
C. Create a single unformatted primary partition on the new disk
array.
D. Format the new disk array as a single NTFS primary partition.
E. Format the new disk array as a single NTFS logical drive in an
extended partition.
Answer: A
QUESTION 2 You install a second modem on a Windows 2000 Server
computer
configured with Routing and Remote Access. Dial-in users report that
they are unable to
connect to the server by using the new modem.
What should you do to help find out the cause of the problem?
A. Use the Routing and Remote Access snap-in to find out whether the
ports for both
modems are operational.
B. From a command prompt, run the Net Config Server command.
C. From a command prompt, run the Net Statistics command.
D. Use Regedt32 to view the Error Control value in the
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\RemoteAccess key.
Answer: A
QUESTION 3 You are the network administrator of a Windows 2000
network. Your
network contains five Windows 2000 Server computers and 100 Windows
2000
Professional computers. You want to deploy an update for an
application that is used on
the Windows 2000 Professional computers. You want users to
automatically install the
update when they log on to the domain.
What should you do?
A. Create a distributed file system (DFS).
Place the application update in the root folder of the DFS.
B. Create a Microsoft Windows Installer package for the application
update.
Configure RIS to use the package.
C. Create a Microsoft Windows Installer package for the application
update.
Apply the package to the Local Computer Policy on all of the
computers.
D. Create a Microsoft Windows Installer package for the application
update.
Apply the package to a Group Policy.
Answer: D
<snip>
Does anyone know how to caputre all character between two items? Tag: rename share and change its properties Tag: 160768
Start HTA from VBA with param
Hi,
this should be simple: I want to start a hypertext application from VBA (I
know; not vbs: in this case I use MSAcccess). The hypertext application uses
a parameter, so from the commandline this works fine:
"C:\Program Files\BMBConnect\BMBConnect.hta" -748172
But I'm unable to start this from script. It should be something like this
AppName="""C:\Program Files\BMBConnect\BMBConnect.hta"" -748172"
X = Shell(AppName, 1)
When I try to open IE with this HTA the whitespace after 'hta' is encoded,
and I get the message that the hta file cannot be found.
How can I do this?
Thanks,
Albert Jan Tag: rename share and change its properties Tag: 160767
knowing if the user has changed the ContactItem.Notes field
This is a multi-part message in MIME format.
------=_NextPart_000_000A_01C46E36.F877B2E0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
This doesn't display anything after the user updates the Notes/Body =
field on a custom Contact form. It does work on the other fields on the =
form.
Sub Item_PropertyChange(ByVal Name)
msgbox Name & " was changed"
end sub
Any ideas what's going on? Is there a way I can tell when the value of =
the Notes/Body field is changed by a user?
Thanks.
------=_NextPart_000_000A_01C46E36.F877B2E0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>This doesn't display anything after the =
user=20
updates the Notes/Body field on a custom Contact form. It does work on =
the other=20
fields on the form.</FONT></DIV>
<DIV><FONT size=3D2><FONT face=3DArial =
color=3D#0000ff></FONT></FONT> </DIV>
<DIV><FONT size=3D2><FONT face=3DArial color=3D#0000ff>Sub =
Item_PropertyChange(ByVal=20
Name)</FONT></DIV>
<DIV>
<P><FONT face=3DArial color=3D#0000ff>msgbox Name & " was =
changed"</FONT></P>
<P><FONT face=3DArial color=3D#0000ff>end sub</FONT></P>
<P><FONT face=3DArial>Any ideas what's going on? Is there a way I can =
tell=20
when the value of the Notes/Body field is changed by a =
user?</FONT></P>
<P><FONT face=3DArial>Thanks.</FONT></P></FONT></DIV></BODY></HTML>
------=_NextPart_000_000A_01C46E36.F877B2E0-- Tag: rename share and change its properties Tag: 160765
Max script size in IE6 on W98
This is a multi-part message in MIME format
------=_NextPart_000_54627233
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
I hope this is the right forum.
I have a 90k web page that is primarily client VBscript that displays OK
in IE6 on W2k & XP, but NOT on most W98 incl. SE machines.
Is there a size (or any other sort of) limitation on client scripts?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
------=_NextPart_000_54627233
Content-Type: text/html; name="_alt.0"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="_alt.0"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4=2E0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html;=
charset=3Diso-8859-1">
<META content=3D"MSHTML 5=2E50=2E4937=2E800" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>"Thara DK" <</FONT><A
href=3D"mailto:Tharadk@hotmail=2Ecom"><FONT face=3DArial
size=3D2>Tharadk@hotmail=2Ecom</FONT></A><FONT face=3DArial size=3D2>>=
wrote in
message </FONT><A=
href=3D"news:ep9F01jbEHA=2E3664@TK2MSFTNGP12=2Ephx=2Egbl"><FONT
face=3DArial=
size=3D2>news:ep9F01jbEHA=2E3664@TK2MSFTNGP12=2Ephx=2Egbl</FONT></A><FON=
T
face=3DArial size=3D2>=2E=2E=2E</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>> How can i display a msgbox with=
Yes No cancel
and yes to all Or Yes No<BR>> cancel and No to All
Buttons=2E=2E=2E<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT size=3D2><FONT face=3DArial>How about 3 out of=
4?</FONT></DIV></FONT>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>MsgBox "MsgBox
Text",vbYesNoCancel+vbQuestion,"MsgBox Title"</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT face=3DCourier
size=3D1>Constant &n=
bsp;
Value Description </FONT></DIV>
<DIV><FONT face=3DCourier size=3D1>------------------ -----
-----------------------------------------<BR>vbOKOnly =
0=
Display OK button
only=2E <BR>vbOKCancel =
1 Display OK and Cancel
buttons=2E <BR>vbAbortRetryIgnore 2=
Display Abort,
Retry, and Ignore
buttons=2E <BR>vbYesNoCancel &nbs=
p;
3 Display Yes, No, and Cancel=
buttons=2E <BR>vbYesNo
4=
Display Yes
and No buttons=2E <BR>vbRetryCancel
5 Display Retry and Cancel
buttons=2E <BR>vbCritical =
16 Display Critical Message=
icon=2E <BR>vbQuestion
32 Display Warning=
Query
icon=2E <BR>vbExclamation =
48
Display Warning Message=
icon=2E <BR>vbInformation
64 Display Information Message=
icon=2E <BR>
vbDefaultButton1 0 First=
button is
default=2E <BR>vbDefaultButton2 256=
Second button is
default=2E <BR>vbDefaultButton3 512=
Third button is
default=2E <BR>vbDefaultButton4 768=
Fourth button is
default=2E <BR>vbApplicationModal 0=
Application
modal=2E <BR>vbSystemModal 4096=
System
modal=2E<BR></DIV></FONT></BODY></HTML>
------=_NextPart_000_54627233-- Tag: rename share and change its properties Tag: 160762
messagebox yes no cancel yestoAll
How can i display a msgbox with Yes No cancel and yes to all Or Yes No
cancel and No to All Buttons... Tag: rename share and change its properties Tag: 160760
How Determine JVM installed Programmatically ????
How can I determine whether the Microsoft Java Virtual Machine (JVM) is
installed on my computer
Programmatically by using Vb Scripy...? Tag: rename share and change its properties Tag: 160756
conversion string between charactersets?
Hi
My data in my database is big5 encoded. How I can convert them to UTF-8?
Many thanks, Tag: rename share and change its properties Tag: 160753
Why does this fail sometimes?
Sorry, couldn't think of a better title.
I have this script intended to see if somebody is logged onto a remote PC.
If so (under certain circumstances), I open up a reminder prompt on that PC.
I am using what I take to be a standard generic method, and it -did- work.
Problem is that now, it shows that nobody is logged in, even when they are.
It works OK when I query my machine and the other machines in my office, but
not the remote machines. I am wondering if it involves some obscure network
setting or something.
The guts of the routine are below.
=======================
strComputer = "whs147"
On Error Resume Next
Dim strUser
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
strUser = "NA"
For Each objComputer in colComputer
If cstr(objComputer.UserName) <> "null" Then
strUser = cstr(objComputer.UserName)
End If
Next
If strUser <> "NA" Then
MsgBox "User logged on: " & strUser
Else
MsgBox "Nobody logged on"
End If Tag: rename share and change its properties Tag: 160750
Add a registry key
Hello all:
I need to add an entry to the following:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet
Settings\zonemap\Domains\
like webex.com
any suggestions? Tag: rename share and change its properties Tag: 160743
scripting.filesystemobject
I have a logging sub routine, that writes log records to a text file. The
sub routine is copied below... The issue I have, is that this file can get
very large and as the process runs, it gets slower and slower, with the size
of the file getting very big.
Is there any way, with the scripting object, to only append to the text
file, without having to read the entire file into a variable and then append
to the variable, then write the variable back to the file.... Something like
the normal VB command of 'open for append as #1', which allows the text
record to write to the end of the file, without having to read the entire
file into memory. Is the scripting.filesystemobject, the correct object to
use, or is there another object that should be used?
This is a vbs script, but I have tried using the object browser (with the
Microsoft Scripting Runtime reference loaded) and it does not show any
'append' type method...
sub doLogging(inRecord)
dim fsoObject 'As script object
dim strText 'As string
set fsoObject = CreateObject("Scripting.FileSystemObject)
with fsoObject.OpenTextFile("c:\log.txt")
strText = .ReadAll
.Close
end with
fsoObject.DeleteFile "c:\log.txt", True
strText = strText & vbCrLf
if trim(inRecord) <> "" then strText = strText & inRecord
with fsoObject.CreateTextFile("c:\log.txt")
.Write strText
.Close
end with
set fsoObject = nothing
end sub Tag: rename share and change its properties Tag: 160741
Listing duplicate machines in AD
Is there a way to list computer that have a duplicate GUID in AD?
Pierre Tag: rename share and change its properties Tag: 160740
catch a field's value before and after it is updated
This is a multi-part message in MIME format.
------=_NextPart_000_0008_01C46D9D.ECEF3810
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I'm trying to figure out a way to write a field's before and after =
update values to a text field on a customized Contact form.
I've got the Item_PropertyChange event catching the name and value of =
the field after it's changed. And I've got writing to the text field =
working. I'm used to the item.OldValue property that's available in an =
Outlook form. But this doesn't seem to be a property of a field from =
vbscript.
The best I can see is that I could capture the values of each of the =
fields I'm interested in into a module variable on the item's Item_Open =
or Item_Read event, then build a case statement in the =
Item_PropertyChange event.
Anyone got any simpler approaches?
------=_NextPart_000_0008_01C46D9D.ECEF3810
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I'm trying to figure out a way to write =
a field's=20
before and after update values to a text field on a customized Contact=20
form.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I've got the Item_PropertyChange event =
catching the=20
name and value of the field after it's changed. And I've got writing to =
the text=20
field working. I'm used to the item.OldValue property that's available =
in an=20
Outlook form. But this doesn't seem to be a property of a field from=20
vbscript.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>The best I can see is that I could =
capture the=20
values of each of the fields I'm interested in into a module =
variable on=20
the item's Item_Open or Item_Read event, then build a case =
statement=20
in the Item_PropertyChange event.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Anyone got any simpler=20
approaches?</FONT></DIV></BODY></HTML>
------=_NextPart_000_0008_01C46D9D.ECEF3810-- Tag: rename share and change its properties Tag: 160738
Event Log Management
I would like to write a script that dumps the Security event log to a file
called %machine%_%date%_Security.txt and then clears the event log. I am
successfull in dumping the log but I have been unsuccessful in clearing the
event log; Anyone have a sample that shows how to save them clear a given
log?
Thanks Tag: rename share and change its properties Tag: 160729
Schedule ASP page
Hello, all. We need to schedule an ASP page to run hourly/daily, which
generates a static HTML (*.htm) page. Is this possible with VBS? If so, are
there any examples out there? Thank you much. Tag: rename share and change its properties Tag: 160728
Map Printers with login script
I am looking for a way to map users printers at login. We have an AD
environment and I want to push this out using a group policy. Does anyone
have any pointers on how I can do this.
Thanks
Gavin... Tag: rename share and change its properties Tag: 160727
unlock machine programmatically
Hello there
is there a way to unlock a machine programmatically ?
same as using rundll32.exe user32.dll,LockWorkStation for lock it?
Regards
Sameh Tag: rename share and change its properties Tag: 160726
DatePart not working completely
I have a DTS in Microsoft SQL Server in which I am writing an ActiveX Script
Task using VB Script Language.
I need to build a string for current date and time in this format :
YYYYMMDDHHMMSS. So I wrote this code :
Dim v_CurrentDate
Dim v_DateString
v_CurrentDate = Date
DateString = DatePart ( "yyyy", v_CurrentDate ) & _
Right ( "0" & DatePart ("m", v_CurrentDate), 2 ) & _
Right ( "0" & DatePart ("d", v_CurrentDate), 2 ) & _
Right ( "0" & DatePart ("h", v_CurrentDate), 2 ) & _
Right ( "0" & DatePart ("n", v_CurrentDate), 2 ) & _
Right ( "0" & DatePart ("s", v_CurrentDate), 2 )
But the above code is only working correctly for year, month and day part
but not the hours, month and seconds. The result I am getting is :
DateString = 20040719000000
My question is why hours, month and seconds are being returned as 000000?
What mistake I am making here?
Thanks Tag: rename share and change its properties Tag: 160725
Install setup.exe with silent install switch -s -f1\\setup.iss
I'm having a bear of a time figuring this out.
I need to install Thinprint which is a program used with Citrix to solve
printing issues. They do not provide a .msi file so I use a setup.exe with
a silent install script recorded as setup.iss.
I have tried for 3 days to get this working to deploy to all my domain's
PCs.
My company use to have every as a domain admin so that they would have local
admin rights. WSe'll, when I was hired I removed domain admin rights and
made them just local user permissions on PCs. Now this is the first big
software rollout and I look like an idiot. I can't get the setup.exe to
run.
I have a login script were it work, but only if they are a local admin. If
they aren't, the msiexec.exe and setup run in task manager but it just sits
there for hours.
This weekend I tried the GPO startup to get it to run as the system account.
I still have the same issues.
I tried .bat, .vbs, .whs and I just can't get it to work.
I have the install and silent install file on a public drive which users map
H: to. So this is the command I try to run.
H:\setup -s -f1h:\setup.iss
I have also tried unc.
\\server\public\setup -s -f1\\server\public\setup.iss
I have used runas and psexec to run with admin permissions. I must be doing
the command line wrong or something. I programed a little delphi .exe
program to run the command. It works but with only if admin rights on the
PC.
Can someone hold my hand and actually give me the code or examples? I
searched google for hours doing research to run my script 100 different
ways. Non work. I've got to be missing something very simple. Tag: rename share and change its properties Tag: 160724
LDAP Script
Does anyone know of/have a script that can be used in a web page for users
to change their own GAL details using LDAP? Tag: rename share and change its properties Tag: 160721
Internet Connection Check
This has probably been asked before but anyway, Is it possible, using
VBScript, to check whether a connection to the internet is connected? Also,
what is the best way to start a connection to the internet using VBScript?
Thanks in advance!!! Tag: rename share and change its properties Tag: 160716
Event Logs Backup ans save
Hello. Using some of the scripts from Microsoft Technet I
am able to clear and backup the event logs on server then
copy them to a folder on a remote share. This is ok but
to run this script on other servers I would need to edit
the script each time by putting in the server name. I
would like the server event logs to backup to a folder
the same as the computer name ie: "Server A" would backup
to a folder on the remote share called "Server A". I
would like this to happen without having to put the
computer name into the script, so that if the script is
run on "server A" then it would create and backup to a
folder called "Server A" on the remote share. I really
hope this makes sense. Here is the script.
dtmThisDay = Day(Now)
dtmThisMonth = Month(Now)
dtmThisYear = Year(Now)
strBackupName = dtmThisYear & "_" & dtmThisMonth & "_" &
dtmThisDay
strComputer = "SERVER A"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Backup)}!\\" & _
strComputer & "\root\cimv2")
Set colLogFiles = objWMIService.ExecQuery _
("Select * from Win32_NTEventLogFile where
LogFileName='system'")
For Each objLogfile in colLogFiles
objLogFile.BackupEventLog ("c:\Install\Event Logs\" &
strBackupName & _
"_system.evt")
objlogFile.ClearEventLog()
Const OverwriteExisting = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "C:\Install\Event
Logs\*.*" , "\\remoteserver\elogs$\ServerA\" ,
OverwriteExisting
Next Tag: rename share and change its properties Tag: 160714
CDO, MAPI VBScript just stops
Hi
I have a VBSCRIPT which scans through a Public folder called
AUTO-RESPONSE. Under AUTO-RESPONSE, there are 20 or so Sub folders
with POSTS in them. Each item as a User-Defined Folder variable called
DAYS.
I have three scripts. The first one increments the DAYS value by one
each day. There are probably 7000 items which it updates in 5
minutes.. No problems here.
The other two scripts run at each day and looks for 3 day or 6 day
items, then sends an email to the recipient, then if it is a 6 day
email, deletes the email.
Ok... both scripts are exactly the same, except the 3 or 6 day check
and the message delete. Both scripts behave the same. That is:
They start processing, looking at each subfolder and if it finds the
3/6 in the DAYS field processes the message. This works fine for a
short time, then the script just stops as though it has finished. The
script is not hanging, the wscript just disappears from the w2k
process list. It seems to have only prcessed about 20 mail items,
sometimes 50, but always less than 60. If I run the script again (say
for the 6 day which has deleted the previous emails as required) it
starts where it "left off" in the previous run, might go 10, 20 items
then again disappears/stops.
I have a debug log being written at every crucial area that could
cause an error, but an error is never generated.
Has anyone seen this behaviour? I have included the whole subroutine
for your scrutinization.. (Variables not defined in the sub are Global
Vars and have the correct valuse loaded before calling the routine.) I
hope that you can either see the issue,or offer a better way of doing
the process...
Thanks Robert
Sub DoSubFolders
Dim nLoop
Dim iLoop
'Loop through each folder, check it has a * in the first column and
process each message.
for nLoop = 1 to objFolder.Folders.count
set objSubFolder = objFolder.Folders(nLoop)
if err.number <> 0 then
' Write debug info
If blnLogFileOpen = True Then
objFile.WriteLine "Folder error (" & objSubFolder.name & ") -
Error: " & err.Description
End If
end if
err.Clear
if left(objSubFolder.name,1) = "*" then
' Write debug info
If blnLogFileOpen = True Then
objFile.WriteLine "Folder: " & objSubFolder.name & ", messages to
check: " & objSubFolder.Messages.count
End If
'Find All messages in the Folder and send response to recipient
if objSubFolder.Messages.count > 0 then
set objMessages = objSubFolder.Messages
For iloop = 1 to objMessages.count
err.Clear
numDays = 0
Set objMessage = objMessages.Item(iLoop)
set objFields = objMessage.fields
if err.number <> 0 then
' Write debug info
If blnLogFileOpen = True Then
objFile.WriteLine " Message Field Error - Error: " &
err.Description
End If
end if
err.Clear
set objField = objFields.item("Days")
numDays = cint(objField)
if err.number <> 0 then
' Write debug info
If blnLogFileOpen = True Then
objFile.WriteLine " NumDays Error - Error: " &
err.Description
End If
end if
err.clear
'If numDays = 6 then we need to send the email
if numDays = 6 then
Set objSMail = CreateObject("Redemption.SafeMailItem")
objSMail.Item = objMessage
strType = objSMail.Fields(PR_SENDER_ADDRTYPE)
Set objSenderAE = objSMail.Sender
If Not objSenderAE Is Nothing Then
If strType = "SMTP" Then
mailTO = objSenderAE.Address
ElseIf strType = "EX" Then
mailTO = objSenderAE.Fields(PR_EMAIL)
End If
mailSUB = objsMail.Subject
End If
Set objSenderAE = Nothing
Set objSMail = Nothing
if err.number <> 0 then
' Write debug info
If blnLogFileOpen = True Then
objFile.WriteLine " Message Error - Error: " &
err.Description
End If
end if
err.Clear
'OK.. Got Email Body, send email
set objMail = CreateObject("CDONTS.NewMail")
objMail.BodyFormat=1
objMail.MailFormat=0
objMail.To = mailTO
objMail.From = mailFROM
objMail.Subject = mailSUB
objMail.Body = MailBody
objMail.Send
set objmail = nothing
if err.number <> 0 then
' Write debug info
If blnLogFileOpen = True Then
objFile.WriteLine " Send Message Error - Error: " &
err.Description
End If
else
' Write debug info
If blnLogFileOpen = True Then
objFile.WriteLine " Email sent to: " & mailTo & ", Subject:
" & mailSUB
End If
end if
'Delete Mail Message
objMessage.delete
if err.number = 0 then
If blnLogFileOpen = True Then
objFile.WriteLine " 6 Day Email deleted"
End If
else
If blnLogFileOpen = True Then
objFile.WriteLine " Could not delete email. Err: " &
err.Description
End If
end if
err.Clear
Set objMessage = nothing
set objFields = nothing
set objField = nothing
err.Clear
end if
Next
end if
end if
next
End Sub Tag: rename share and change its properties Tag: 160713
"generic" code to retrieve any type of WMI info - possible in VBScript?
Hello all--
After a few hours of playing around ... and many, many hours of
searching ... I am not able to find an answer to my problem -- so I'm
hoping that the bright minds here might be able to help.
I'm working on a project to monitor various components of our
enterprise network via WMI. Being that VBScript/ASP are my primary
programming skills these days, I was planning on writing an interface
in ASP that would write items to an Access or SQL database, and then a
VBScript process which could query the database and submit WMI lookups
against hosts and log the data returned.
I know how to do all of the pieces required except one -- making a WMI
query mechanism that is "generic" enough to handle any type of data I
might want to retrieve (or at least typical sets such as numeric,
string, boolean, etc.) The problem that I have, is that the values
must be called specifically depending on what the data is. So, for
instance, if I want to get the temperature out of the system I have to
specifically call the ".CurrentTemperature" property within the code.
For example....
strComputer = "localhost"
set wbemServices = GetObject("winmgmts:\\" & strComputer &
"\root\wmi")
set wbemObjectSet =
wbemServices.InstancesOf("MSAcpi_ThermalZoneTemperature")
For Each wbemObject In wbemObjectSet
WScript.Echo "InstanceName : " & wbemObject.InstanceName
WScript.Echo "Current Temperature: " &
wbemObject.CurrentTemperature
Next
This works great - but it's just not generic for the several hundred
types of queries I can imagine running. I can't define a variable of
"CurrentTemperature" and call it at the end of the wbemObject. - it
just doesn't work that way (nor did I expect it would). Therefore, I
need something generic. I want to be able to create an Access
database record which would simply define the object set
(MSAcpi_ThermalZoneTemperature) and the property within that set
(CurrentTemperature) to check, and then handle that with generic
variables which can then post the data to Access, analyze it for
violating a threshold, etc.
(Apologies if I don't have the lingo quite right - I haven't actually
"officially" been a programmer for over a decade)
Hopefully I've gotten my point across and you might understand where
I'm headed with this. I'd moat likely make the framework an
open-source project as a simple and easy-to use network monitoring
system.
Thanks in advance!
-Douglas Toombs Tag: rename share and change its properties Tag: 160705
writing to an .ics file
How can I write to an .ics file in this format. It is pulling
information from a database
FirstName:John
LastName:Doe
City:Philadelphia
State:PA
ZipCode:19104
FirstName:Jane
LastName:Dorris
City:Lakewood
State:NJ
ZipCode:08701 Tag: rename share and change its properties Tag: 160703
A few questions for you VBScript Gurus!!!
Hello All,
I am new to VBScript and was hoping for some pointers. Basically, I created
a DOS batch file at work that allows us to install several software packages
in order after we tell it which drive to launch the packages from. The DOS
batch file works like a dream, however, I would like to use VBScript to take
this to the next level. I have figured out how to do certain things like
display system specs and stuff like that, but some of the basic concepts are
giving me problems. Here are the questions I have:
1. After setting up an Input Box that has the buttons OK and Cancel, how
can I program the script to exit the program if the button Cancel is
pressed? As it stands right now, regardless if the OK or Cancel button is
pressed, the script will carry on to the next line of code.
2. In the DOS batch file, I was easily able to set up labels and tell DOS
if a certain condition was met, goto label, If condition wasn't met goto
this label. Basically, I was easily able to direct my script to jump to
different parts of my code just by using the goto xxxx. Can I do this in
VBScript? Right now, it seems like the Select Case and Do Loops just
doesn't fit my needs but that is probably because I don't know how to use
them properly for what I am trying to do.
3. I am currently using NotePad to develop my scripts and it is ok for the
most part. However, if I run the program and receive an error in line 77, I
have to count all the way down just to find out the line. Please tell me
there is a better way! Right now I have decided to break my code down into
sections and run one part at a time in seperate scripts just to see if it
works.
4. Is there a way that I can display colored text in a message box? The
goal is to have the system specs displayed and if any part of the system
specs doesn't meet my software requirements, then I want it to display
additional text (that is red) pointing this out.
Any help or advise would be appreciated. Thanks in advance! Tag: rename share and change its properties Tag: 160699
HELP: Mapping Network Drives and Trapping Errors to Return Success
Hello,
I wonder if anyone can help me. I want to be able to use VBScript as
part of a logon script to map a network drive and to return a error on
the basis of weather the mapping was successful or not.
Does anyone know how to do this?
I'm using the MapNetworkDrive function of the WScript.Network object to
do the mapping.
I've enabled "On Error Return Next" and getting the value in Err.Number
however I do not know what codes are returned on success or failure.
Any ideas?
If i can't map drives
Hardeep. Tag: rename share and change its properties Tag: 160696
Cannot use win word in IE
Dear all,
I try to write a vbscript to open the word2000 in IE from some clients'
computers; however, IE always report the error "The client has refused this
request" from the line "set abc = createobject("Word.Application")" . I
have checked the Task Manager and I found that the word has been called in
the task manager. Can anyone help me to solve this problem? Thank you for
all of your help. Thank you.
Alex Tag: rename share and change its properties Tag: 160693
Variable redefine
Hi everybody,
In an ASP page, I need to load twice an include file that contains
variables. So I get an error message "variable redefine" I tried to test
with VarType before to define the variable (dim) with no success. Is it
faisable with VBScript to define a variable (dim) under condition.
' this code gives an error
if VarType("MyVar") = vbNull then
dim MyVar
end if
many thank's
serge Tag: rename share and change its properties Tag: 160692
Accessing WSH objects from within IE
The code works fine in the W2K pro environment but why won't it work within
a web page. I keep getting a cannot create object error. Is there a
workaround so you can access Active Directory from within IE6?
Thanks,
Jim
Option Explicit
Dim oNetwork, UserName
Set oNetwork = CreateObject("WScript.Network")
username = oNetwork.username
MsgBox username Tag: rename share and change its properties Tag: 160690
VBS Logoff disconnected user
This must have been asked before, but I can't find it in groups, the
web, or msdn. Is there a way to log off a disconnected user (XP via
fast user switching) through .vbs? I can logout the currently logged
in and active user, but I want to log out everyone who isn't running a
console session. Any idea?
Josh Tag: rename share and change its properties Tag: 160689
Frame="All" Not Working
I have taken over a Web Site. The Default Page is in two frames. When I go to display the page below, it will not display as a full page (or frame). Been at this four days and for the life of me I do not know what is wrong. This works with two other pages, but not this one!
<Html>
<Head>
<Title> Information for Parents </Title>
</Head>
<Form Name="Default" Method="GET" Action="../Default.htm">
<Body bgcolor="#FFFFFF">
<Font Face="Courier New" size="3"><Strong>
<Center>
<Table Border="3" Frame="All" CellPadding="1" CellSpacing="2">
<Caption Align="Top"><B>Parents</B></Caption>
<tr>
<td>Parents
want the best education for their children. We understand that each school community has
its unique needs. Our goal is to provide your family with a positive learning environment,
the finest educational programs, and services that promote outstanding student
achievement.
Parents are children's first and life-long teachers. We value the partnership between home
and school and recognize that parental involvement is the key to success in school. You can
be involved by helping your child with homework, volunteering in our schools, or joining a
school council. By welcoming and providing opportunities for you to be involved, we can
work together to ensure that children receive the very best education.<BR></font></td></Tr>
<BR>
</Table>
<A Href="../Hatch.htm">RETURN</A>
</Form>
</Body>
</Html>
Any help would be greatly appreciated.
Thank You in Advance
Len Tag: rename share and change its properties Tag: 160687
Will Not Display Page as Full Frame
The Web Site I am taking over is split into two frames.
The code below will not display as a full Page (Frame). This works on two other pages fine, but will not work on this one. Guess I need help, I have been at it for four days!
<Html>
<Head>
<Title> Information for Parents </Title>
</Head>
<Form Name="Default" Method="GET" Action="../Default.htm">
<Body bgcolor="#FFFFFF">
<Font Face="Courier New" size="3"><Strong>
<Center>
<Table Border="3" Frame="All" CellPadding="1" CellSpacing="2">
<Caption Align="Top"><B>Parents</B></Caption>
<tr>
<td>Parents
want the best education for their children. We understand that each school community has
its unique needs. Our goal is to provide your family with a positive learning environment,
the finest educational programs, and services that promote outstanding student
achievement.
Parents are children's first and life-long teachers. We value the partnership between home
and school and recognize that parental involvement is the key to success in school. You can
be involved by helping your child with homework, volunteering in our schools, or joining a
school council. By welcoming and providing opportunities for you to be involved, we can
work together to ensure that children receive the very best education.<BR></font></td></Tr>
<BR>
</Table>
<A Href="../Hatch.htm">RETURN</A>
</Form>
</Body>
</Html>
If someone can tell me why this does not display as a full page I would really appreciate it.
Thank You in advance
Len Tag: rename share and change its properties Tag: 160686
I'am looking for info on how to rename a bunch of shares and at the same
time change the Path property on each.