Problem with UTF-8 and Server.URLEncode
Hi
I'm usin
Windows 2000 Advanced Serve
Service Pack
IIS 5.
Charset UTF-
Codepage= 6500
I have a problem when using the method Server.URLEncode. It converts for instance the character "Ã?" to D6(hexadecimal), but according to the ASCII-table(Extended ASCII codes) the value should be 99(hexadecimal). When I then use the method Request.QueryString the value is corrupt. I am aware of the Knowledge Base article 294831, but the service pack seems to make no difference in this case. Does anyone have any ideas how I can fix this problem?? Please help..
Thanks
Christopher Tag: Is there an equivalent to continue in vbscript Tag: 152643
Join Nt4 Domain using VBS
Hi All,
Does anyone have a script to join a PC to a NT4 domain, just using the script and no external apps?
I found a script last week that worked however overwrote it and cant find the site again.
Any help would be great.
Thanks
Brett
**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources... Tag: Is there an equivalent to continue in vbscript Tag: 152642
WMI unable to read HKEY_USERS
Hi All
I've been trying to run a simple WMI script to read a value from registry path on HKEY_USERS (See below), . but haven't been able to get it to work on Windows 2000 SP4 machines for some reason (works OK on NT4 SP6a machines)...returnvalue/err.number I get is 2. Even trying to enumerate subkeys under HKEY_USERS I'm unable to do it (HKLM is fine), wondering if anyone else has seen this problem, if this is a bug or a functionality that has been taken away recently by Service Packs, hotfixes... or if there is anything wrong you can see with the script below.... any help is much appreciated. Thanks in Advance...
------------------------------------------------------------
Const HKEY_LOCAL_MACHINE = &H8000000
Const HKEY_USERS = &H80000003
CONST HKEY_CURRENT_USER = &H8000000
Set objreg = Getobject("winmgmts:{impersonationLevel=impersonate}!\\TESTPC\root\default:StdRegProv"
regpath = "S-1-5-21-1606980848-1965331169-1417001333-233556\Software\DFS\IRESS\File
retval = objreg.getstringvalue (HKEY_USERS,Regpath,"userdir", regvalue
wscript.echo "Retval is: " & retva
wscript.echo "regvalue: " & regvalu Tag: Is there an equivalent to continue in vbscript Tag: 152641
Computer Name
I would like to read the Computer Name from the registry other than the SET
command to show %COMPUTERNAME%. Is there anyway to do it ? Which one is it
?
Thanks.
JW Tag: Is there an equivalent to continue in vbscript Tag: 152638
Saving an MSWord Page
Hi
I have an MSWord document displayed in an iframe on a web page
I want to allow a user to click a "save" button
A dialog box would then be displayed allowing the user to save th
MSWord iframe\document to disk.
Is there a way to do this
(I can't find a "save" dialog box or anything similar)
If so - how Tag: Is there an equivalent to continue in vbscript Tag: 152632
Updating Proxy in IE
I would like to script the IE proxy
settings, (Connections, Lan settings,
and advanced "Exceptions" )
Would anyone have a sample script
I could test.
Thanks in advance-
Bill Tag: Is there an equivalent to continue in vbscript Tag: 152631
Starting Internet Explorer
How would I start Internet explorer from a script and
open a specific web page?
Thanks for your help - Mike Tag: Is there an equivalent to continue in vbscript Tag: 152628
Current Process
Hello,
I need to know the current ID process of a running script.
In other words, while a script is being executed, I need to get the ID
process of the script itself.
Thx in advance for any help.
Alfredo Tag: Is there an equivalent to continue in vbscript Tag: 152625
How To read the COM port
This is a multi-part message in MIME format.
------=_NextPart_000_0062_01C3EE3B.4AECCD20
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi friends:
Somebody knows how to read the COM port from VBScript or =
Jscript. I need read it for the output of a scale of trucks.
=
Oscar Onorato
------=_NextPart_000_0062_01C3EE3B.4AECCD20
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.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DVerdana size=3D2>
<DIV><FONT face=3DVerdana size=3D2>Hi friends:</FONT></DIV>
<DIV><FONT face=3DVerdana=20
size=3D2> &nbs=
p; Somebody=20
knows how to read the COM port from VBScript or Jscript. I need read it =
for the=20
output of a scale of trucks.</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana size=3D2> =
=
=20
=
=20
=
=20
=
=20
=
=20
=
=20
=
=20
Oscar=20
Onorato</FONT></DIV></FONT></DIV></BODY></HTML>
------=_NextPart_000_0062_01C3EE3B.4AECCD20-- Tag: Is there an equivalent to continue in vbscript Tag: 152623
AutoDefrag program
Is there a program like AutoDefrag that runs the disk cleanup tool?
Brian Tag: Is there an equivalent to continue in vbscript Tag: 152617
Adding computer name to wallpaper
Hi,
I'm asking a lot of stupid questions today, but please bear with me, it
won't get worse than this!
We use unattended or RIS installation, and today, whenever a server is an
administrator logs on and performs a few tasks that we haven't been able to
automate yet.
When deploying servers we include a branded desktop wallpaper, and one of
the manual tasks is to edit the wallpaper (using Paint) to include the
server name etc..
Questions:
* Is there any way to script the editing of the wallpaper file?
* Or are there any utilities out there which can perform this task?
* Or alternatively, is there another (smarter) way to have the server name
and other info displayed in a similar fashion as when using a wallpaper?
Any input highly appreciated!
Thanks,
Jørn Tag: Is there an equivalent to continue in vbscript Tag: 152607
Time to display Startup and Recovery Options
Hi,
Does anyone know how activate the 'Time to display recovery options when
needed' setting and change the default time using scripting? (My Computer ->
Properties -> Advanced -> Startup and Recovery).
Alternatively, are these settings stored in a file somewhere, like the list
of operating system are stored in Boot.ini?
Regards,
Jørn Tag: Is there an equivalent to continue in vbscript Tag: 152606
Minidump directory
Hi,
I'm having problems getting Windows to 'accept' a change I make to the
'Small dump directory'.
I've included below a copy of the script (which is largely copied from the
Windows 2000 Scripting Guide):
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")
Set colRecoveryOptions = objWMIService.ExecQuery _
("SELECT * FROM Win32_OSREcoveryConfiguration")
For Each objOption in colRecoveryOptions
objOption.DebugFilePath = "C:\Dir\memory.dmp"
objOption.KernelDumpOnly = True
objOption.DebugInfoType = 3
objOption.OverWriteExistingDebugFile = False
objOption.MiniDumpDirectory = "%systemroot%\Dir"
objOption.Put_
Next
When I run the script it's completes OK without any errors, but when I check
the properties of the 'Small dump directory' in the 'Startup and Recovery'
options, it still says the default '%SystemRoot%\Minidump'.
By the way, it makes no difference whether I change the script to read:
objOption.MiniDumpDirectory = "C:\Dir".
Any input appreciated!
Regards
Jørn Tag: Is there an equivalent to continue in vbscript Tag: 152605
Managing local user objects
Hi,
I need to create, copy, rename and reset passwords for user obejcts that are
local to a computer (both Windows XP and Windows Server 2003).
I've browsed through the Windows 200 Scripting Guide, which I must say seems
rather comprehensive, but I can only find information on Active Directory
users.
If anyone could point me to where I can find information on local user
objects, I'd be much obliged!
Regards,
Jørn Tag: Is there an equivalent to continue in vbscript Tag: 152604
WMI, services and WinXP
Hello Everyone,
I wrote from Italy so please be patient with my english, thanks.
I am a programmer and I would like to use WMI (great!) with Visual Basic 6.0
(or VBSCRIPT) to obtain services enumeration on a remote computer, just for
see what services are running and so on.
The code below works well with Win2K O.S., but there are no chances to use
it with WinXP; every time the error description is "Authorization denied".
I think this is a problem with WinXp access security, because the API
EnumServicesStatus (and related) like the WMI code dont' works with WinXp,
but works well with Win2K.
Same consideration with the SC.exe utility from Microsoft : impossible to
query the remote service dtabase on a WinXp O.S.
IMPORTANT
I am convinced that this is a problem related to the security and permission
because, as I say, I can't execute the code remotely
(i.e. enumerating services on a WinXp PC over the network from an another
Win2K PC...) but the code works well If I use VB directly on a WinXp PC.
Consider that the computers with WinXp O.S. are correctly registered on the
network (LAN), beacuse I can browse they shared folders with Explorer.
Can someone help me, please?
Thank You in advance for Your very very precious support.
VB 6.0 CODE [START]
'this line gets an error on a WinXP computer (remotely), but the code
works well with Win2K or WinXP (locally)
Set WMI = GetObject("WinMgmts:\\MyRemoteComputerName")
Set objs = WMI.InstancesOf("Win32_Service") 'Win32_BaseService
For Each obj In objs
Debug.Print obj.Description
Next obj
VB 6.0 CODE [END]
GianPiero Tag: Is there an equivalent to continue in vbscript Tag: 152601
Logon script
Hi all,
Looking for a programmer to help me with following:
I am not familiar with vbscripting, but we are in desperate need for a logon
script for our W3K domain clients.
Clients are a mixture of NT4 SP5 and W2K Sp3 & 4
Up until now we used winbatch to perform certain tasks, but since this is an
'old' licence, we need to upgrade our scripts (and our licence). I want to
switch to windows scripting to avoid to have to buy new licences for over
200 clients..
Current situation:
Clients are members of one or more groups.
In our netlogon share, we may have a CMD file with the same name of the
group.
When logging on, a login.cmd file is run. This cmd verifies if the user is
member of a given group (GG-All). If not, it sends a net send to a given
system, indicating the user is not a member of that group, and exits.
If user is member of GG-All, the the winbatch script runs.
The current winbatch script puts a full-screen window on the clients
machine, used to indicate the progress in the logon. It then makes a list of
all global groups the user belongs to. If there is a matching cmd file, then
that cmd file is executed. (so if a user is memeber of 'GG-Testgroup' then
'GG-Testgroup.cmd' gets executed)
Problems we have now:
Most of the CMD files that are executed are doing four things:
- Check if certain directories exist on the client machine. If not
create them.
- Creating network shares
- Setting registry entries
- Synchronising files between the fileserver and the client. We use
robocopy to synchronise files (works perfectly).
A lot of these CMD files have some sync-commands in common, so there is a
possibility that these commands get executed more than once (resulting in
lenghty logons....). These CMD files/groups are all named in the same format
e.g. GG-SoftwareA, GG-SoftwareB, GG-SoftwareC, ...
So what I need:
Basically : same as above, but in vbs ;-)
- Less code in login.cmd (I think the only line should be 'wscript
login.vbs' , to please the NT4 machines...)
- If user not memeber of 'GG-All' : message to user and \\console PC
- Full screen window, listing user's display name, and a list of all the
login 'jobs' that have to run (= all the groups a user is member of AND have
a CMD file associated with it) (would be nice if an indication of already
executed jobs could be made, or progress bar)
- If user is memeber of at least 1 'GG-Software." group : execute common
code in GG-Software.cmd
- For all groups user is member of: execute group.CMD (minimized, or at
least 'behind' logon screen)
Someone can help me with this?
If you are willing to help me, you can send a mail to t d e m e y e r [at]
m u l t i n e t g r o u p [dot] c o m.
Tim Tag: Is there an equivalent to continue in vbscript Tag: 152600
DnsDomainSuffixSearchOrder.
Does anyone have any suggestions to make this more elegant? It pulls the
Dns Suffix Search Order from the registry and compares it to 'DnsSuffixes'
which should be there by default. If the user already has additional
suffixes, it adds them to the back-end of the string and then puts it back
into the registry.
Thanks,
Rob Boger
'> DNS Suffix Search Order.
Function SetDnsSuffixes(Computer)
Dim RegistryObject, CurrentDnsSuffixes, DnsSuffixes, NewDnsSuffixes,
WshShell
Set RegistryObject =
GetObject("WinMgmts:{impersonationLevel=impersonate}!\\" & Computer &
"\root\default:StdRegProv")
'> Define Dns Suffix Search Order.
DnsSuffixes = Array("my.domain.com", _
"domain.com", _
"sbc.com")
'> Get Current Dns Suffix Search Order.
RegistryObject.GetStringValue &H80000002, _
"System\CurrentControlSet\Services\TCPIP\Parameters",
"SearchList", CurrentDnsSuffixes
CurrentDnsSuffixes = Split(CurrentDnsSuffixes,",")
'> Compare Dns Suffixes.
For J = 0 To Ubound(DnsSuffixes)
For I = 0 To Ubound(CurrentDnsSuffixes)
If Ucase(CurrentDnsSuffixes(I)) = Ucase(DnsSuffixes(J))
Then
CurrentDnsSuffixes(I) = ""
End If
Next
NewDnsSuffixes = NewDnsSuffixes & DnsSuffixes(J)
If J <> Ubound(DnsSuffixes) Then
NewDnsSuffixes = NewDnsSuffixes & ","
End If
Next
'> Add Existing Dns Suffixes.
For I = 0 To Ubound(CurrentDnsSuffixes)
If CurrentDnsSuffixes(I) <> "" Then
NewDnsSuffixes = NewDnsSuffixes & "," &
CurrentDnsSuffixes(I)
End If
Next
'> Update Dns Suffixes.
Set WshShell = CreateObject("WScript.Shell")
WshShell.RegWrite
"HKLM\System\CurrentControlSet\Services\TCPIP\Parameters\SearchList", _
NewDnsSuffixes, "REG_SZ"
End Function Tag: Is there an equivalent to continue in vbscript Tag: 152598
Querying archived Security Logs
I archive my NT Security Logs on a nightly basis
(\\server\dir\tuesdaySecurityLog.evt) but would like to query these logs
without manually having to open them in the event viewer first.
Any thoughts how I could do this?
TIA Tag: Is there an equivalent to continue in vbscript Tag: 152591
work with a word doc file
with my vbs ,
i want to open a word file and search different
string in this file when i find this string
i must create a new word file and put string in this file.
an idea ??
thanks Tag: Is there an equivalent to continue in vbscript Tag: 152588
setting windows wallpaper with a VBS script
Hi guys,
Iam not an expert in VBscripting, and I am trying to set a wallpaper
and refresh it (without the user logoff) on winXP, win200 pro, and
win98 using the following script (coz of company marketing strategy).
Iam pushing this script via installshield to more than 1000 computers
with any of above os'.
The script seems to work fine on XP but doesnt work on win2k and
win98. The registries seem to be changing fine but the background
doesnot refresh with the rundll32 userdll call on the last line. Am I
missing anything ??
Please help!! Thanks,
NK
----------------------
----------------------
Dim WshShell, wpFile, wpStyle
set WshShell = CreateObject("Wscript.Shell")
'change this parameter for the destination wallpaper
wpFile = "%windir%\web\wallpaper\dt1.bmp"
'wallpaper style 2-stretch, 1-center;
wpStyle = 2
WshShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper",wpFile
WshShell.RegWrite "HKCU\Control Panel\Desktop\WallpaperStyle",wpStyle
WshShell.RegWrite "HKEY_USERS\.DEFAULT\Control
Panel\Desktop\Wallpaper",wpFile
WshShell.RegWrite "HKEY_USERS\.DEFAULT\Control
Panel\Desktop\WallpaperStyle",wpStyle
'WScript.Echo WshShell.RegRead("HKCU\Control Panel\Desktop\Wallpaper")
'msgbox (WshShell.RegRead("HKCU\Control
Panel\Desktop\WallpaperStyle"))
WshShell.Run _
"%windir%\System32\RUNDLL32.EXE
user32.dll,UpdatePerUserSystemParameters", _
1, False
----------------------
---------------------- Tag: Is there an equivalent to continue in vbscript Tag: 152585
How to list Computer Description using winNT:// provider..
Hi
I'm trying to list all the computers accounts in a NT4.0 Domain with their corresponding descriptions; I can list correctly the computer name but I get no description, even though the description does exist
This is the code I'm using
-----------------------------------------------------------------------------------------------
set DomainName = GetObject ("WinNT://MyDomain"
DomainName.Filter = Array ("computer"
For Each Computer In DomainNam
Wscript.Echo Computer.Nam
set Machine = GetObject ("WinNT://MyDomain/Computer.Name,computer"
WScript.Echo Machine.Descriptio
Next Tag: Is there an equivalent to continue in vbscript Tag: 152581
guaranteed file copy
I'm looking to write a script that will:
1.) Loop through a directory on a computer
A.) Copy each file to another directory
B.) Verify that is was copied
C.) Delete the original file
2.) Log all actions to a text file
Can anyone point me in the right direction to start? I'm pretty new
to scripting, but if there was some existing code somewhere I'm sure I
can piece it together and modify it to suite my needs. Tag: Is there an equivalent to continue in vbscript Tag: 152576
Accessing Multiple Files w/ vbscript
I'm having great difficulty figuring out a way to access multiple
files using GetFolder, Subfolders, and Files to set a variable for the
file to be accessed. The code below is a bit junky because I want you
to see all the things I've tried. Even if I leave Subfolders out, and
put all the log files in the same folder, I'm returned the same error,
"File not found." I've even tried running the script in the same
folder as the log files. However, if I add "wscript.echo
objFile.name" in a line before
"objOutputFile.Writeline(objfile.name)", I receive a message box
indicating the correct filename.
The bottom line is that I want to be able to parse multiple log files
in a directory structure without having to specify the filenames
manually. Does anyone know if this is a limitation of vbscript? Does
anyone know how to access multiple files in vbscript?
Any help would be greatly appreciated.
-------------------------------
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objParentFolder = objFSO.GetFolder("C:\Test\Logs")
Set objOutputFile = objFSO.OpenTextFile("C:\Test\Reports\ListFiles.txt",
ForWriting, True)
Set objSubFolder = objParentFolder.SubFolders
For Each objFolder in objSubFolder
strBuildPath = objParentFolder & "\" & objFolder.name
Set objFileFolder = objFolder.Files
For Each objFile in objFileFolder
' response.write(objFile.name)
' wscript.echo objFile.name
' objOutputFile.WriteLine(objFile.name)
Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objParentFolder = objFSO.GetFolder("C:\Test\Logs\2003\")
' Set objOutputFile = objFSO.OpenTextFile("ListFiles.txt", ForWriting,
True)
For Each objFiles in objParentFolder.Files
' response.write(objFiles.name)
' objOutputFile.WriteLine(objFiles.name)
Next
Set objFileFolder = objFolder.Files
For Each objFile in objFileFolder
' response.write(objFile.name)
' objOutputFile.WriteLine(objFile.name)
Next
For Each objFiles in objParentFolder.Files
' response.write(objFiles.name)
objOutputFile.WriteLine(objFiles.name)
Next
For Each objFiles in objParentFolder.Files
Set objTextFile1 = objFSO.OpenTextFile(objFiles.name , ForReading)
Next
Next
objOutputFile.close
--------------------------------
TIA,
Script Novice Tag: Is there an equivalent to continue in vbscript Tag: 152572
Getting SQL Script to run in VBS
Hi Everyone,
I am very new to VB Scripting and would like to find out how might I go
about running an SQL (2000) statement through VBScript and then assign the
result into an environment variable. My application can read the environment
variables. Essentially here is the SQL command I have been trying to use
with VB Script:
isql -U sa -P password -Q "select
cast(substring(@@version,0,charindex('(',@@version,0)) as varchar(40)),
cast(substring(@@version,charindex('Build',@@version,0)-1, Len(@@version))
as varchar(35))" -o c:\result\SQLVersion.txt
The SQL statement gives me the SQL Server version and its service pack info.
Right now it writes to a file but I rather keep it in the memory if
possible, and then simply manipulate the text so that it shows only a single
line of text instead of three.
Thank you for any pointers. Tag: Is there an equivalent to continue in vbscript Tag: 152571
Using CSVDE output data in VBS, problem with "\\"
I use csvde to extract data that looks like:
101000081,"CN=Czuchry\\, Michael L.,OU=psy,OU=Depts,DC=company,DC=com"
101000164,"CN=Loud\\, John,OU=lan,OU=Depts,DC=company,DC=com"
etc.
I read that into a VBscript and then based on other criteria, I want to
disable and then move the appropriate user accounts. That section of my
code looks like this:
************************
1 If status = "notactive" Then
2 strADsPath = "LDAP://" & objRecordset.Fields.Item("DN")
3 wscript.echo strADsPath
4 Set objUser = GetObject(strADsPath)
5 wscript.echo objUser
6
7 UAC = objUser.Get("userAccountControl")
8
9 objUser.Put "userAccountControl", UAC OR ADS_UF_ACCOUNTDISABLE
10 objUser.SetInfo
11
12 Set objOU =
GetObject("LDAP://ou=Mail1Disables,ou=ToBeDeleted,dc=company,dc=com")
13 objOU.MoveHere strADsPath, vbNullString
14 End if
The problem is when line 2 tries to build the correct AD path, it sticks the
two \\ characters which is invalid:
LDAP://CN=Loud\\, John,OU=lan,OU=Depts,DC=tcu,DC=edu
C:\scripts\smooth.vbs(63, 5) (null): An invalid dn syntax has been
specified.
How can I convert the \\ to just \ which is the true DN?
I suppose csvde is esc'ing the single DN during its output, but that's such
a huge pain to deal with.
I also realize I shouldn't have to do the csvde export at all, I should be
able to query all the users in AD directly and set variables for them, but I
haven't learned how to do that yet. Tag: Is there an equivalent to continue in vbscript Tag: 152570
Script to run when screen saver is on (w2kpro)
How do you get a VB script to work when the screen saver (with password
protect) is on? I have a script that will work (to do a disk defrag) when
run from the desktop, but when I put it in the scheduler and it runs with
the screen saver on, it runs it to the point when it should choose some Send
Keys command. At that point it appears that the window that is supposed to
be chosen is not selected and the script hangs. Anyone with any ideas?
Brian Tag: Is there an equivalent to continue in vbscript Tag: 152568
Help VBS and ASP
I could use someones help if possible. I am a new person to the whole
scripting thing, and know very basic information about HTML/ASP. What
I am trying to do is query a SQL Database and send the results to a
webpage in a table format. Below is a sample of my code, and any help
will be greatfully appreciated. If you could recommend a book, or
provide sample code, that would be wonderful
Thanks,
Robnson
<%@ Language = VBScript %>
<%Option Explicit%>
<HTML>
<HEAD>
<h1>
Eventlogs For January 29, 2004
</h1>
<META NAME="Eventlogs" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<%
dim Conn, objRS, objConn
Set Conn = CreateObject("ADODB.Connection")
Set objRS = CreateObject("ADODB.Recordset")
objConn.Open "DSN=EventLogs;"
Conn.ConnectionTimeout = 15
Conn.CommandTimeout = 10
Conn.Mode = 3 'adModeReadWrite
if objConn.state = 0 then
objConnection.Open strConnectString
end if
dim strSQL, objRS
strSQL = "SELECT *, ComputerName, EventCode,
Message,SourceName,TimeWritten, Type FROM EventTable WHERE (Type =
''Information'') ORDER BY 'TimeWritten'"
objRS.Open strSQL,objConnection,3,3
Response.Write("<Table Border=0 cellpadding=2 cellspacing=2>")
Response.Write("<tr bgcolor=#DFD9E6><td width=30
bgcolor=white> </td><td>" & objRS("ComputerName") & "</td><td>" &
objRS("Type") & "</td></tr>" & objRS("EventCode") & "</td></tr>" &
objRS("SourceName") & "</td></tr>" & objRS("Message") & "</td></tr>" &
objRS("TimeWriiten") & "</td></tr>")
objRS.MoveNext
next
Response.Write("</Table>")
%>
</HEAD>
<BODY>
<P> </P>
</BODY>
</HTML> Tag: Is there an equivalent to continue in vbscript Tag: 152566
xml login timeout getting mailbox size
Trying to get the mailbox size in the script below I receive 'Login Timeout'
I send the query to our OWA server and the status thrown is 440.
This is taken from the example on MSDN...
Thanks,
HankC
Output:
C:\>cscript mbsize.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
0:
0:
0:
0:
0:
<?xml version="1.0"?><g:searchrequest xmlns:g="DAV:"><g:sql>SELECT "http://schem
as.microsoft.com/mapi/proptag/x0e080003" FROM SCOPE ('DEEP TRAVERSAL OF "https:/
/webmail.um.umsystem.edu/exchange/myid/"') WHERE "DAV:isfolder" = true</g:sql>
</g:searchrequest>
Status: 440
Status text: Login Timeout
Code:
Option Explicit
On Error Resume Next
' Declare variables to be used.
Dim iSum ' As Integer
Dim strUri ' As String
Dim strMsg ' As String
Dim strServerName ' As String
Dim strMailbox ' As String
Dim strUserName ' As String
Dim strPassword ' As String
Dim i ' As Integer
Dim oXMLHttp ' As Msxml2.XMLHTTP
Dim oXMLDoc ' As Msxml2.DOMDocument
Dim oXMLSizeNodes ' As IXMLDOMNodeList
Dim oXMLHREFNodes ' As IXMLDOMNodeList
Dim sQuery ' As String
' Initialize variables.
iSum = 0
err.clear
' The URI of the mailbox on the Exchange server.
strUri = "https://webmail.um.umsystem.edu/exchange/myid/"
' Create XMLHTTP object.
Set oXMLHttp = CreateObject("Msxml2.xmlhttp")
' Error checking.
If Err.Number <> 0 Then
wscript.Echo "Error Creating XMLHTTP object"
wscript.Echo Err.Number & ": " & Err.Description
Set oXMLHttp = Nothing
wscript.quit
End If
err.clear
' Specify the SEARCH method, the URI, that the request will be sent
' asynchronously, and the credentials for the mailbox.
oXMLHttp.open "SEARCH", strUri , False, "myid", "myPassword"
wscript.Echo Err.Number & ": " & Err.Description
' Build the query string for a deep traversal search
' on the x0e080003 mapi proptag.
sQuery = "<?xml version=""1.0""?>"
sQuery = sQuery & "<g:searchrequest xmlns:g=""DAV:"">"
sQuery = sQuery & "<g:sql>SELECT ""http://schemas.microsoft.com/"
sQuery = sQuery & "mapi/proptag/x0e080003"" FROM SCOPE "
sQuery = sQuery & "('DEEP TRAVERSAL OF """ & strUri & """') "
sQuery = sQuery & "WHERE ""DAV:isfolder"" = true"
sQuery = sQuery & "</g:sql>"
sQuery = sQuery & "</g:searchrequest>"
' Set the request headers.
err.clear
oXMLHttp.setRequestHeader "Content-Type", "text/xml"
wscript.Echo Err.Number & ": " & Err.Description
oXMLHttp.setRequestHeader "Translate", "f"
wscript.Echo Err.Number & ": " & Err.Description
oXMLHttp.setRequestHeader "Depth", "0"
wscript.Echo Err.Number & ": " & Err.Description
oXMLHttp.setRequestHeader "Content-Length", "" & Len(sQuery)
wscript.Echo Err.Number & ": " & Err.Description
' Send the SEARCH request.
oXMLHttp.send sQuery
wscript.echo squery
If Err.Number <> 0 Then
wscript.Echo "Error sending query."
wscript.Echo Err.Number & ": " & Err.Description
Set oXMLHttp = Nothing
wscript.quit
End If
' An error occurred on the server.
If oXMLHttp.status >= 500 Then
wscript.echo "Status: " & oXMLHttp.status
wscript.echo "Status text: " & "An error occurred on the server."
Set oXMLHttp = Nothing
wscript.quit
' The SEARCH request was successful. Display the inbox folder names, sizes,
' and total size of the mailbox.
ElseIf oXMLHttp.status = 207 Then
' Get the XML response body.
Set oXMLDoc = oXMLHttp.responseXML
wscript.echo oXMLHttp.responsetext
' Build a list of the http://schemas.microsoft.com/mapi/proptag/x0e080003
' XML nodes returned in the search request. The
' http://schemas.microsoft.com/mapi/proptag/ namespace is typically
' assigned the d: prefix in the XML response body.
Set oXMLSizeNodes = oXMLDoc.getElementsByTagName("d:x0e080003")
' Build a list of the DAV:href XML nodes, corresponding to the folders
' in the mailbox. The DAV: namespace is typically assgigned the a:
' prefix in the XML response body.
Set oXMLHREFNodes = oXMLDoc.getElementsByTagName("a:href")
' Loop through the list of nodes and total up the sizes of the
' mailbox folders.
For i = 0 to oXMLSizeNodes.length - 1
' Display the folder URL.
wscript.Echo "Folder: " & oXMLHREFNodes.Item(i).nodeTypedValue
' Display the folder size.
wscript.Echo "Size: " & oXMLSizeNodes.Item(i).nodeTypedValue & " bytes."
wscript.echo ""
' Add the folder size to the running total.
iSum = iSum + oXMLSizeNodes.Item(i).nodeTypedValue
Next
' Display the total size of the mailbox in bytes.
wscript.Echo "Mailbox Size: " & iSum & " bytes."
' Clean up.
Set oXMLSizeNodes = Nothing
Set oXMLDoc = Nothing
Else
' Display the SEARCH status and status text.
wscript.echo "Status: " & oXMLHttp.status
wscript.echo "Status text: " & oXMLHttp.statustext
wscript.quit
End If
' Clean up.
Set oXMLHttp = Nothing Tag: Is there an equivalent to continue in vbscript Tag: 152565
Registry: Binary/Hex Value.
I have the following exported from a registry entry, and I want to make a
VbScript automatically import it back ito the registry without having to use
the .reg file, but thus far have been unable to figure it out.
Any help would be greatly appreciated:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet
Settings\Connections]
"RemoteConnection"=hex:3c,00,00,00,03,00,00,00,03,00,00,00,08,00,00,00,70,72
,6f,78,\
79,3a,38,30,e5,00,00,00,31,34,33,2e,31,36,36,2e,2a,3b,2a,2e,64,65,6c,6c,2e,\
63,6f,6d,3b,31,36,33,2e,32,34,34,2e,2a,3b,31,30,2e,2a,3b,31,32,37,2e,2a,3b,\
2a,2e,73,61,62,72,65,62,74,73,2e,63,6f,6d,3b,2a,2e,63,6f,72,70,74,76,6c,2e,\
63,6f,6d,3b,2a,2e,65,62,72,65,76,69,61,74,65,2e,63,6f,6d,3b,4f,52,4c,31,30,\
50,4c,55,53,57,53,30,31,2e,43,53,45,52,56,45,52,3b,64,65,6c,6c,2e,6d,74,67,\
77,6f,72,6b,73,70,68,65,72,65,2e,63,6f,6d,3b,64,65,6c,6c,68,6f,6d,65,2e,6d,\
74,67,77,6f,72,6b,73,70,68,65,72,65,2e,63,6f,6d,3b,61,6e,79,77,68,65,72,65,\
2e,6e,6d,66,6e,2e,63,6f,6d,3b,36,34,2e,32,30,37,2e,30,2e,2a,3b,2a,2e,74,62,\
67,66,69,6e,61,6e,63,69,61,6c,2e,63,6f,6d,3b,2a,2e,61,72,69,62,61,61,73,70,\
2e,63,6f,6d,3b,3c,6c,6f,63,61,6c,3e,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 Tag: Is there an equivalent to continue in vbscript Tag: 152559
Unable to Open Recordset on one system.
I have one system, WIN98SE with WSH 5.6, that is unable to open recordsets
whether I use the RS.Open method or Conn.Execute.
The code below presents both methods. This the only machine that is having
this problem, I re-installed WSH as a basic trouble-shooting step, but that
wasn't it.
Does anyone have an idea what may be happening here?
Thanks, Patrick
----------------------------------------------------------------------------
-------------
sConn = "DSN=SOTAMAS90;UID=RPT;COMPANY=PLY;PWD=*******"
Set oConn = CreateObject("ADODB.Connection")
oConn.Provider = "MSDASQL"
oConn.Open sConn, adAsyncConnect
Set rsOrder = CreateObject("ADODB.Recordset") 'Comment Out if
Connection.Execute method is used
Set rsItems = CreateObject("ADODB.Recordset") 'Comment Out if
Connection.Execute method is used
sSQLOrd = "SELECT SO1.SalesOrderNumber, SO1.SalesOrderDate, SO1.ShipToName,
SO1.ShipToCity, SO1.ShipToState,"
sSQLOrd = sSQLOrd & " SO1.TaxableAmount + SO1.NonTaxableAmount +
SO1.SalesTaxAmount as SalesTotal"
sSQLOrd = sSQLOrd & " FROM SO1_SOEntryHeader SO1"
sSQLOrd = sSQLOrd & " WHERE SO1.Division = " & chr(39) & sCustDiv & chr(39)
& " AND"
sSQLOrd = sSQLOrd & " SO1.CustomerNumber = " & chr(39) & sCustNo & chr(39)
& " AND"
sSQLOrd = sSQLOrd & " SO1.ShipToCode = " & chr(39) & sShipTo & chr(39) & "
AND"
sSQLOrd = sSQLOrd & cStr(" SO1.SalesOrderDate >= {d " & chr(39) & dBegDT &
chr(39) & "}")
sSQLOrd = sSQLOrd & " ORDER BY SO1.SalesOrderNumber DESC"
'Set rsOrder = oConn.Execute(sSQLOrd)
rsOrder.Open sSQLOrd, oConn
----------------------------------------------------------------------------
------------- Tag: Is there an equivalent to continue in vbscript Tag: 152558
Show User Selection From Combo Box
Hi
I'm sure this is a very trivial problem!
I have a combo bound to a recordset. I was wondering how I can show the
value on the page, what the user has selected?
The code that I'm using is below.
Any help, would be much apprceciated.
Kind regards
Rikesh
<%
Dim objConnection 'The connection object
Dim objRecordset 'The recordset object
' create the Connection object
Set objConnection = Server.CreateObject("ADODB.Connection")
' open the DSN
objConnection.Open "Provider=sqloledb;" & _
"Data Source=DEVSVR;" & _
"Initial Catalog=pubs;" & _
"User Id=sa;" & _
"Password=admin"
' creates the recordset object
Set objRecordset = Server.CreateObject("ADODB.Recordset")
' SQL String for query
Dim strSQL
strSQL = "SELECT au_id, au_lname FROM Authors"
' execute the SQL statement that you want
' The query should return all the data you'll
' need in your combo box
objRecordset.Open strSQL, objConnection
Request.Form("au_lname")
Response.Write (Request.Form("au_lname"))
%>
<HTML>
<BODY>
<FORM ACTION="DBCombo.asp" METHOD=POST>
<select name=cboPrimary size=1 >
<!--onChange="frmTest.submit();"> -->
Choose from the combo:
select name="lstTopic" size="1">
<%
' while we don't get the end of DataBase
Do While Not objRecordset.EOF
'we put the ID at Value
'this value is important to linked tables
%>
<option VALUE="<%=objRecordset("au_ID")%>">
<!-- This is what will appear in the combo box -->
<%=objRecordset("au_lname")%>
</option>
<%
' Move to the next record...
objRecordset.MoveNext
Loop ' keep the loop
%>
</SELECT>
</FORM>
</BODY>
</HTML>
<%
' close the recordset object
objRecordset.Close
' clean the Recordset object
Set objRecordset = Nothing
%> Tag: Is there an equivalent to continue in vbscript Tag: 152551
is there anyway passing array variable of vbscript to javascript
hi
is there anyway passing array variable which is declared in vbscript
to javascript?
i made a sample code and i found that variant type variables which is
declared in vbscript are type 'unknown' in javascript
let me show some example
<script language="vbscript">
Dim arr(1)
arr(0) = "this"
arr(1) = "that"
</script>
<script language="javascript">
alert(typeof(arr));
</script>
then message box with "unknown" will be poped up
i tested this code with other type but all but variant type are just
fine.
is there anyway to solve this problem?
ps.this problem occured when i try to passing parameter in activex's
event to some event handling script code. any idea will be appreciated
have a nice day :) Tag: Is there an equivalent to continue in vbscript Tag: 152550
Vb Script to Join a Nt4 Domain and add domain user to Local Admin group
Dear all,
I am trying to create a script that will join a Xp pc to a nt4 domain. However i need to be able to pass the details of the domain admin through to join the domain. Below is the script that i am using to join the domain. However it needs to be able to parse the domain administrator details to join the domain.
Set net = WScript.CreateObject("WScript.Network")
local = net.ComputerName DomainName = "MyDomain"
UserAccount = "testuser"
set group = GetObject("WinNT://"& local &"/Administrators")
group.Add "WinNT://"& DomainName &"/"& UserAccount &""
Any help on the above code or other code would be great.
Thanks
Brett
**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources... Tag: Is there an equivalent to continue in vbscript Tag: 152545
Hex to Decimal
I would like to find the script to convert a Hex number to a decimal number.
I couldn't find the function in the Window Script documentation.
Actually I am trying to write an hex number into the registry, I used
Reg.Write with a REG_DWORD type; but it only takes decimal number.
Thanks.
JW Tag: Is there an equivalent to continue in vbscript Tag: 152544
Win32_NTLogEvent Query Security Log
Hello.
I try to query the Security Log of a Windows 2000 Domain Controller. I only
want to query for a special time period. I#ve created the following query
string:
Set colLoggedEvents = objWMIService.ExecQuery("Select * from
Win32_NTLogEvent Where TimeWritten >= '"&dtmStart&"' and TimeWritten <
'"&dtmEnd&"' and Logfile='Security' and EventIdentifier='644'", , 48)
The dtmStart and dtmEnd Values are calculated by a Function. The Return
value of this Function is string. If I execute the query I get the following
error:
(null): 0x80041017
In the MS KB 295821 is the clear text of this error number. It means
"WBEM_E_INVALID_QUERY ". I've pasted the query from the Script Repository
from MS. If I paste the Values manually (i.e.dtmStart
=20040127084847.000000+060; dtmEnd=20040128084847.000000+060) I get return
values! What am I doing wrong?
--
Andreas Semmelmann
mailto:nospam@nospam.de Tag: Is there an equivalent to continue in vbscript Tag: 152543
FTP Help needed
Can someone please tell me where I can find some useful
information on how to retrieve a file via ftp in a
vbscript? I've found countless articles about msinet.ocx,
but not much on how to use it. i'm having to go through a
proxy server to get the file. Tag: Is there an equivalent to continue in vbscript Tag: 152535
script to update computer name
Can I run a script to update the Computer Name of a W2K machine instead of
going through the Network Property ?
Please show me the script.
Thanks.
JW Tag: Is there an equivalent to continue in vbscript Tag: 152534
insert quotes into a txt file
hi
i have this script to take input from a user
dim fso, wshshl, fil,oShell, strExec, fullname
dim txtFil
set wshshl = wscript.createobject("wscript.shell"
set fso = createobject("Scripting.FileSystemObject"
set oShell=Wscript.CreateObject("Wscript.Shell"
fullname = inputbox("Enter in Full Name to be assigned to Client", "Fullname"
Set txtFile = fso.OpenTextFile("c:\a.xt", 2, True
'Change 2 to 8 if you want to append to fil
txtFile.WriteLine "Name = " & fullnam
txtFile.Clos
My problem is that when a user enters in spaces between the name, i.e, john do
the output that is written to a.txt is: john do
However, I need to insert quotes around the john doe, like "john doe" on the txt file because it is being read by anothe
program, and it needs quotes around the variable otherwise it will be truncated with just "john"
I pretty sure this is simple, but i'm just learning vb script, so i'm wondering if anyone can help
thanks
andy Tag: Is there an equivalent to continue in vbscript Tag: 152533
"Destroy" a MsgBox
Hello,
I vaguely remember that in some programming languages there is a way to
"destroy" a message box - is there a way to do this in VBScript?
By "destroy" I mean that rather than the user clicking "OK" that the script
makes the msgbox go away.
All suggestions will be greatly appreciated.
TIA,
Bill Burke
bill@2burkes.com Tag: Is there an equivalent to continue in vbscript Tag: 152528
Network Drive Mapping Information
Below is the script which can give me information on all the drive on
windows machine but I am looking for full path like that of net use command
ex: x: \\server\test
Dim objFSO, objDrive
Set objFSO = CreateObject("Scripting.FileSystemObject")
For Each objDrive In objFSO.Drives
'check if drive is ready,
If objDrive.IsReady Then
Wscript.Echo objDrive.DriveLetter & " is " & _
Fix(((objDrive.TotalSize - objDrive.FreeSpace) _
/ objDrive.TotalSize) * 100) & "% used"
drvpath = objdrive.Driveletter
'showdriveinfo(drvpath)
Else
Wscript.Echo objDrive.DriveLetter & " is not ready"
End If
Next
Thanks,
Kumar Tag: Is there an equivalent to continue in vbscript Tag: 152526
VB Script - two keyboard keys at the same time in a script
Hello; I was wondering how you put a command in a VB script that commands
two keyboard strokes at the same time. i.e. when you want the alt button
you put {alt}
What I want is to put the alt key and tab at the same time; like holding the
two keys at the same time. If you put in the script {alt}{tab}
I assume it would consider them stroked sequencially, not at the same time.
Anyone have the solution?
Brian Tag: Is there an equivalent to continue in vbscript Tag: 152525
Win32_ComputerShutdownEvent WMI event instance
Hi all
Has any one been able to sucessfully retrieve instances of WMI Win32_ComputerShutdownEvent using VB script ?
I have tried with the following code but to no avail. I first ran the script and then logoff but I got no event. please help
Dim objEventSourc
Dim strWQLQuer
Dim objNextEven
strWQLQuery = "SELECT * FROM __InstanceCreationEvent WITHIN 1 WHERE TargetInstance ISA 'Win32_ComputerShutdownEvent'
Set objEventSource = GetObject("winmgmts:{impersonationLevel=impersonate}!root\cimv2").ExecNotificationQuery(strWQLQuery
wscript.echo "waiting for event...
Set objNextEvent = objEventSource.NextEven
wscript.echo "Event took place
Wscript.echo "MachineName = " & objNextEvent.MachineName & chr(10) & "Type = " & objNextEvent.Type Tag: Is there an equivalent to continue in vbscript Tag: 152524
output to a file
(newbie!!) I need the output from below scripts to the files like c:\txt
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
WScript.Echo IPConfig.IPAddress(i), IPConfig.Description(i)
Next
End If
Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2:Win32_Process")
Error = objWMIService.Create("net use", null, null, intProcessID)
If Error = 0 Then
Wscript.Echo "Net use is executed with a process ID of " _
& intProcessID & "."
Else
Wscript.Echo "Notepad could not be started due to error " & _
Error & "."
End If Tag: Is there an equivalent to continue in vbscript Tag: 152523
Signcode script not working when file to be signed has long target path
Hi all
I have the following script which uses Signcode.exe to sign my code
files. However it fails with "Error: Too many parameters." when the
file I am trying to sign is many levels deep eg
D:\Profiles\Someuser\folder1\folder2\folder3\folder4 etc.
If I copy the file to be signed to my desktop
("D:\Profiles\Auser\Desktop"), it works fine.
Copying my files around all the time is a pain and I would like to get
to the bottom of this. Any help greatly appreciated.
Thanks
Andrew
'CODE STARTS
Const signcommand = "%COMSPEC% /C signcode -cn ""MyCert"" -t
http://timestamp.verisign.com/scripts/timstamp.dll"
Const tmp = "D:\Profiles\AUser\Desktop\Sign.Out"
Dim fso, Wshshell, objDlg, Shell, strInput
Set Wshshell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set Shell = wscript.CreateObject("wscript.Shell")
Set objDlg = wscript.CreateObject("MSComDlg.CommonDialog")
objDlg.FilterIndex = 0
objDlg.MaxFileSize = 260
objDlg.InitDir = "D:\Profiles\Auser\MyVBApps\@bc_InstallShield\Folder1\Folder2"
'objDlg.CancelError = True
objDlg.Filter = "MyGreatApps(*.dll;*.exe;*.cab)|*.dll;*.exe;*.cab"
objDlg.DialogTitle = "Select an app to sign"
objDlg.ShowOpen
strInput = objDlg.FileName
If strInput = "" Then
WScript.echo "You didn't select a file you donkey"
WScript.quit
End If
Wshshell.Run signcommand & " " & strInput & " >" & tmp, 1
counter=0
Do While NOT Wshshell.AppActivate(promptTitle) ' wait until
signcode prompt title appears
WScript.Sleep 200
counter = counter + 1
If counter > 100 Then 'avoid infinite loop (20 secs), if
problem with timestamping,for example.
Exit Do
End If
Loop
WScript.Quit Tag: Is there an equivalent to continue in vbscript Tag: 152517
Calling 2 onchange event functions?
Hello,
I'm trying to make an input element call 2 different functions during an
onchange event.
One is inside a behavior file, and the other is on the original behavior
file where the input tag is being rendered.
ie. in BehavOrig.htc, inputA is being rendered something like this
<input style="behavior:url('BehavOther.htc)"
onChange="vbscript:OrigOnChangeFunction">
where OrigOnChangeFunction is a public method inside BehavOrig.htc
The way it is right now, OrigOnChangeFunction gets called before the
onchange function in BehavOther.htc
How do I get it to switch the order around?
Thanks
V Tag: Is there an equivalent to continue in vbscript Tag: 152513
Newbie question
Hello,
I'd like to query Active Directory to list all users mailbox name (full
path) for a given Information store. Could someone help me out?
Thank you,
SC Tag: Is there an equivalent to continue in vbscript Tag: 152511
Hi :
Sometimes, i want to use the "continue" comman ,
but ,i can't find an equivalent in VbScript .Can any one
tell me how to do it ?