Newbie problem--should be easy
I am brand new at this and virtually totally clueless; the terms and =
syntax are a complete mystery; nothing like writing up bat files.. (I'm =
going to get a book on this, but that's going to have to wait until next =
payday at least.)
Meantime I tried to edit a simple script I'd seen done before for =
another purpose which looked like it could be altered to simply copy a =
file or two from here to there. Figured once I got it figured out I'd =
add it into the more complicated vbs script I's working on.
I'm trying to copy and concatenate files.
Figured this looked like it would work. It does not.
Set WSHShell =3D WScript.CreateObject("WScript.Shell")
rcmd =3D "copy /y /b d:\files\text.txt+d:\files\test2.txt =
f:\temp\new.eml"
WshShell.Run(rcmd)
What am I doing wrong? What would work? Tag: Try on these correction patch from the Microsoft Corporation Tag: 147027
Copying SID to SIDHistory
Hi all,
I am new to vbscript and I am trying to copy the SID from one
Domain account to the SIDhistory of an account in a different domain.
This is what I was thinking:
Set user = GetObject(LDAP path to user in old domain)
SID = user.Get("objectSid")
WScript.Echo SID
Set NewUser = GetObject(LDAP path to user in new domain)
NewUser.Put "sIDHistory", SID
NewUser.SetInfo
I get an error that says "a constraint violation has occured". Like I
said, I'm a noob so I may be on the wrong path or missing some critical
steps. I would appreciate any help, or if someone has done this, maybe a
clue as to which way to approach this problem.
Thanks,
Rich Tag: Try on these correction patch from the Microsoft Corporation Tag: 147026
Tricky Text File
I've combined alot of the things that I've learned from this newsgroup and
created some really cool text manipulating programs. I'd like to thank all
of you that have helped me with my struggles these last few weeks (Chad, Dag
Sunde, Collin, and Michael Harrington - just to name a few). I'm really
amazed how slick these little programs work.
For my next task, I'd like to do something very similar. The difference is
that there can be upto 3 Product lists for each customer.
http://www.swandust.com/IN2.txt is a sample file. I'd like the output
(output.csv) to display something like the following:
CustNum,DelAdd,Stock,Qty,Freq
4,SIR ADAM BECK MANOR,WINTER EXTRA MATS
,240 SYDENHAM ST,3 X 12 BROWN RENTAL MAT ,1,E4W
,"LONDON, ON",4 X 8 GREY RENTAL MAT ,1
,Tel: ( ) -
,,MONTHLY ALL YEAR
,,3 X 5 GREY RENTAL MAT,1,E4W
,,4 X 8 GREY RENTAL MAT,3
37,STUDER'S VARIETY,BI-WEEKLY
,336 JOHN ST S,3 X 8 RED RENTAL MAT,1
,"AYLMER, ON",4 X 6 RED RENTAL MAT,1
,Tel: (519) 773-9016,3 X 5 AIR FLEX MAT,1
40,SCOTIA BANK,SUMMER STOCK MONTHLY
,199 BROADWAY,3 X 8 GREY RENTAL MAT,1,E4W
,"TILLSONBURG, ON", 4 X 6 GREY RENTAL MAT,1
,Tel: (519) 688-6400,4 X 8 GREY RENTAL MAT,1
,,4 X 6 SCOTIABANK LOGO MAT,1
,,BIWEEKLY WINTER STOCK
,,3 X 5 GREY RENTAL MAT,2,E2W
,,3 X 8 GREY RENTAL MAT,2
,,3 X 12 GREY RENTAL MAT,3
,,4 X 6 GREY RENTAL MAT,2
,,4 X 8 GREY RENTAL MAT,1
,,4 X 6 SCOTIABANK LOGO MAT,1
I think the below code is a great start. Running this code converts a UNIX
text file into my desired output (.csv). However, it only converts a file
with one list. I hope that you guys can all help me out with the trickier
output (above). Thanks in advance.
Private Sub Command1_Click()
Dim mystring As String, i As Long
Dim cusnum As String, printtofile As Boolean
Dim address(14) As String * 24, product(14) As String * 8
Dim quan(14) As String * 4, freq As String
Dim description(14) As String * 26
Dim InFile As Integer, OutFile As Integer
Call UNIX_DOS
InFile = FreeFile
Open "c:\temp.txt" For Input As InFile
OutFile = FreeFile
Open "c:\OUT1.csv" For Output As OutFile
Write #OutFile, "Cusnum", "Address", "Product", _
"Description", "Quantity", "Frequency" 'Headings
For i = 0 To 13 'initialize arrays
address(i) = " " '24 spaces
product(i) = " " '8 spaces
description(i) = " " '26 spaces
quan(i) = " " '4 spaces
Next i
Do While Not EOF(InFile)
printtofile = False 'reset
Line Input #InFile, mystring
If InStr(mystring, "Customer Number") > 0 Then
cusnum = Trim$(Mid$(mystring, 23, 6))
End If
If InStr(mystring, "Delivery Address:") > 0 Then
For i = 0 To 4
Line Input #InFile, mystring
address(i) = Trim$(mystring)
Next i
End If
'catch the frequncy input
If InStr(mystring, "=== === === === ====") > 0 Then
Line Input #InFile, mystring
freq = Trim$(Mid$(mystring, 20, 5))
Line Input #InFile, mystring
freq = freq & Trim$(Mid$(mystring, 20, 5))
If freq = "A" Or freq = "B" Or _
freq = "C" Or freq = "D" Then freq = "E4W"
If freq = "AC" Or freq = "BD" Then freq = "E2W"
If freq = "AB" Or freq = "CD" Then freq = "E1W"
End If
If InStr(mystring, "=== ======== ==") > 0 Then
i = 0
Do Until InStr(mystring, "*******") > 0
' ie until we reach Product end
Line Input #InFile, mystring
If Val(Left$(mystring, 11)) > 0 Then
product(i) = Trim$(Mid$(mystring, 11, 8))
description(i) = Trim$(Mid$(mystring, 22, 26))
quan(i) = (Mid$(mystring, 66, 4))
i = i + 1
End If
Loop
printtofile = True
End If
'now write to file
If printtofile = True Then
Write #OutFile, cusnum, address(0), product(0), _
description(0), quan(0), freq
For i = 1 To 13
Write #OutFile, , address(i), product(i), _
description(i), quan(i)
If address(i) = " " _
And product(i) = " " Then Exit For
Next i
For i = 0 To 13 're initialize arrays
address(i) = " "
product(i) = " "
description(i) = " "
quan(i) = " "
Next i
freq = "" 'reset
End If
Loop
Close InFile, OutFile
'remove temp file
Kill ("c:\temp.txt")
Print "DONE!"
End Sub
'convert UNIX text to DOS text
Private Sub UNIX_DOS()
Dim MyUnixFile As String
Dim MyDosFile As String
MyUnixFile = "c:\IN.txt"
MyDosFile = "c:\temp.txt"
Dim S As String
Open MyUnixFile For Binary As #1
S = String(LOF(1), vbNullChar)
Get 1, , S
Close #1
Open MyDosFile For Output As #1
Print #1, Replace(S, vbLf, vbCrLf);
Close #1
End Sub Tag: Try on these correction patch from the Microsoft Corporation Tag: 147025
All 'Domain Users" group to local 'Power Users' group
Hello all
I have several hundred workstations that I need to add the 'Domain Users'
group to the local machines 'Power Users' group. I assume the easiest way
to do this is with a group policy and a login script. I found the following
script in a previous posting and tried to modify it for my purposes without
much luck. If someone could tell me if I'm on the right track with this
script and how to modify it, I'd be grateful. I'm running a windows 2k
domain with all windows XP workstations.
Thanks for the help
James
From: "Jim Campau" <Jim_Campau@bausch.com>
On Error Resume Next
prbCount= 0
Dim Computer
Set WshNetwork = WScript.CreateObject("WScript.Network")
strComputerName = WshNetwork.ComputerName
strLocalGroup="Power Users"
strGroupName="TestDomain\Domain Users"
strGroupName=Replace (strGroupName, "\", "/")
Set strGroup= GetObject("WinNT://" & strComputerName & "/" & strLocalGroup)
Set strUser= GetObject("WinNT://" & strGroupName)
strGroup.Add(strUser.AdsPath)
'msgbox strUser.AdsPath
if err.number <> 0 then
prbCount=prbCount+1
msgbox"ERROR - " & strGroupName & " Could not be added to " &
strComputerName & " Error Number: 0x" & Hex(err.number) & " " &
err.description
wscript.quit
end if
msgbox "Done" Tag: Try on these correction patch from the Microsoft Corporation Tag: 147023
Microsoft VBScript runtime error: ActiveX component can't create object 'GetObject'
I have written a simple VBscript to find out the free disk space on a
local machine. The script is as follows:
set WMI = GetObject("WinMgmts:")
for each Disk in WMI.InstancesOf("Win32_LogicalDisk")
if Disk.DeviceID = "C:" Then
WScript.Echo "Instance:", Disk.Path_.Relpath , "Free space = " ,
Disk.FreeSpace
end if
next
I saved this script to disk.vbs and i run it using cscript command on
dos window.
cscript disk.vbs
This script runs on some machines perfectly. On some machines it gave
the following error : Microsoft VBScript runtime error: ActiveX
component can't create object 'GetObject'. I searched thru many google
groups and i found that the error might be that "host is missing WMI
capabilities".
I don't know how to enable this functionality. Is it a service which
is stopped on that particular machine? Is this some different error
altogether? Can anyone please help me out on this. I am new to
scripting so i appreciate ur help. Thanks.
Pranav Tag: Try on these correction patch from the Microsoft Corporation Tag: 147022
Getting hta "refreshed" from script
I have an hta in which I change some text in a table element to tell the
user what is happening.
After changing the text to "Loading", the script moves onto an xml load and
transform.
The table does not seem to get re-displayed in time and the transform
functions seems to absorb all the resources while it happens (10 seconds).
After the transform, the table is updated again to "Viewing". This is the
first change that is rendered.
If I put a msgbox in front of the load and transform, when the message is
displayed, the table is updated.
If I comment out the load and transform, the table is updated too
Anyone know how I can force the rendering to happen before the transform
"takes over"
TIA
--
Rickety Tag: Try on these correction patch from the Microsoft Corporation Tag: 147005
data verticaly
How to read a data from a file where record information
store verticaly into SQL? Tag: Try on these correction patch from the Microsoft Corporation Tag: 147003
Last Logon for workstation in an NT DOMAIN
I have a list of computer names that I need to check for
the last date/time the device logged on to the NT Domain.
Please help!
Thanks! Tag: Try on these correction patch from the Microsoft Corporation Tag: 146999
Script to import email addressess
Hi,
I had re-modify Richard's script (Thank you and his site
is http://www.rlmueller.net)and I am receiving an error
stating "The server rejected one or more recipient
addressess. The server reponse was: 550 5.1.1
<c:emails.txt>....User UnKnown" Not sure what has gone
wrong. I have a file "Emails.txt" in C:\ drive containing
my user's Email address. See below of the script I re-
modify from Richard.....
Option Explicit
Dim strFileName, strNTName, objShell, lngBiasKey, lngBias,
k
Dim objRootDSE, strDNSDomain, objDomain, objMaxPwdAge,
intMaxPwdAge
Dim objDate, dtmPwdLastSet, lngFlag, blnPwdExpire
Dim lngHighAge, lngLowAge, lngDate, dtmPwdExpires
Dim objConnection, objCommand, objRecordSet
Dim strFilter, strQuery
Dim strEmail, objEmail
Const ADS_UF_PASSWD_CANT_CHANGE = &H40
Const ADS_UF_DONT_EXPIRE_PASSWD = &H10000
' Specify the file of email addresses.
strFileName = "c:\emails.txt"
' Obtain local time zone bias from machine registry.
Set objShell = CreateObject("Wscript.Shell")
lngBiasKey = objShell.RegRead
("HKLM\System\CurrentControlSet\Control\" _
& "TimeZoneInformation\ActiveTimeBias")
If UCase(TypeName(lngBiasKey)) = "LONG" Then
lngBias = lngBiasKey
ElseIf UCase(TypeName(lngBiasKey)) = "VARIANT()" Then
lngBias = 0
For k = 0 To UBound(lngBiasKey)
lngBias = lngBias + (lngBiasKey(k) * 256^k)
Next
End If
' Determine domain maximum password age policy in days.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("DefaultNamingContext")
Set objDomain = GetObject("LDAP://" & strDNSDomain)
Set objMaxPwdAge = objDomain.MaxPwdAge
' Account for bug in IADslargeInteger property methods.
lngHighage = objMaxPwdAge.HighPart
lngLowAge = objMaxPwdAge.LowPart
If lngLowAge < 0 Then
lngHighAge = lngHighAge + 1
End If
intMaxPwdAge = -((lngHighAge * 2^32) _
+ lngLowAge)/(600000000 * 1440)
' Use ADO to search the domain for all users.
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOOBject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
' Filter to retrieve all user objects.
strFilter = "(&(objectCategory=person)(objectClass=user))"
strQuery = "<LDAP://" & strDNSDomain & ">;" & strFilter _
& ";sAMAccountName,pwdLastSet,userAccountControl,mail;subtr
ee"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 100
objCommand.Properties("Timeout") = 30
objCommand.Properties("Cache Results") = False
' Enumerate all users. For users whose password can expire,
' determine when the password expires.
Set objRecordSet = objCommand.Execute
Do Until objRecordSet.EOF
strNTName = objRecordSet.Fields("sAMAccountName")
lngFlag = objRecordSet.Fields("userAccountControl")
blnPwdExpire = True
If (lngFlag And ADS_UF_PASSWD_CANT_CHANGE) <> 0 Then
blnPwdExpire = False
End If
If (lngFlag And ADS_UF_DONT_EXPIRE_PASSWD) <> 0 Then
blnPwdExpire = False
End If
' Only continue if the password can expire.
If blnPwdExpire = True Then
' Determine when password last set.
lngDate = objRecordSet.Fields("pwdLastSet")
Set objDate = lngDate
dtmPwdLastSet = Integer8Date(objDate, lngBias)
' Continue only if password was ever set.
If dtmPwdLastSet > #1/1/1601# Then
' Determine when the password expires.
dtmPwdExpires = DateAdd("d", intMaxPwdAge,
dtmPwdLastSet)
' Determine if password expires within the next 10
days.
If dtmPwdExpires < DateAdd("d", 10, Now) Then
If dtmPwdExpires < Now Then
' Password already expired.
Else
' Password expires in the next 10 days.
strEmail = strFileName
If strEmail <> "" Then
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "icmpbell@yaoo.com
objEmail.To = strEmail
objEmail.Subject = "Network Password"
objEmail.TextBody = "The network password for
user " _
& strNTName & strFileName & " will expire "
& dtmPwdExpires
'==This section provides the configuration information for
the remote SMTP server.
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/se
ndusing") = 2
'Name or IP of Remote SMTP Server
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sm
tpserver") = "ns1.yahoo.com"
'Server port (typically 25)
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sm
tpserverport") = 25
objEmail.Configuration.Fields.Update
'==End remote SMTP server configuration section==
objEmail.Send
End If
End If
End If
End If
End If
objRecordSet.MoveNext
Loop
' Clean up.
objConnection.Close
Wscript.Echo "Done"
Function Integer8Date(objDate, lngBias)
' Function to convert Integer8 (64-bit) value to a date,
adjusted for
' local time zone bias.
Dim lngAdjust, lngDate, lngHigh, lngLow
lngAdjust = lngBias
lngHigh = objDate.HighPart
lngLow = objdate.LowPart
' Account for bug in IADslargeInteger property methods.
If lngLow < 0 Then
lngHigh = lngHigh + 1
End If
If (lngHigh = 0) And (lngLow = 0) Then
lngAdjust = 0
End If
lngDate = #1/1/1601# + (((lngHigh * (2 ^ 32)) _
+ lngLow) / 600000000 - lngAdjust) / 1440
' Trap error if lngDate huge.
On Error Resume Next
Err.Clear
Integer8Date = CDate(lngDate)
If Err.Number <> 0 Then
Err.Clear
Integer8Date = #1/1/1601#
End If
On Error GoTo 0
End Function
User's email address is not the same as user NT name
(userid). For example, email address for user NT name
(Ian) will have an email address (icmpbell@yahoo.com). I
thought I maybe able to use Richard's script to call my
file "emails.txt" and be able to associate which email
address belong to that user NT name and then send a
notification to the user that his/her user NT name will
expired on this date. I apologize if I am not explaining
correctly.
Let say I have a file "emails.txt" containing
icmpbell@yahoo.com. A script will look into "emails.txt"
file and distinguished this email's address associated to
userid "Ian", then send an Email Notification to Ian that
his password will expired on November 28, 2003 at 10:38:06.
First, I will write a script using Richard's script to
output a file of ALL the userid that will expire within 10
days, then I have to manually produce "emails.txt" file,
unless someone know a script that can import those email
addresses to the rightful userid.
Do anybody know if my "emails.txt" may need to contain
both userid and email address in order for the script to
function? If so, how? Is it per line based on my sample
below.......
Ian
icmpbell@yahoo.com
Or do it need to be listed with a comma like this......
Ian, icmpbell@yahoo.com
Very appreciated for your time and willingness to assist
me.
Thank you,
Ian Campbell
Amature Developer Tag: Try on these correction patch from the Microsoft Corporation Tag: 146990
copy file
Hello,
I'm new to this, trying to make a copy of a file in the same folder as the
original but with a new name. I've found that CopyFile doesn't work for the
same directory. And because of certain restrictions, sometimes the pathing
will be UNC, so I can't shell out & use the command line 'copy' command.
Is my only option some kind of file-copy to a new directory, file-rename,
file-move back? These are binary files, so I haven't tried using the
createfile methods - should those work?
TIA.
-Dave Tag: Try on these correction patch from the Microsoft Corporation Tag: 146987
Creating users, and their home directory
Hi All,
I have a list of 90 users that I need to import into AD. I wrote a script
that does this but it doesn't create their home folder automatically. So
for instance, if I set the user's home folder to \\servername\share\folder,
and set it to a Z drive or something, that folder is not created. However,
when I manually create, or copy a user, it does create that folder
automatically (with the appropriate permissions etc.). Is there an easy way
to get it to create that home folder automatically, without having to make
the script do all of that work? Maybe a copy of an existing user? There is
an article on MSDN about copying a user, but only for SELECTED attributes.
I want ALL of the attributes copied (except username of course).
Thanks,
Pair Tag: Try on these correction patch from the Microsoft Corporation Tag: 146984
Display Status Window with Wsh Logon Script
I have a simple yet successful logon vbscript for windows 2000.
However, i would like to display the results/progress in a status
window at runtime when a user log's on to his/her pc. I have seen some
scripts using ie documents but most of the script I have found is a
football field long and does not work with my script. Can somebody
post or refer me to simple code that only displays the results and
status of what is happening (i.e. like in batch files)? Nothing fancy,
just straight forward code that works?
Thanks much! Tag: Try on these correction patch from the Microsoft Corporation Tag: 146972
Disable Keyboard & mouse
Dear all
i would like to disable the funtion of keyboard & mouse during my script is
running so that the user could not change the focus of the running program.
can anyone tell me how to write it???
i've search the microsoft, msdn & google but nothing can help.
thank you all in advanced.
: ) Tag: Try on these correction patch from the Microsoft Corporation Tag: 146969
Possible to search PST files with VBS?
Is it possible to search a series of PST files with VBS for a
perticular string?
will GetObject work on a PST file? Tag: Try on these correction patch from the Microsoft Corporation Tag: 146963
InStr - Searching Logs for strings? Any help?
Wondering if someone can show me a working example of the InStr
function.
I'd like to seach a log file on various remote servers for successful
exit codes.
the examples i've tried recently only work if the string is exactly
For example the log file with a line like
11:11:54 11/01/2003 033867563 RADCONCT EXIT STATUS = [857]
I can get InStr to work if I enter all that exactly but not if I'm
only searching for RADCONCT EXIT STATUS = [857]
Thanks Tag: Try on these correction patch from the Microsoft Corporation Tag: 146961
authentification
Hello,
we have subscribed to a web site that need a user/password IIS
authentification every time you connect to it.
I'm looking for a script that will make the connexion automatically (by
filling the 'user/password' field)
thanx for any help and idea.
Nova Tag: Try on these correction patch from the Microsoft Corporation Tag: 146958
Using VBScript to run Find in Excel
I would like to use VBScript to find a value that is a variable in
Excel. I assign WSval as the variable to hold the data I need to
locate in column 1 of my Excel file. The problem is in my Do Loop
where I say "If val = (WSval) Then". I don't think val is being
compared to the actual data WSval is holding but rather the word
WSval. My code looks like this:
On Error Resume Next
Const ForReading = 1
Const TristateFalse = 0 'Opens the file in ASCII format
Dim wshShell
Set wshShell=CreateObject("Wscript.Shell")
Set oFS = CreateObject("Scripting.FileSystemObject")
oFS.DeleteFile "N:\pardus\pingresults.txt", True
tIP=InputBox("Enter the IP address: xxx.xxx.xxx.xxx")
wshShell.run ("cmd ~")
Wscript.Sleep 500
wshShell.SendKeys "ping -a " & tIP & ">N:\Pardus\ping.txt ~"
Wscript.Sleep 4000
wshShell.SendKeys "Exit ~"
aFile = "N:\Pardus\ping.txt"
Set f = oFS.OpenTextFile(aFile, ForReading, True)
f.SkipLine
f.Skip(10)
WSval = f.Read(4)
'RUN QUERY AND SEARCH FOR MATCHING WS NUMBER
Set xl = CreateObject("Excel.Application")
xFile = "I:\My Documents\databases\queries\Query from Trackit.dqy"
xl.WorkBooks.Open xFile
xl.Visible=True
xl.DisplayAlerts = False 'Prevents prompt about overwriting resume.xlw
WScript.Echo "Read from text file " & WSval
r = 1 'row
c = 1 'column
Set oSheet = xl.ActiveWorkbook.Worksheets(1)
oSheet.Select
Do
val = oSheet.Cells(r,c).Value
WScript.Echo "Read from Excel file " & val
If val = (WSval) Then
WScript.Echo val
xl.Application.Quit
Exit Do
Else
r = r + 1
End If
Loop
Thanks in advanced for any suggestion/help!
Steve Tag: Try on these correction patch from the Microsoft Corporation Tag: 146957
users and folders
I need to write/find a script that will bulk import
around 1500 users creating users and home drives on a
windows 2003 server.
Any help would be welcome Tag: Try on these correction patch from the Microsoft Corporation Tag: 146956
Timer before continue with script
Hi
Is it possible to have a timer in a "while not rsResults.EOF"
I want to wait 1 second before returning the next record from that statement
above.
What would the code look like in asp?
Thanks Tag: Try on these correction patch from the Microsoft Corporation Tag: 146953
An easier way to write this code?
Is there an easier/shorter way to write this code?
Test1 = Request.Form("Test1")
Test2 = Request.Form("Test2")
Test3 = Request.Form("Test3")
Test4 = Request.Form("Test4")
if Test4 = "Yes" and Test3 = "Yes" and Test2 = "Yes" and Test1 = "Yes" then
Result = 5
elseif Test4 = "Yes" and Test3 = "Yes" and Test1 = "Yes" then
Result = 5
elseif Test4 = "Yes" and Test2 = "Yes" and Test1 = "Yes" then
Result = 5
elseif Test4 = "Yes" and Test1 = "Yes" then
Result = 5
elseif Test3 = "Yes" and Test2 = "Yes" and Test1 = "Yes" then
Result = 4
elseif Test3 = "Yes" and Test1 = "Yes" then
Result = 4
elseif Test3 = "Yes" then
Result = 4
elseif Test2 = "Yes" and Test1 = "Yes" then
Result = 3
elseif Test2 = "Yes" and Test1 = "No" then
Result = 1
elseif Test4 = "No" and Test3 = "No" and Test2 = "No" and Test1 = "Yes" then
Result = 2
elseif Test1 = "No" then
Result = 0
end if Tag: Try on these correction patch from the Microsoft Corporation Tag: 146941
Best way to enumerate installed applications
Hi there,
How can I list the applications installed on Win98 machines...? The list
displayed by Add/Remove programs would be a good start... anyone know how to
get this? I'd preferably like to know the executable path and name as well
as the application friendly name.
Any other suggestions for auditing PC software...?
Note that this is preliminary work in preperation for implementing SMS
Server 2003 so no point suggesting I use a server based tool like SMS...
Cheers Tag: Try on these correction patch from the Microsoft Corporation Tag: 146938
scrolling popups
Hi,
Does anyone know how to set the scroll
attribute on a popup. For instance if I
write this:
set p=window.createpopup
p.document.body.scroll="yes"
p.show 0,0,100,100
I don't see any scroll bars. I know a popup
can have scroll bars because if I write it
this way I not only see scroll bars but a
sunken border as well:
set p=window.createpopup
p.document.write "x"
p.show 0,0,100,100
? Tag: Try on these correction patch from the Microsoft Corporation Tag: 146936
vbs send at commands to serial port
I am trying to write a visual basic script that will be
able to send "at-commands" to the serial port.
I found all commands for the gsm-modem to send sms, but I
am still looking for a way to send the commands. I have
tried to use the mscomm32.ocx through an object, but
without success.
Any help? Tag: Try on these correction patch from the Microsoft Corporation Tag: 146912
Bulk change of AD Remote Access permission attrib
Hi,
Trying to do a bulk change of the AD attribute for RAS Permission from
"Deny" to "Allow". Have looked up the Technet script centre on this and
have come up with:
Set objUser = Get Object ("LDAP://cn= etc...correct LDAP path)
objUser.Put "msNPAllowDialin", TRUE
objUser.SetInfo
While this changes this particular attribute as seen in ADSI Edit, it does
not change the AD Users and Computers user account "Dial In" tab attributes
at all. I have no need for any of the other attributes mentioned in the
script centre article and do not want them set. Manually changing the
"Dial In" tab to "Allow Access" changes only the "msNPAllowDialin" booleen
to TRUE but changes no other attributes mentioned in the same Technet
article.
Obviously another attribute to set but unknown what. AD is mixed mode.
Thanks in advance for any assistance. Tag: Try on these correction patch from the Microsoft Corporation Tag: 146909
FSO.GetFile("http://www.internet.com/file.zip")
Automatic download of a file??? Is it possible somehow?
Best regard
Jakob Tag: Try on these correction patch from the Microsoft Corporation Tag: 146897
Open File dialog
Hi,
Some days ago, I've posted a message to NG, a question about how to call a
windows OpenFile dialog, which McKirahan response it with a code example
(listed below).
Now, these example doesn't work well for me, because I need that valid
selection are only for files and not for folders.
And this example works fine if selected item is a folder, but if the
selected item is a file, the BrowseForFolder method return null.
Any suggestions or workaround???
Option Explicit
On Error Resume Next
Dim strBFF
Dim objSHL
Set objSHL = CreateObject("Shell.Application")
Dim objBFF
Set objBFF = objSHL.BrowseForFolder(&H0,"Open File",&H4031,&H0011)
strBFF = objBFF.ParentFolder.ParseName(objBFF.Title).Parent
WScript.Echo objBFF
Set objBFF = Nothing
Set objSHL = Nothing
WScript.Echo strBFF
Thanks.
M.- Tag: Try on these correction patch from the Microsoft Corporation Tag: 146892
VBScript Logon Script Error
When using the VBScript Join function to map users to folders based on
group membership, on some Windows 2000 computers I get a runtime error
on join and others I don't. If I remove the join function, the PC's
that didnt work, now work and the ones that did work with join no
longer work. I am confused. What am I missing?
Set wshNetwork = CreateObject("WScript.Network")
Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)
' strGroups = LCase(Join(CurrentUser.MemberOf))
' strGroups = LCase(CurrentUser.MemberOf) Tag: Try on these correction patch from the Microsoft Corporation Tag: 146888
WshShell issue with WScript
I'm writing code for a VB Script task in a SQL Server DTS
package. Snagged the following code to run a command line
app and want to use the bit where it uses WScript.Sleep to
wait until the executable has finished.
However, both in the DTS task and if I place the following
code in a VB standard .exe I get a run-time error when I
reference WScript.
What's going on? Note, the command line exe does get
called and does run.
Code:
Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec("path to .exe")
Do While oExec.Status = 0
WScript.Sleep 100
Loop
WScript.Echo oExec.Status
Set oExec = Nothing
End Sub Tag: Try on these correction patch from the Microsoft Corporation Tag: 146882
Need to write script/batch file to delete selected files
I have a server that we use as a file repository for our daily reports.
The reports are *.txt files, all of them. They come from another domain,
and are "canned" reports that I have no control over.
Each day, we have up to 35-40 of these reports, and the naming convention
has been:
98129918.txt
where:
98 = year
12 = month
99 = denotes the Month End file, which I need to save
18 = unit reporting
The daily outputs the exact same naming convention, with the exception of
the third node (the 99 above) corresponding to the day of the month (00 to
31).
There are over 70,000 files in this directory, taking up 12 gigs on a hard
drive, so the function needs to be automated.
I need to write a script or batch file to save all of the xxyy99zz.txt
files, and to delete all of those not matching that filter from a date
beginning say around 1/1/2002. Anything prior to 1/1/2002 would need only
the month-end files (the ones with ____99__.txt naming), and anything after
that would need to exist until such time I modified the script to have
another cut-off date.
Anyone have any ideas as to how to accomplish this? I am not very fluent in
WSH.
You can respond via the newsgroup, but do not reply to the address, as it is
not valid thanks to the pounding of the Swen virus. Email me at
schathamNO@FREAKINGyahooSPAM.com remove NO FREAKING SPAM to respond....
Thanks
S Tag: Try on these correction patch from the Microsoft Corporation Tag: 146880
Need Files, HELP....
Question Title: Accessing Win32 API using vbscript
Author: Spidercide
Points: 500
Date: 11/10/2003 08:07AM MST
I am trying to use Win32 API's with vbscript. Specifically I am trying
to use FindWindowLike to see if I already have an instance of Excel
open. In my travels I have learned that you can not access Win32 API's
from vbscript(with good reason).
I know I have to create a secondary .ocx(control) file to enable me to
access the win API functionality.
I was looking around and I found a nice solution at
http://www.ahml.lib.il.us/pfw/VBS.html
He has a sample of how to do it, but it requires two other .ocx files
and these files are not supplied. He suggests buying a book "Windows:
Scripting Secrets" by Tobias Weltner and use the two .ocx files
supplied. Went and picked up the paperback, no CD no text copy of
files inside.
Does anyone know where i can get the two files(clipboard.ocx and
winmanag.ocx) from this book.
Thanks in advance. Tag: Try on these correction patch from the Microsoft Corporation Tag: 146866
W2K tool to disable (not delete) active directory machine accounts
I need a COMMAND LINE tool to disable (and later delete)
machine accounts from Active Directory so that I can
script the whole ordeal. TIV, Dale Tag: Try on these correction patch from the Microsoft Corporation Tag: 146860
Do Loop Help...please...
I'm using the Novadigm RADIA solution to deploy software throughout
my enterprise and I'm having a hell of a time with a Mass Deployment
script I wrote.
While deploying software to multiple machines I'd like the script to
recognize if a process is running (because if it is it will hang the
entire deployment) I tried to put another loop statement in my code
but I always get a runtime error requiring another Do. Basically, I'd
like the script to skip the machines on the list with the process
running and move onto the next machine. Right now I have it killing
the process
set objTextStream = objFSO.OpenTextFile("comps.txt", ForReading, true)
Set objFile = objFSO.OpenTextFile("results1.txt", ForAppending, true)
objFile.WriteLine "|SOFTWARE-------( << |+_+| >> )----------SLAM!|"
objFile.WriteLine Now
objFile.WriteLine APP_1
objFile.WriteLine "-----------------------------------------------"
Do While NOT objTextStream.atEndofStream
strTextLine = objTextStream.ReadLine
CompHost = (strTextLine)
Do Until RADPINIT = 0
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & CompHost &
"\root\cimv2")
Set colProcesses = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = 'RADPINIT.EXE'")
If colProcesses.Count = 1 Then
RADPINIT = 1
else
RADPINIT = 0
end If
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & CompHost &
"\root\cimv2")
Set colServices = objWMIService.ExecQuery _
("SELECT * FROM Win32_Service WHERE Name = 'radexecd'")
For Each objService in colServices
errReturnCode = objService.StopService()
Next
Set colServices = objWMIService.ExecQuery _
("SELECT * FROM Win32_Service WHERE Name = 'radsched'")
For Each objService in colServices
errReturnCode = objService.StopService()
Next
Set colServices = objWMIService.ExecQuery _
("SELECT * FROM Win32_Service WHERE Name = 'radstgms'")
For Each objService in colServices
errReturnCode = objService.StopService()
Next
objShell.Run "%comspec% /c pskill \\"&CompHost&" radpinit&pskill
\\"&CompHost&" radskman&pskill \\"&CompHost&" radrexxw&pskill
\\"&CompHost&" nvdtray&pskill \\"&CompHost&" nmciutils"
objShell.Run "%comspec% /c pskill \\"&CompHost&" radpnlwr&pskill
\\"&CompHost&" radiamsi&pskill \\"&CompHost&" radconct&pskill
\\"&CompHost&" msiexec"
objShell.Run "%comspec% /c pslist \\"&CompHost
Set colServices = objWMIService.ExecQuery _
("SELECT * FROM Win32_Service WHERE Name = 'radexecd'")
For Each objService in colServices
errReturnCode = objService.StartService()
Next
Set colServices = objWMIService.ExecQuery _
("SELECT * FROM Win32_Service WHERE Name = 'radsched'")
For Each objService in colServices
errReturnCode = objService.StartService()
Next
Set colServices = objWMIService.ExecQuery _
("SELECT * FROM Win32_Service WHERE Name = 'radstgms'")
For Each objService in colServices
errReturnCode = objService.StartService()
Next
Loop
objFile.WriteLine CompHost&" - Pushing"
objShell.Run "C:\PROGRA~1\NOVADIGM\RADNTFYC " & CompHost & " WAIT
C:\PROGRA~1\NOVADIGM\RADSKMAN
CAT=PROMPT,ULOGON=N,MNAME=RADDBT3,DNAME=SOFTWARE,PORT=3464,UID=$MACHINE,IP=10.16.21.185,IND=N,STARTDIR=SYSTEM,CONTEXT=M,ADD=N,UPD=N,DEL=N,REP=N,VER=N",
1, TRUE
objShell.Run "C:\PROGRA~1\NOVADIGM\RADNTFYC " & CompHost & " WAIT
C:\PROGRA~1\NOVADIGM\RADSKMAN CAT=N,SNAME=" & APP_1 &
",ULOGON=N,MNAME=RADDBT3,DNAME=SOFTWARE,PORT=3464,UID=$MACHINE,IP=10.16.21.185,IND=N,STARTDIR=SYSTEM,CONTEXT=M,ADD=Y,UPD=Y,DEL=Y,REP=Y,VER=Y",0,false
loop Tag: Try on these correction patch from the Microsoft Corporation Tag: 146851
Problem with CopyHere and Windows XP
Hello
I have a problem with a simple script that should copy a folder.
The script works with W2K but on Windows XP nothing is copied.
dim wsshell
dim Target
dim Source
set wsshell = CreateObject("Shell.Application")
set Target = wsshell.NameSpace("E:\")
Source = "\\192.168.115.247\Backup\Backup*"
Target.CopyHere Source, FOF_NOCONFIRMATION + FOF_NOCONFIRMMKDIR
set Source = nothing
set Target = nothing
set wsshell = nothing
'object.CopyFolder' instead works fine but I like to see a progress
dialog while copying.
I found a message <3C0C8F69.AFEF2133@hydro.com> that says Windows XP has
a bug processing wildcards. Can anyone confirm this.
TIA
Knut
--
Sorry, but I'm not very keen on spam
MyName: knut.beese
MyDomain: arcor.de Tag: Try on these correction patch from the Microsoft Corporation Tag: 146850
Client side form script
does anyone know a script i can use to send a form to an
email address without using a cgi?
any script or suggestions would be useful
thanks
Dave Tag: Try on these correction patch from the Microsoft Corporation Tag: 146846
scripting as a career
hi,
does anyone does scripting (wsh & wmi) as their career?
can share with me what's you job like?
thanks Tag: Try on these correction patch from the Microsoft Corporation Tag: 146844
Error 8 when creating process
Hello,
Here is the code:
errReturn = objWMIService.create("c:\RInstall.bat", null, null,
intProcessID)
If errReturn = 0 Then
wscript.Echo " Process started with ID : " & intProcessID
Else
wscript.Echo "errReturn: " & errReturn.
End If
I get errRetuen = 8 on many servers. What does error 8 mean?
Thanks,
Wensi Tag: Try on these correction patch from the Microsoft Corporation Tag: 146841
filtering security event log
I am trying to return a list of all security events with a "failure". I have
the following:
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Security)}!\\" & _
strComputer & "\root\cimv2")
Set wbemObjectSet = objWMIService.ExecQuery _
("Select * from Win32_NTLogEvent Where" _
& " Logfile = 'Security' and Type = 'audit success'",,48)
For Each wbemObject In wbemObjectSet
wbemObject.Message = Replace(wbemObject.Message,vbcrlf & vbcrlf,vbcrlf)
if (???? = "failure") then
if (x<200) then
Wscript.Echo "RecordNumber: " & wbemObject.RecordNumber
Wscript.Echo "EventCode: " & wbemObject.EventCode
Wscript.Echo "Message: " & wbemObject.Message
x=x+1
else
exit for
end if
end if
Next
The problem is... I can't figure out what to use for the ??? I listed in the
if statement.
Two questions: 1. What can I use for the ??? and 2. Where can I find a
listing of the objects used to access the security event log? I know it's
out there, I just can't find it.
Thanks. Tag: Try on these correction patch from the Microsoft Corporation Tag: 146836
ADO to Determine REQUIRED Field
Hi,
I have a need to use ADO to Determine If a Field Is a
REQUIRED Field in an Access Table.
The only example I can find is ISAUTOINCREMENT.
http://support.microsoft.com/default.aspx?scid=kb;en-
us;304100
Please help!
Thank You in advance,
t Tag: Try on these correction patch from the Microsoft Corporation Tag: 146832
outlook send mail
The script below sends e-mail messages taken from txt files using outlook com object .
Create your .txt file with
1) first line: destination e-mail address
2) second line: Subject
3) third line to end of file: body of the message.
All the txt files should be in the same directory
of the script.
The program tries to send the message if in the
first line finds a "@" and a dot, which could be
an e-mail address.
I hope comments in the code will help.
Giovanni.
(Aosta, Italy)
'<%
'Outlook SendMail.vbs
'Versione VBS di un programma già in Visual Basic 5, già modificato
'per l'uso con un oggetto COM e ora per appoggiarsi al modello ad oggetti
'di Microsoft Outlook
'Nella cartella corrente ci sono dei files txt contenenti messaggi di
'posta elettronica. Le prime righe di ogni file contengono rispettivamente :
'1) Indirizzo e-mail del destinatario
'2) Oggetto del messaggio.
'Le righe successive contengono il corpo del messaggio.
'Il programma utilizza l'oggetto COM di Outlook (non express)
'Apre ogni file e se è un messaggio (la prima riga contiene una "@"), lo invia.
'[c] Cenati Giovanni 08.06.02 nnever @katamail.com
'Modificato 19.09.03 per outlook
'This script looks for txt files in current (script) directory and
'if they are message files (with a valid e-mail address in the first line)
'sends the message using outlook (not express).
'The txt file must contain:
'In first line a valid e-mail address of the recipient
'In the second line the subject of the message
'From the third line to the end of file, the body of the message.
dim fso 'as filesystemobject
dim objOL 'as Outlook application
dim CartellaPosta
'oggetto directory dove ci sono i messaggi in formato testo
'Directory where to look for the messages.
dim Messaggi
'collezione di files in CartellaPosta. Collection of files in the folder.
dim FileMsg
'oggetto file trovato in CartellaPosta. Single file object in the folder
dim Messaggio
'file aperto in lettura contenente l'E-Mail. File openend to read the message
dim ContaMail
'numero di messaggi e-mail spediti. Number of sent e-Mails
'Crea istanza agli oggetti necessari al programma
'Creates needed objects
set fso = CreateObject("Scripting.FileSystemObject")
Set objOL = CreateObject("Outlook.Application")
'Ottiene la directory dove è situato script
'Retrieves script directory
ScriptFullName =wscript.ScriptFullName
CurrentPath = Left(ScriptFullName, InStrRev(scriptfullname, "\")-1)
'Recupera tutti i files della directory
'Sets folder where to look for messages and reads all files
set CartellaPosta = fso.GetFolder(CurrentPath)
Set Messaggi = CartellaPosta.Files
For Each FileMsg in Messaggi 'Processa ogni file della cartella
if ucase(right(FileMsg,4))=".TXT" then
'se è un txt... If it's a txt...
Set f = fso.GetFile(FileMsg) 'Ne recupera il nome
Set Messaggio = f.OpenAsTextStream 'Apre il file
'Legge le righe del file contenenti le intestazioni del messaggio e-mail
EmailDestinatario = Cstr(Messaggio.readline)
'Prima riga: indirizzo e-mail del destinatario
'First line: destination e-mail address
Oggetto = Cstr(Messaggio.readline)
'Seconda riga: Oggetto del messaggio
'Second line: subject
Body= ""
'Svuota la variabile e legge tutte le righe del corpo del messaggio.
'Empty the variable which will contain the body of the message.
Do While not Messaggio.AtEndOfStream
Body = Body & Messaggio.ReadLine & vbcrlf
Loop
Messaggio.Close 'Chiude il file contenente il messaggio
'Controllo validità dati. Control of e-mail address
'Se l'indirizzo del mittente non è una e-mail passa al prossimo messaggio.
if instr(1,EmailDestinatario, "@")>1 and instr(1,EmailDestinatario,".")>1
then
'Invia il messaggio. Sends the message
Set objMSG = objOL.CreateItem(0) 'Crea nuovo messaggio. Creates
new message.
With objMSG
.Subject = Oggetto
.To = EmailDestinatario
.Body = Body
.Send
End With
ContaMail = ContaMail +1 'Conta messaggi inviati. Counts messages
sent.
end if ' e-mail?
end if ' TXT?
Next 'File
Report = "Files: " & Messaggi.count & chr(13)
report = report & "Messaggi e-mail: " & ContaMail & chr(13)
report = report & "Fine Programma"
msgbox report ,,"Outlook Send Mail by Cenati Giovanni"
--
Giovanni Cenati (Aosta, Italy)
Write to user "nnever" and domain "@katamail.com" Tag: Try on these correction patch from the Microsoft Corporation Tag: 146827
Wscript
There is a way to call a WScript.Shell object into an html page?
Thanks. Tag: Try on these correction patch from the Microsoft Corporation Tag: 146826