VBScript compilation error for console app
Hello,
I am trying to do a simple console app to delete older files; it does
not work and the debugger does not see the mistake.
Any help would be greatly appreciated.
Sub Main()
On Error Resume Next
Dim oFSO
Dim sDirectoryPath
Dim oFolder
Dim oFileCollection
Dim oFile
Dim iDaysOld
Dim todaysdate
todaysdate = Now()
iDaysOld = 1
oFSO = CreateObject("Scripting.FileSystemObject")
sDirectoryPath = ("\\vs1\c:\temp")
oFolder = oFSO.GetFolder(sDirectoryPath)
oFileCollection = oFolder.Files
For Each oFile In oFileCollection
If oFile.DateLastModified < (todaysdate) - (iDaysOld) Then
oFile.Delete(True)
End If
Next
'Clean up
oFSO = Nothing
oFolder = Nothing
oFileCollection = Nothing
oFile = Nothing
End Sub Tag: 10+15.505 not equal to 25.505 Tag: 198886
Help listing all groups and users
Hi I have a script that list all users and nested groups for the admin
group. How can I have it list all groups and nestsed groups and users?
I am a newb and really appreciate the help.
Here is the script
Option Explicit
Dim objGroup, strComputer
strComputer = "."
Set objGroup = GetObject("WinNT://" & strComputer &
"/Administrators,group")
Wscript.Echo "Members of local Administrators group on computer " &
strComputer
Call EnumGroup(objGroup, "")
Sub EnumGroup(objGroup, strOffset)
Dim objMember
For Each objMember In objGroup.Members
Wscript.Echo strOffset & objMember.Name & " (" & objMember.Class &
")"
If (objMember.Class = "Group") Then
Call EnumGroup(objMember, strOffset & "--")
End If
Next
End Sub
--
LPDale
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------ Tag: 10+15.505 not equal to 25.505 Tag: 198884
File search and replace?
Maybe I'm at a block here, but I need to have a script replace multiple
stings in a file, or better yet, delete those stings and format a text
file. What I need is to display the path right after C:\ then delete
everything but the User\Specific sting.... that said, a target seach
would work from this, but I don't know how to run multiple queries..
http://www.microsoft.com/technet/scriptcenter/resources/qanda/feb05/hey0208.mspx
C:\IO.SYS BUILTIN\Administrators:F
BUILTIN\Administrators:F
NT AUTHORITY\SYSTEM:F
BUILTIN\Users:F
User\Specific
C:\Logon.log BUILTIN\Administrators:F
NT AUTHORITY\SYSTEM:F
BUILTIN\Users:F
User\Specific Tag: 10+15.505 not equal to 25.505 Tag: 198883
DHCP Scirpt for checking default gateway
I'm having a very strange problem with our DHCP servers. We currently have
two MS DHCP server that are serving client in various locations doing an
80/20 split using IP Helpers. Every time we reboot the servers, some of the
scopes will lose there Default router attributes. No error logged, nothing
that indicates a problem, just no gateway. So each time we have to go back
and re-add the gateway back in.
Does anyone have any good scripts that will allow me to check each scope to
see if the default gateway attribute exists after the reboot? We have
hundreds of scopes, and manually checking them is quite the task. Tag: 10+15.505 not equal to 25.505 Tag: 198880
unable to open connections with MSWinsock.Winsock
I have the following script:
Set oSck = WScript.CreateObject("MSWinsock.Winsock")
MsgBox(oSck.localIP)
oSck.RemoteHost = "64.233.167.99"
oSck.RemotePort = "80"
oSck.Protocol = 0
oSck.connect
myTimer = 0
Do While oSck.state <> 7 and myTimer < 10000
myTimer = myTimer + 1
Loop
MsgBox(myTimer)
Every time I run it, 10000 is output. This suggests that oSck.state is
never 7 (ie. that it has never connected). Any ideas as to why? Tag: 10+15.505 not equal to 25.505 Tag: 198876
do while loop yields "Error: Object required: '[number: 0]'"
Say I have the following script:
Set myTimer = 0
Do While myTimer < 10000
myTimer = myTimer + 1
Loop
MsgBox(myTimer)
When I try to run it, I get the following error:
Windows Script Host
Script: C:\vbscript\test.vbs
Line: 1
Char: 1
Error: Object required: '[number: 0]'
Code: 800A01A8
Source: Micrsoft VBScript runtime error
The output I'd expect to get is a single alert box that says 1000. Any
ideas as to what I'm doing wrong? Tag: 10+15.505 not equal to 25.505 Tag: 198874
Hide Process via VB
Good day,
I have a process that needs to start for every client via citrix. I
created a batch file:
*************************
start "DO NOT CLOSE" /min waveengine.exe --debug "M:\Documents and
Settings\All Users\Application Data"
cd\
cd "M:\Program Files\Twisted Pair Solutions\WAVE\DispatchCommunicator\
WAVEDispatchCommunicator.exe
***************************
When I run the above via citrix, it will open a dos box and then kick
off the application. The problem is that the dos box doesn't go away
"hince "do not close" title bar.
i tried the following script:
****************************
Const HIDDEN_WINDOW = 12
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = HIDDEN_WINDOW
Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")
errReturn = objProcess.Create("waveengine.exe",null,objconfig,
intProcessID)
*******************************
This looks like its going to work but fails. Reason I believe its
failing is the waveengine.exe needs to look at
--debug "M:\Documents and Settings\All Users\Application Data"
-------see batch file above----
How do I add this line?
Also when the application WAVEDispatchCommunicator.exe
is closed would need waveengine.exe process to stop.
I am so green at this Vb stuff.
Thanks for your time. Tag: 10+15.505 not equal to 25.505 Tag: 198859
Reading in a line from a CSV
Hi,
I need to read in a CSV file with 4 values per line.
value1,value2,value3,value4
value1,value2,value3,value4
and so on....
I need to read that in to some arrays in VBScript. I want to something
similar to this
Set csvFile = objFileSystem.GetFile(csvFilePath)
Set csvFileForRead = csvFile.OpenAsTextStream(ForReading)
count = csvFileForRead.numberOfLines
For i = 0 to count - 1
strLine = csvFileForRead.readLine
value1Array(i) = substring(0,",")
value2Array(i) = substring(first comma, next comma)
and so on
next
I don't want the code to work only with a four value CSV file either...
Can someone suggest a way to implement this?
Thanks.
Also, what I want to do is use the script to load a CSV file of events,
dates, times, and notes into an Outlook calendar on an exchange server
so any insight on that would be welcomed to. In a previous post, a
poster suggested looking at VbaOUTL9.chm but I could not find a copy of
this.
Thanks. Tag: 10+15.505 not equal to 25.505 Tag: 198856
Add the loged in user to the local admin group during logon proces
I have windows 2003 AD domain native mode.
I would like to add the loged in user to the local admin group during the
logon process. In other words whoever logs to his/her workstation should
automaticaly be added to the local admin on that workstation.
I have something like this but it is not working for me(it errors in th line
7):
Const ADS_SECURE_AUTHENTICATION = &H1
Set oNet = CreateObject("WScript.Network")
strGroup = "WinNT://" & oNet.ComputerName & "/Administrators,Group"
' BEGIN CALLOUT A
Set oProvider = GetObject("WinNT:")
Set oGroup = oProvider.OpenDSObject(strGroup, _
oNet.ComputerName & "\Administrator", _
"Password", ADS_SECURE_AUTHENTICATION)
' END CALLOUT A
oGroup.Add "WinNT://" & oNet.UserDomain & "/" & oNet.UserName
I would like to drop the vb script in the netlogon share so everyone who
logs in gets into the local admin group on that PC.
Can somone help PLEASE.
Pluto Tag: 10+15.505 not equal to 25.505 Tag: 198854
How to convert strings between ASCII and Unicode?
Hi
I have saved all the web pages that display lists of book titles at a web
site. I want to detect duplicates. I've written a VBScript to go through
all of the web pages, extracting the titles in the lists. I use the file
object's readall method to read the files, and the Split and other string
functions to extract individual titles. I add the titles as keys in a
dictionary and set the value for this item to the file name and the title's
location in this file. If the key already exists, the current file and
position are added to that key's value. On initial tests, this worked
fine - I could easily get a list of duplicates.
My problem is that while most of the web pages are plain ASCII, a
significant number of them are Unicode. The string functions work fine with
Unicode, but the dictionary .Exists method seems to mess up with a mixture
of ASCII and Unicode, resulting in false indications that a title already
exists.
I know how to detect the Unicode files - the first two bytes are Hex FF FE.
And my Unicode files are about twice as large as the plain ASCII file.
Once I have a file or string variable that contains Unicode, how can I
quicky convert it to ASCII?
If the scripting dictionary handles Unicode well, I'm just as open to
converting the plain ASCII to Unicode
I have tried manually opening the Unicode files in WXP's Notepad and then
saving them with ANSI encoding. This solves my problem, but I'd like the
script to handle the problem.
.
Thanks,
-Paul Randall Tag: 10+15.505 not equal to 25.505 Tag: 198853
automatically saving screenshot
Hi NG,
is there a way to automatically save scrennshots via hotkey?
Example:
CTRL+F13 is pressed, a folder c:\screenshot is created and the file is
stored with the following syntax: screenshot_dd_mm_yy_hh_mm.jpg
I saw a Linux application which was able to do so.Is it also possible with
Windows? Without installing any further programs?
Thanks in advance,
Tim Tag: 10+15.505 not equal to 25.505 Tag: 198848
Script to delete 0K files in a directory?
Anybody written a script to delete all files within a given folder that are
0K or 1K in size?
Never written a script, where should I start?
Dean S Tag: 10+15.505 not equal to 25.505 Tag: 198847
Select control DHTML
This is a multi-part message in MIME format.
------=_NextPart_000_0006_01C703E3.22966690
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I have a list box filled with entries. On a button click I want to fill =
the different entries in the same list box. How do I refresh it with new =
entries. I tried innerHTML but did not work for me.
Thanks in advance
------=_NextPart_000_0006_01C703E3.22966690
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2963" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>I have a list box filled with =
entries. On a=20
button click I want to fill the different entries in the same list box. =
How do I=20
refresh it with new entries. I tried innerHTML but did not work for=20
me.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks in advance</FONT></DIV>
<DIV> </DIV></BODY></HTML>
------=_NextPart_000_0006_01C703E3.22966690-- Tag: 10+15.505 not equal to 25.505 Tag: 198843
Returning recordset from a function and using EOF
Hi,
I have been all over the web looking for a definitive answer to this
question. I want to have a function which grabs a record set, and
returns it. Then, after my function call, I want to use something like
EOF or GetRows() to cycle through the record set. But no matter what I
try, I get the following error:
Object doesn't support this property or method: 'currentRow.EOF'
-----------------
Code returning set from function:
<snip>
rs.Open cmd, , adOpenStatic, adLockReadOnly
Set cmd.ActiveConnection = Nothing
Set cmd = Nothing
set rs.ActiveConnection = Nothing
oConn.Close
Set oConn = Nothing
getReportLogRow = rs ' This is the return statement
End Function
----------
Code using the returned recordset:
<snip>
Set currentRow = CreateObject("ADODB.Recordset")
Set currentRow = getReportLogRow(sessID)
if(currentRow.EOF)then
<snip>
---------------------
If I can solve this... I'm gonna publish the solution all over the
place because I can't be the only one ripping out their hair over this.
Why does vbscript-asp make using functions such a pain? ;)
Thanks for any help! Tag: 10+15.505 not equal to 25.505 Tag: 198840
Clean event viewer log with Regular expression.
Hi.
I'm not a programmer. I do script just to ease my work, and it funs too!!!
This is my project. I made a script to scan a list of server from a file,
retrieve all Critical event message from EV and write it to a file for
analysys with Excel. I should help us configuring our Monitoring application.
The problem that I have is with the "objEvent.Message" field. I want to
revome all formating, so I can export it in Excel and have a nice looking
(Message = 1 cell). Because with all formating character (carriage return,
line feed, etc..) it looks weird when I export it.
Can you help me with my patern maching.
Here is the Scirpt.
'***********************************************************************
'*
'* Names : List All System Event Type Error.vbs
'*
'* Retrieve all Critical error from a list (input file) and write it
'* in an output file for analyses. Input file is in the current
'* directory.
'*
'* By :
'* Date :
'*
'***********************************************************************
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Dim strComputer
Dim objFSO
Dim strScriptFullName
Dim objFile
Dim objFile2
Dim strFileParentFolder
Dim strInputFileName
Dim strOutputFileName
Dim Message
Dim Message1
strInputFileName = "Input.txt"
strOutputFileName = "Output.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
strScriptFullName = WScript.ScriptFullName
Set objFile = objFSO.GetFile(strScriptFullName)
strFileParentFolder = objFSO.GetParentFolderName(objFile)
Set objFile = objFSO.OpenTextFile(strFileParentFolder & "\" &
strInputFileName, ForReading)
Set objFile2 = objFSO.CreateTextFile(strFileParentFolder & "\" &
strOutputFileName, True)
objFile2.WriteLine "Category,Computer Name,Event Code,Message,Record
Number,Source Name,Time Written,Event Type,User"
Do While objFile.AtEndOfStream = False
strComputer = objFile.ReadLine
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer "\root\cimv2")
Set colLoggedEvents = objWMIService.ExecQuery _
("Select * from Win32_NTLogEvent Where Logfile = 'System' and " _
& "Type = 'Error'")
For Each objEvent in colLoggedEvents
Message = ReplaceRegX(objEvent.Message, [VbCrLf|vbCr|vbLf|^\.], "")
WScript.Echo Message
' objFile2.WriteLine objEvent.Category & "," & objEvent.ComputerName & ","
& objEvent.EventCode _
' & "," & objEvent.RecordNumber & "," & objEvent.SourceName & "," &
objEvent.TimeWritten _
' & "," & objEvent.Type & "," & objEvent.User & "," & objEvent.Message
Next
Loop
objFile.Close
objFile2.Close
Function ReplaceRegX(str1, patrn, replStr)
Dim regEx ' Create variables.
Set regEx = New RegExp ' Create regular expression.
regEx.Pattern = patrn ' Set pattern.
ReplaceRegX = regEx.Replace(str1, replStr) ' Make replacement.
End Function
Salutation,
Thank you in advance.
--
jasmin leroux
MCSE Tech. deployement Tag: 10+15.505 not equal to 25.505 Tag: 198836
Create a list of users from AD security group
I am trying to create a spread sheet of user located in a particular security
group. I can go to the properties of the security group and click members to
see all users in this particular group. I need a list of those users in a
spread sheet. Any help is appreciated.
TIA Tag: 10+15.505 not equal to 25.505 Tag: 198835
Add to MS Access database
Hi
Can anyone tell me if it is possible to use VB Script on a web page to add a
record to an Access database without server-side processing?
I want to access an mdb file that is stored on a network drive.
If so, how?
Thanks
Stuart Duncan Tag: 10+15.505 not equal to 25.505 Tag: 198834
creating folder tree structures
Hi,
Thanks for taking the time to read this.
I work in the construction industry. We have recently started a new
policy for how our project managers and department heads are supposed
to digitally file job documents.
This means that each time we start a new job or new project a
particular folder structure is setup in our file servers. I am talking
100+ folders a week, each containing about 10 subfolders, and even some
subfolders below those. As you can figure, this is a tedious task for
anyone to do. I am looking to streamline this using some VB script if
it's possible.
The problem I am running into is that I still have to copy/paste folder
names into my script (either script or simple mkdir batch file).
I wanted to ask if there is a way to build a prompt using VB script so
that if asks for the folder name and then does it's thing. This would
be good so that I can create a small program for others to use.
That, or can I inject data into my script from an outside database?
This script will be more complicated, so that is why I am here asking.
I know this is possible, and I think I should get this setup as it's
going to make a big difference to our daily operations....
Thanks,
John L Tag: 10+15.505 not equal to 25.505 Tag: 198833
Take ownership of multiple folders?
I have the following script that will take ownership of 1 folder, what
I want to do is to have this take ownership of a large amount of
folders at once by either pulling the folder name from a text file or
just listing it in the script. So I have a directory called owner and
say I have 10 folders under that called 1 through 10.. is this
possible?
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")
Set colFolders = objWMIService.ExecQuery _
("Select * From Win32_Directory Where Name = 'C:\\Owner'")
For Each objFolder in colFolders
objFolder.TakeOwnershipEx
Next Tag: 10+15.505 not equal to 25.505 Tag: 198829
large scale print to file (.tif)
I am not sure where to put this -
I have a need to print a large amount of tif files using office document image
but I always get the save as and preview dialog for every file - is there a
way to script past this so I can run a contagious print job and automatically
overwrite existing file of the same name(revisions)
any ideas or help greatly appreciated Tag: 10+15.505 not equal to 25.505 Tag: 198822
i want to save preview of this page in an image format like jpeg
Hello Friends, only problem is that I have to do this programmatically.
I displayed an html page in a popup window. on this page there is a
background image and some formated text with tags like <font>, <b>,
<i>, <u>.
now, i want to save preview of this page in an image format like jpeg,
jpg, gif or in any image format. Tag: 10+15.505 not equal to 25.505 Tag: 198819
Logging WScript.Timeout Event
Hallo,
I would like to know if there is a way to log the event, that my script has
exceeded the wscript.timeout that I have set before.
I would like to log this event within the Script itself, before it's ending,
not as a wsh-return code... And I would like to log the return Code inside my
logfile... Tag: 10+15.505 not equal to 25.505 Tag: 198817
How to get the parent / starting process?
Hello
How can I get from a running process the parent process or by which
process it has been started?
A full example or hints into the right direction would be great.
Many thanks in advance
regards
Mark Egloff Tag: 10+15.505 not equal to 25.505 Tag: 198816
Newbie - moving files to another folder
Hi,
I'm trying to write a vbscript that, when run, will create a new folder
with a unique timestamp and move the files in one folder, into the new
folder. I keep getting an error when I run the script and I can't
figure out why... if anyone can have a look it would be greatly
appreciated!
Thanks in advance,
MJ
Option Explicit
' Create the File System Object
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
Dim errorFolder
errorFolder = "C:\errors"
Dim ef
Set ef = FSO.GetFolder(errorFolder)
''''''''''''''''''''''''''''''''''''''
'Create Unique Destination Folder
''''''''''''''''''''''''''''''''''''''
Dim datetoday, timetoday
Dim strMonth, strDay, strHour, strMinute, strSecond
Dim strDirectory
datetoday = now
strMonth = Month(datetoday)
strDay = Day(datetoday)
strHour = Hour(datetoday)
strMinute = Minute(datetoday)
strSecond = Second(datetoday)
if len(strMonth) = 1 then
strMonth = "0" & strMonth
end if
if len(strDay) = 1 then
strDay = "0" & strDay
end if
if len(strHour) = 1 then
strHour = "0" & strHour
end if
if len(strMinute) = 1 then
strMinute = "0" & strMinute
end if
if len(strSecond) = 1 then
strSecond = "0" & strSecond
end if
datetoday = YEAR(datetoday) & strMonth & strDay
timetoday = strHour & strMinute & strSecond
strDirectory = "c:\archive\" & datetoday & "_" & timetoday
FSO.CreateFolder(strDirectory)
Dim f
For Each f in ef.Files
' Copy the file to the archive folder
FSO.MoveFile f, strDirectory
Next Tag: 10+15.505 not equal to 25.505 Tag: 198808
Please Help (Script Control)
All I want to do is put a little script into my VB application. I downloaded
Script Control (which I believe is the right thing to use), made a reference
to it in VB, but there's no Script Control icon in the tools menu (like
Microsoft said there'd be).
Do I need to download it to a certain folder? I'm going crazy here. Am I
even going about this in the right way? There doesn't seem to be any
documentation anywhere. Somebody please please please help. Tag: 10+15.505 not equal to 25.505 Tag: 198802
Posting Data to pages using VBA (Microsoft.XMLHTTP and MSXML2.ServerXMLHTTP.4.0)
Hi,
I'm trying to pull some data from htm pages but am having some issues
with the POST method. I would like to navigate between these pages and
post/retrieve data in the same session.
For example, testA.htm would have a couple of text boxes, radio
buttons, etc. The code would populate the objects by modifying the HTML
to add in the attributes (alternatives to this method would be
welcome), then move along to testB.htm when the form is posted. The
script would then gather data from testB.htm, modify the HTML,
rinse/rather/repeat...
I'm currently stuck between the post of testA.htm to testB.htm. I would
like to see testB.htm in the responseText when I post testA.htm.
If I use Microsoft.XMLHTTP, the page just refers back to itself when I
look at the responseText.
If I use MSXML2.ServerXMLHTTP.4.0, I get one of two messages- "You are
not authorized to view this page" or "Page cannot be displayed"
Below is the VBA:
Set xmlHTTP = CreateObject("Microsoft.XMLHTTP")
'Set xmlHTTP = CreateObject("MSXML2.ServerXMLHTTP.4.0")
xmlHTTP.Open "POST", "http://server/testA.htm", False
xml.Send
strResponse = xml.responseText
Below is the HTML:
<FORM name=testA action="http://server/testB.htm"
method=post><input type=text
name="Text0" value="PopulateSample"></input>
<input type=submit value="Move to TestB" />
</FORM>
Any input would be greatly appreciated; thanks in advance!
-Harry Tag: 10+15.505 not equal to 25.505 Tag: 198798
Firefox & Session Vars
Hi,
I have an application process where users enter info into fields, go on
to step 2, when this happens the user info is loaded into the session
and then the user is redirected
Function SaveCookies()
Session("apptype") = Request.Form("apptype")
Session("pgmtype") = Request.Form("pgm_type")
Session("branch") = Request.Form("branch")
Session("guarantors") = Request.Form("gtors_count")
Session("references") = Request.Form("refs_count")
Session("biztype") = Request.Form("biztype")
Session("ref") = Request.Form("external_ref")
Session("customerCode") = Request.Form("customer_code")
Session("companyName") =
ReplaceSpecialCharacters(UCASE(Request.Form("company_name")))
Session("dbaName") =
ReplaceSpecialCharacters(UCASE(Request.Form("dba_name")))
Session("address1") =
ReplaceSpecialCharacters(UCASE(Request.Form("address1")))
Session("address2") =
ReplaceSpecialCharacters(UCASE(Request.Form("address2")))
Session("city") =
ReplaceSpecialCharacters(UCASE(Request.Form("city")))
Session("state") = UCASE(Request.Form("state"))
Session("zipcode") = Request.Form("zipcode")
Session("county") = Request.Form("county")
Session("ctname") = Request.Form("contact_tname")
Session("cfname") =
ReplaceSpecialCharacters(Request.Form("contact_fname"))
Session("clname") = Request.Form("contact_lname")
Session("ctitle") = Request.Form("contact_title")
Session("cphone") = Request.Form("contact_phone")
Session("cext") = Request.Form("contact_ext")
Session("cfax") = Request.Form("contact_fax")
Session("cemail") =
ReplaceSpecialCharacters(LCase(Request.Form("contact_email")))
Session("fedid") = Request.Form("federal_id")
Session("yrsinbiz") = Request.Form("yrs_in_biz")
End Function
Say I need to change one of the fields entered in step 1, I hit
Previous button, change the info, continue on, but when I go back to
see if my change persisted, I find that the field changed back to its
original value. This doesn't happen in IE, I am wondering how Firefox
caches here?! Tag: 10+15.505 not equal to 25.505 Tag: 198795
Firefox & Session Vars
Hi,
I have an application process where users enter info into fields, go on
to step 2, when this happens the user info is loaded into the session
and then the user is redirected
Function SaveCookies()
Session("apptype") = Request.Form("apptype")
Session("pgmtype") = Request.Form("pgm_type")
Session("branch") = Request.Form("branch")
Session("guarantors") = Request.Form("gtors_count")
Session("references") = Request.Form("refs_count")
Session("biztype") = Request.Form("biztype")
Session("ref") = Request.Form("external_ref")
Session("customerCode") = Request.Form("customer_code")
Session("companyName") =
ReplaceSpecialCharacters(UCASE(Request.Form("company_name")))
Session("dbaName") =
ReplaceSpecialCharacters(UCASE(Request.Form("dba_name")))
Session("address1") =
ReplaceSpecialCharacters(UCASE(Request.Form("address1")))
Session("address2") =
ReplaceSpecialCharacters(UCASE(Request.Form("address2")))
Session("city") =
ReplaceSpecialCharacters(UCASE(Request.Form("city")))
Session("state") = UCASE(Request.Form("state"))
Session("zipcode") = Request.Form("zipcode")
Session("county") = Request.Form("county")
Session("ctname") = Request.Form("contact_tname")
Session("cfname") =
ReplaceSpecialCharacters(Request.Form("contact_fname"))
Session("clname") = Request.Form("contact_lname")
Session("ctitle") = Request.Form("contact_title")
Session("cphone") = Request.Form("contact_phone")
Session("cext") = Request.Form("contact_ext")
Session("cfax") = Request.Form("contact_fax")
Session("cemail") =
ReplaceSpecialCharacters(LCase(Request.Form("contact_email")))
Session("fedid") = Request.Form("federal_id")
Session("yrsinbiz") = Request.Form("yrs_in_biz")
End Function
Say I need to change one of the fields entered in step 1, I hit
Previous button, change the info, continue on, but when I go back to
see if my change persisted, I find that the field changed back to its
original value. This doesn't happen in IE, I am wondering how Firefox
caches here?! Tag: 10+15.505 not equal to 25.505 Tag: 198794
Text File Create date problem...
Situation:
I've got a vbscript that creates a logfile during processing. At the
beginning of the script I check to see if the log already exists - if
so, I rename it (move) then create a new log (CreateTextFile) for the
current execution.
Here's the code
1 Set objFSO = CreateObject("Scripting.FileSystemObject")
2 If objFSO.FileExists(myLogFile) Then
3 Set objFile = objFSO.GetFile(myLogFile)
4 objFile.Move(myLogFile & <a suffix containing the last modified
date>)
5 End If
6 Set objLogFile = objFSO.CreateTextFile(myLogFile, True)
The Problem:
The "DateCreated" attribute value seems be carried over from the
previous logfile (line 2) to the new logfile (line 6)... but the date
modified last accessed values are updated correctly. Why is the date
created value not getting the current date and how can I fix this
problem?
Any feedback on this would be appreciated...
celoftis Tag: 10+15.505 not equal to 25.505 Tag: 198786
AD User Account email Address
All:
Looking for a VB script to retrieve AD users account email address.
tia
DemoDog Tag: 10+15.505 not equal to 25.505 Tag: 198778
Help moving users folders to a new machine
Hi everyone!
I'm a newbie to scripting(especially related to Active directory) and I
figure this would be a good starting point to learn.
Here is the situation.
I am installing a new server, and I would like to move all my users shares
to the new server.
Tasks that I think will need to happen in the process in no specific order.
0) Create a share on Machine2 called users, and set it to not inherit
permissions.
1) Copy all users shares from Machine1 to Machine2
2) Set NTFS attributes on each individual share on Machine2 to the following
%USERNAME% (depending on the user)
Modify, Read&Execute, List, Read, Write
Administrators Group
Full Controll
3) Modify Active Directory entries of home folder(Connnect U drive)
to show the new path of \\Machine2\Users\%username%
4) Remove all the old shares on Machine1(figure I'd do this manually at a
later date incase/when I screw up :->
I have some novice level programming experiance in C# and VB so you can get
a little technical...Maybe a sample script that I can modify to meet my needs
or a direction to some good resources.
Thanks
Josh Martin Tag: 10+15.505 not equal to 25.505 Tag: 198775
How run a Script with high privileges??
Hi
I have a Script to install a software, but this software need that user
was local admin privileges. i need execute this script in the login to
domain (AD). How can do it???
thanks,
Daniel Tag: 10+15.505 not equal to 25.505 Tag: 198772
does anyone have a snipped handy for this?
I need to search all files in the local computer for files
owned by a specific user and delete all files of a specific
type. I think I have some code to do this that does a select
from CMIv2 for all files in the local computer. I do not see
a property of the objFile that shows who the owner is.
The second requirement is for all *.lnk files (I can easily find
these files using the Extension property) I need to force the
WorkingDirectory to a specific path. I have only been able to
find CreateShortcut and DeleteShortcut methods. I have not found
a ChangeShortcut method. Does such a method exist?
Mike Tag: 10+15.505 not equal to 25.505 Tag: 198770
CanonicalName Query
Hi There
Im trying to develop a VB script whereby an Input Box asks me to Enter
the name of a Active Directory Security Group and then writes the
CanonicalName of each member of that Group to a text file on my C:
Drive.
Can anyone help me on this. I really need it for determining where
users are located throughout our network.
Cheers
Des Tag: 10+15.505 not equal to 25.505 Tag: 198768
CDO - Access several Mailboxes
Hi
I=B4m relatively new to CDO and cant seem to wrap my head around the
procedure of Session.Logon.
I have a number of resources (cars) set up as Mailboxes in Exchange.
These are put into a resource group and I have user-account that has
full access to this group of mailboxes.
Now I would like to be able to log on to the Exchange server as this
"full-access-user" from a website.
Can this be done?
It seems to me the only way to log on to Exchange is to specify a
certain Mailbox through the Session.Logon method. Fine, but how do i
control who has access-rights? The only thing supplied is the
mailaddress or alias, and the servername... How do I identify myself?
I do not want to allow an anonymous_user-account or the
everyone-account full access to every mailbox I have.
Sorry if I seem a bit confused, but that=B4s because I am....
Thanks! Tag: 10+15.505 not equal to 25.505 Tag: 198767
CDO - Access several Mailboxes
Hi
I=B4m relatively new to CDO and cant seem to wrap my head around the
procedure of Session.Logon.
I have a number of resources (cars) set up as Mailboxes in Exchange.
These are put into a resource group and I have user-account that has
full access to this group of mailboxes.
Now I would like to be able to log on to the Exchange server as this
"full-access-user" from a website.
Can this be done?
It seems to me the only way to log on to Exchange is to specify a
certain Mailbox through the Session.Logon method. Fine, but how do i
control who has access-rights? The only thing supplied is the
mailaddress or alias, and the servername... How do I identify myself?
I do not want to allow an anonymous_user-account or the
everyone-account full access to every mailbox I have.
Sorry if I seem a bit confused, but that=B4s because I am....
Thanks! Tag: 10+15.505 not equal to 25.505 Tag: 198766
Zeile in File mit VB-Script austauschen
Hallo Zusammen,
ich habe eine Anzahl von Files, die alle die gleiche Endung haben
(=2Etxt)
In diesen Files, gibt es eine Zeile (irgendwo), die folgenden String
enth=E4lt: FGxx.xx.xx,20:00:00
In diesem Sting sollen die x durch das aktuelle Tagesdatum ersetzt
werden. Da sich die Files ab und an =E4ndern scheidet eine einmalige
Bearbeitung aus.
Ich hoffe mir VBScript-Anf=E4nger kann jemand weiterhelfen.
Viele Gr=FC=DFe,
Nick St=F6cker
P=2ES. habe schon diverse Foren und Newsgroups durchsucht, ohne
nennenswerten Erfolg Tag: 10+15.505 not equal to 25.505 Tag: 198761
command script
Hi i have a batch file that goes like this
if not exist c:\scripts\howto\ xcopy
\\192.168.20.2\netlogon\scripts\howto\*.* c:\scripts\howto\ /y
this runs perfectlay but for some reseon i can get the file to exicute in a
script vbs file
i have tryed
Public Function data()
dim objShell
set objShell = WScript.CreateObject("Wscript.Shell")
sCommand = "cmd /c if not exist c:\scripts\howto\ xcopy
\\192.168.20.2\netlogon\scripts\howto\*.* c:\scripts\howto\ /y"
objShell.run sCommand, 0, true
Wscript.DisconnectObject objShell
Set objShell = Nothing
end function
can anyone help please i iam not sure where i should add " & Chr(34) & " in
the vbs
thanks
--
Juan Bredenkamp Tag: 10+15.505 not equal to 25.505 Tag: 198754
Enabling RDP via a login script
Hi,
I want to enable RDP on all my workstations so I added this chunk of
code to my login script.
' ******************************************************************
' This part will enable RDP on the workstation
' ******************************************************************
Dim objReg, strKeyPath
Const HKLM = &H80000002
strKeyPath = "SYSTEM\CurrentControlSet\" _
& "Control\Terminal Server"
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &
strComputer & "\root\default:StdRegProv")
objReg.SetDWORDValue HKLM, strKeyPath, _
"fDenyTSConnections", "0" '0 enables RDP; 1 disables RDP
I receive no errors but it just doesn't work! Can any one see anything
wrong with the above code?
Thanks. Tag: 10+15.505 not equal to 25.505 Tag: 198753
Include all files in subfolders
Hi Everyone. I have developed a script that will display the name and
creation time of files listed in a directory, but I need to display all
files in all subfolders as well. So for example, if I were looping
through the local disk (C:) drive, I would like a list of all files in
all subfolders beyond c:/. I don't need any folder names, just the file
names and creation times.
Here's the script i've come up with so far and a sample of the output
is below as well.
--------------------------------------SCRIPT----------------------------------------------------------
Set objLogParser = CreateObject("MSUtil.LogQuery")
Set objInputFormat =
CreateObject("MSUtil.LogQuery.FileSystemInputFormat")
objInputFormat.Recurse = 0
Set objOutputFormat =
CreateObject("MSUtil.LogQuery.NativeOutputFormat")
objOutputFormat.rtp = -1
strQuery = "SELECT Name, CreationTime INTO output.txt FROM 'C:\*.*' " &
_
"WHERE NOT Attributes LIKE '%D%' ORDER BY CreationTime"
objLogParser.ExecuteBatch strQuery, objInputFormat, objOutputFormat
--------------------------------------END
SCRIPT---------------------------------------------------
----------------------------------------OUTPUT-------------------------------------------------------
Name CreationTime
-------------- -----------------------
NTDETECT.COM 2004-08-03 21:38:34.0
ntldr 2004-08-03 21:59:34.0
pagefile.sys 2006-06-13 11:20:23.166
boot.ini 2006-06-13 11:25:48.544
AUTOEXEC.BAT 2006-06-13 15:38:36.500
IO.SYS 2006-06-13 15:38:36.500
CONFIG.SYS 2006-06-13 15:38:36.500
MSDOS.SYS 2006-06-13 15:38:36.500
ptdebug.txt 2006-06-14 09:28:37.199
test1.csv 2006-06-15 14:23:30.981
tmp.drf 2006-08-04 01:53:32.731
sqmnoopt00.sqm 2006-09-26 13:20:59.183
sqmdata00.sqm 2006-09-26 13:20:59.183
sqmnoopt01.sqm 2006-09-26 14:33:36.575
sqmdata01.sqm 2006-09-26 14:33:36.595
sqmnoopt02.sqm 2006-09-27 08:15:13.800
sqmdata02.sqm 2006-09-27 08:15:14.922
sqmnoopt03.sq 2006-10-02 08:17:45.566
sqmdata03.sqm 2006-10-02 08:17:45.616
----------------------------------------END
OUTPUT---------------------------------------------------
If anybody has any suggestions, it would be greatly appreciated. Thanks
so much.
Justin Fancy Tag: 10+15.505 not equal to 25.505 Tag: 198751
VBS INPUTBOX IN MODAL WAY
Hi everyone,
I have developed a simple inputbox in vbscript that runs when Win2000
starts. This inputbox acts as an authentication box. I wish that this
inputbox is modal so that I cannot interact with system (e.i. I cannot use
desktop, start button and so on...) until I input a good code.It is
possible?
Thanx in advanced.
Lorschi Tag: 10+15.505 not equal to 25.505 Tag: 198749
How running multiple commands in a script
Hi
(New and still trying learn vb scripting)
I have created a vb which runs a command that I need to automate, this works
fine.
But I now need to run the same command with different options after it has
completed (Its just the way the command runs, its like a db query), when I do
this the command starts to run in parallel and which causes errors, as the
command is trying to access the programs services at the same time.
I have tried to put the Wscript.sleep, thinking this would wait, but this
does not work,any sugesstions?
'***********************
dim Wshell
dim StrCmdNormal
dim StrCmdWarning
StrCmdNormal="c:\test.exe -o -t"
StrCmdWarning="c:\test.exe -o -z "
set Wshell = wscript.createobject("wscript.shell")
Wshell.run StrCmdNormal
Wscript.sleep 60
Wshell.run StrCmdWarning
Wscript.sleep 60
Wscript.echo StrCmdNormal
Wscript.echo StrCmdWarning
'**************************
---
Dee Tag: 10+15.505 not equal to 25.505 Tag: 198744
help with vbscrip and error (its a purge script)
Hi All.
here is the code and i put it into a for each it comes up with an error
on line 47
this is line 47
sub SelectFiles(sPath,vKillDate,arFilesToKill,bIncludeSubFolders)
Code:
--------------------
' folder to start search in...
path = "c:\zip\"& line
' delete files older than 7 days...
killdate = date() - 7
arFiles = Array()
set fso = createobject("scripting.filesystemobject")
' Don't do the delete while you still are looping through a
' file collection returned from the File System Object (FSO).
' The collection may get mixed up.
' Create an array of the file objects to avoid this.
'
SelectFiles path, killdate, arFiles, true
nDeleted = 0
for n = 0 to ubound(arFiles)
'=================================================
' Files deleted via FSO methods do *NOT* go to the recycle bin!!!
'=================================================
on error resume next 'in case of 'in use' files...
arFiles(n).delete true
if err.number <> 0 then
wscript.echo "Unable to delete: " & arFiles(n).path
else
nDeleted = nDeleted + 1
end if
on error goto 0
next
'msgbox nDeleted & " of " & ubound(arFiles)+1 _ & " eligible files were deleted"
sub SelectFiles(sPath,vKillDate,arFilesToKill,bIncludeSubFolders)
on error resume next
'select files to delete and add to array...
'
set folder = fso.getfolder(sPath)
set files = folder.files
for each file in files
' uses error trapping around access to the
' Date property just to be safe
'
dtlastmodified = null
on error resume Next
dtlastmodified = file.datelastmodified
on error goto 0
if not isnull(dtlastmodified) Then
if dtlastmodified < vKillDate then
count = ubound(arFilesToKill) + 1
redim preserve arFilesToKill(count)
set arFilesToKill(count) = file
end if
end if
next
if bIncludeSubFolders then
for each fldr in folder.subfolders
SelectFiles fldr.path,vKillDate,arFilesToKill,true
next
end if
end sub
--------------------
if i just run this bit of the code it works
Code:
--------------------
Set objFSO = CreateObject("Scripting.FileSystemObject")
filename = "c:\list.txt"
Set objFile = objFSO.OpenTextFile(filename)
strContents = objFile.ReadAll
for each line in split(strContents, vbnewline)
'wscript.echo "line is: " & line
' folder to start search in...
path = "c:\zip\"& line
' delete files older than 7 days...
killdate = date() - 7
arFiles = Array()
set fso = createobject("scripting.filesystemobject")
' Don't do the delete while you still are looping through a
' file collection returned from the File System Object (FSO).
' The collection may get mixed up.
' Create an array of the file objects to avoid this.
'
SelectFiles path, killdate, arFiles, true
nDeleted = 0
for n = 0 to ubound(arFiles)
'=================================================
' Files deleted via FSO methods do *NOT* go to the recycle bin!!!
'=================================================
on error resume next 'in case of 'in use' files...
arFiles(n).delete true
if err.number <> 0 then
wscript.echo "Unable to delete: " & arFiles(n).path
else
nDeleted = nDeleted + 1
end if
on error goto 0
next
'msgbox nDeleted & " of " & ubound(arFiles)+1 _ & " eligible files were deleted"
sub SelectFiles(sPath,vKillDate,arFilesToKill,bIncludeSubFolders)
on error resume next
'select files to delete and add to array...
'
set folder = fso.getfolder(sPath)
set files = folder.files
for each file in files
' uses error trapping around access to the
' Date property just to be safe
'
dtlastmodified = null
on error resume Next
dtlastmodified = file.datelastmodified
on error goto 0
if not isnull(dtlastmodified) Then
if dtlastmodified < vKillDate then
count = ubound(arFilesToKill) + 1
redim preserve arFilesToKill(count)
set arFilesToKill(count) = file
end if
end if
next
if bIncludeSubFolders then
for each fldr in folder.subfolders
SelectFiles fldr.path,vKillDate,arFilesToKill,true
next
end if
end sub
next
--------------------
the reason for this is to purge through my backups.
and the way the backup works is i have a folder "zip" in this folder i
have random generated folder then inside each of the random folder i
have my backups.
so i first have to grab a list folder then open one and run the purge
script then move onto the next folder.
cheers aron.
--
aron
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------ Tag: 10+15.505 not equal to 25.505 Tag: 198743
DropDown box in worksheet
Hello,
How to create dropdown box with vbscript in excel worksheet?
Thanks, for answers... Tag: 10+15.505 not equal to 25.505 Tag: 198742
Implementation or reference for HMAC-SHA1 signature in VB
Hi,
I need to implement the HMAC-SHA1 signature in my ASP/VBScript website.
Does anyone have an implementation or reference for such hashing
algorithm?
Thanks,
Gabi. Tag: 10+15.505 not equal to 25.505 Tag: 198738
Implementation or reference for HMAC-SHA1 signature in VB
Hi,
I need to implement the HMAC-SHA1 signature in my ASP/VBScript website.
Does anyone have an implementation or reference for such hashing
algorithm?
Thanks,
Gabi. Tag: 10+15.505 not equal to 25.505 Tag: 198737
vbscript to split up pst file
I have a number of clients who have pst files that are WAAAAAAAAAY too big.
I created the following vbscript create a new PST file according to quarter.
I have been able to create the new pst file but cannot figure out how to copy
over the folder strcture and emails within the given dates from the source
pst to the newly created destination. Can somone give me a hint as to where
I can go from here?
I'm pretty good at batch scripting but vbscript is a whole new world to me.
so go easy on me :)
What I have so far -
Option Explicit
On error resume next
Dim objOutlook, objNameSpace, oBQ, oEQ, oYEAR, oSOURCE, oDEST
oBQ = inputbox ("Enter beginning quarter")
if (oBQ<1 or oBQ>4) then
wscript.echo "The number " & oBQ & " does not signify a quarter. You are a
dork."
wscript.quit
End if
oEQ = inputbox ("Enter ending quarter")
if (oEQ<1 or oEQ>4) then
wscript.echo "The number " & oEQ & " does not signify a quarter. You are
a dork."
wscript.quit
End if
oYEAR = inputbox ("Enter the year")
if (oYEAR<1990 or oYEAR>2020) then
wscript.echo "The number " & oYEAR & "is either before 1990 or after 2020.
Either way, you are a dork."
wscript.quit
End If
oSOURCE = inputbox ("Enter the name of the source .pst file. Note: file
must be in the c:\email folder. <e.g. 'jsim' NOT 'jsim.pst'>")
Set objOutlook = CreateObject("Outlook.Application")
Set objNameSpace = objOutlook.GetNamespace("MAPI")
objNameSpace.AddStore "C:\email\" & objNameSpace.CurrentUser & "_Q" & oBQ &
"- Q" & oEQ & "_" & oYEAR & ".pst"
Set objNameSpace = Nothing
Set objOutlook = Nothing Tag: 10+15.505 not equal to 25.505 Tag: 198724
Creating Macintosh Shares
Is there a way to create a VB Script that will create Macintosh shares on a
Win2K Adv server running File and Print services for Mac?
Alex Tag: 10+15.505 not equal to 25.505 Tag: 198720
Webpage which can Authenticate via Active Directory
Hello
We have various web scripts and in each one we have to store all the users
in a seperate database.
It would simplify things a lot if we could show a webpage where users enter
their Windows username and password and the form would authenticate via
active directory and either fail if incorrect or set some variable to allow
users to access the rest of the script.
I was hoping to be able to write this in VB Script as this is what all the
scripts are written in.
Thanks for any help
Robin Tag: 10+15.505 not equal to 25.505 Tag: 198718