elapsed time problem
I've just written a very "trivial" monitoring tool and it's providing
bizarre results. The code doesn't error as such, I think it may be the
concept that's wrong.
The tool is in two parts. The first is an ASP web page on a remote server
and the second is a VB6 application running locally which calls the ASP
page.
When called, the ASP web page loads the current time into a variable with
double point precision [dStart = CDbl(TImer)], does some work [connecting
through to a database and iterating through the resultant recordset] and
then records the finish time, also as a double. It then returns an XML
string that contains these start and end values.
In a similar vein, the VB6 application notes the start time, calls this ASP
page and then notes the end time. It calls the ASP page by creating a
MSXML2.XMLHTTP object and doing a SYNCHRONOUS connection (asynch=False).
The responseText gets loaded into a MSXML2.DOMDOCUMENT and the ASP
processing times are extracted using XPath expressions.
The VB6 application then calculates the times. So, I effectively have four
times:
startVBRequest, startASPProcessing, endASPProcessing and endVBRequest.
To my mind:
+ the processing time on the remote server is (endASPProcessing -
startASPProcessing)
+ the total time is (endVBRequest - startVBRequest)
+ the network-hop time is ((endVBRequest - startVBRequest) -
(endASPProcessing - startASPProcessing))
Because these are using time-differences, the local clock values of the
machines should be irrelevant.
My problem is that whilst I get finite values for the ASP processing time,
the total time values are 0, making the network time negative.
I don't like to think I'm breaking the laws of physics here, so there must a
better way of measuring elapsed times? By the way - although the monitoring
tool is currently in VB6, I'm soon going to make it ASP too, so don't want
to use any controls (OCX).
Any advice here?
Thanks
Griff Tag: How to desactivate an network interface Tag: 164227
huge problem with groups and users
Hi to all,
I need assistance pls.
I have 2 type of clients: 98 and XP/2000 inside a lab with 2003 server sbs.
I have created a Group Policy for XP and 2000 that redirects "My Document"
folder inside once called "users/group1", for each user (group1 is the name
of the group). So now I have "users/group1/user1/My Documents". It works.
I have a problem with 98 clients. I can redirect My Documents to another
folder (i have made a script that works) but I can't redirect to a group
folder.
Is there any way to redirect to a specific path associated to a user? If
user1 is inside a group called group1, is there a mode that win98 knows that
folder?
Thank you. Tag: How to desactivate an network interface Tag: 164226
Sending txt logfiles via email
Hello, Im a newbie to scripting but I was wondering if theres a way to send a
normal txt logfile to an email recipient as part of a script
For exampl, Im scheduling the defrag command to run and output a .txt file
with the results. I would then like either the same scheduled batch or script
to email me the log file OR just a batch or script that will run after the
defrag has finished, pick up the log file and email me
Can anyone help with this
TIA Tag: How to desactivate an network interface Tag: 164220
Cannot Access CDONTS
When I run the following code...
Dim objMail
Set objMail = CreateObject("CDONTS.NewMail")
... I get the error "The specified module could not be found."
Code: 8007007E
Source: (null)
A Microsoft article I downloaded suggested I uninstall and reinstall
Internet Explorer and Outlook Express, which I did. It suggested also that I
reinstall CDOSys.dll by running regsvr32 "\WINNT\System32\CDOSYS.dll", which
I did. The install was successful, but I still cannot run the script.
Suggestions, anybody? Tag: How to desactivate an network interface Tag: 164219
Need help with broken scripts
I have several ASP scripts on my web server that I was running using VBS.
They were all running fine, then a little while ago I uninstalled Backup
Exec on that server and all the scripts now fail with the following error:
Line 8, Char 1
Can't create object 'WinHttp.WinHttpRequest.5'
Code: 800A01AD
The relevant line of code in the script is:
Set objWinHttp = CreateObject("WinHttp.WinHttpRequest.5")
It seems that the uninstall of BE hosed the installation of WinHttp. How
can I fix it?
Thanks! Tag: How to desactivate an network interface Tag: 164204
Help! - Get Local Admins
Help!
I have been tasked with producing a report for the new requirements from
Sabanes-Oxley.
I have to remotely connect to a list of servers, export the local admin
users and groups and
get any nested groups and users.
Below is the script I have so far but it does not appear to be getting the
nested groups and their members.
Any help would be great,
Thanks,
Tim
*****************************************************************************************************
Option Explicit
'on error resume Next
Dim FSO, ReadFile, InputFilePath, ReadFileArraySize, strComputer, iEntry,
group, user, objConn
Dim objRS, strRecordMessage, CmdShell, strCurrentDirectory, DelAdmins
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
InputFilePath = "ServerList.txt"
Set CmdShell = WScript.CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")'Setup the file system
object.
Set ReadFile = FSO.OpenTextFile(InputFilePath, ForReading) 'Open the text
file containing the list of servers.
Set objConn = CreateObject("ADODB.Connection") 'Create a connnection to the
database.
Set objRS = CreateObject("ADODB.Recordset") ' Create a recordset to the
administrators table.
objConn.Open "DSN=InUse;" 'Open the ODBC connection to the database.
objRS.CursorLocation = 3
objRS.Open "SELECT * FROM Administrators" , objConn, 3, 3 'Select the
administrators table.
DelAdmins = MsgBox ("Do you want to clear existing data? ", 4,"Remove
Records")
If DelAdmins = 6 Then
Call RemoveAdmins
End If
Function RemoveAdmins
objRS.Close
objRS.Open "DELETE * FROM Administrators" , objConn, 3, 3
strRecordMessage = MsgBox ("The records have been cleared.",0,"NOTICE")
'objRS.Close
End Function
ReadFileArraySize = 0
Do Until ReadFile.AtEndOfStream
ReDim Preserve ReadFileArray(ReadFileArraySize)
ReadFileArray(ReadFileArraySize) = ReadFile.ReadLine
ReadFileArraySize = ReadFileArraySize + 1
Loop
ReadFile.Close ' Close the text file after import of all servers.
For Each strComputer In ReadFileArray 'Read through the list of servers
'Start with the local administrators group
Call ListGroups("WinNT://" & strComputer & "/Administrators")
Next
'MsgBox "That's all!"
'wscript.sleep 15000
strCurrentDirectory = CmdShell.CurrentDirectory
CmdShell.Run strCurrentDirectory & "\" & "Administrators.mdb"
Function ListGroups(strADSGroup)
'Dim iEntry, group, user
On Error Resume Next
WScript.Echo strComputer
objRS.Open "SELECT * FROM Administrators" , objConn, 3, 3 'Select the
administrators table.
'If Err.Number <> 0 Then
'WScript.Echo "New Group: " & strADSGroup
'Call ServerNotFound
'Err.Clear
'Exit Function
'End If
objRS.AddNew
If user.lastLogin = "" then
objRS("LastLogin") = "Account Never Logged In"
Else
'bjRS("LastLogin") = user.lastlogin
End If
objRS("Server") = strComputer
objRS("Group") = strADSGroup
objRS("Member") = "NA"
objRS("LastLogin") = "NA"
objRS("LastPasswordChange") = "NA"
objRS("Class") = "Group"
objRS("AuditDate") = DATE
Set group = GetObject(strADSGroup)
for each iEntry in group.members
'WScript.echo "Group: " & group.Name & "; Member: " & iEntry.ADSpath & ";
class: " & iEntry.Class
objRS.AddNew
objRS("Server") = strComputer
objRS("Group") = strADSGroup
'objRS("Group") = group.Name
objRS("LastLogin") = "NA"
objRS("LastPasswordChange") = "NA"
objRS("AuditDate") = DATE
objRS("Member") = iEntry.ADSpath
objRS("Class") = iEntry.Class
if iEntry.Class="User" then
set user = GetObject(iEntry.ADSpath & ",user")
If user.lastLogin = "" then
objRS("LastLogin") = "Account Never Logged In"
Else
objRS("LastLogin") = user.lastlogin
End If
'wScript.echo "Here I am"
'Wscript.echo " User details
login: " & user.Name & "; last login: " & user.LastLogin
objRS("LastLogin") = user.LastLogin
objRS("Member") = user.name
If user.fullname = "" Then
objRS("Name") = "NA"
Else
objRS("Name") = user.fullname
End If
'WScript.Echo user.LastLogin
objRS("LastPasswordChange") = user.PasswordExpirationDate - 60
objRS("AuditDate") = DATE
objRS.Save
end If
if iEntry.Class="Group" then
Call ListGroups(iEntry.ADsPath)
end If
Next
End Function
Function ServerNotFound
objRS.AddNew
objRS("Group") = "Not Available"
objRS("AuditDate") = CurrentDate
objRS("LastPasswordChange") = "Not Available"
objRS("Server") = strComputer
objRS("Users") = "Not Available"
objRS("LastLogin") = "Not Available"
objRS.Save
objRS.Close
Msgbox
End Function
********************************************************************************************************* Tag: How to desactivate an network interface Tag: 164202
DISABLE ENABLE NETWORK CONNECTIONS
does any body know how do I will disable and enable
Network connections using vbscripting? Tag: How to desactivate an network interface Tag: 164197
IsDate function considers "23A" as a valid date (bug?)
I have discovered the IsDate function in VBScript and VBA accepts as
valid dates of the form "23A", "16A" & "23P".
The reason it accepts them is it is viewing them as the times
"23:00:00", "16:00:00" & "23:00:00" on "Saturday, December 30, 1899".
This seems odd behaviour as I haven't seen any mention in
documentation of the function taking notice of time in the date
validation routine, and "23:00:00AM" isn't really a valid time anyway.
Demonstration (from Immediate window in Access):
print IsDate("16A")
True
print IsDate("23A")
True
print IsDate("32A")
False
print CDate("23A")
23:00:00
print IsDate("24P")
False
Just posting this for anybody else that might be mystified by the
issue in future.
--Phil. Tag: How to desactivate an network interface Tag: 164188
how to display content on webpage only once
Hi everyone,
I got something weird that I want to do but cant figure out. How can I
write a script either in VB or Java into an ASP webpage so that once a
user visits the page and view its contents (contents displayed by label
or text box) and then clicks a button afterward stating they are done
viewing it, a flag or something is then set so that the contents of this
page will not display anymore (even if they reopen the page in a new
browser) unless I go into the code and reset the flag.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! Tag: How to desactivate an network interface Tag: 164180
How to enable script debugging?
Hi,
I posted this question to the WSH newsgroup but did not get any suggestions.
Cannot figure out why I suddenly lost an ability to debug scripts in WSH. I
used to be able to do it by executing cscript with //D //X flags, but when I
do it now, the script just runs without invoking a debugger. I set the
JITDebugging (or whatever it's name is) registry value to 1 (just in case),
but it still does not help. Any ideas? I am running WSH 5.6 on Win XP Pro SP
1.
Thanks,
Alek Tag: How to desactivate an network interface Tag: 164170
Replacing Novell Login Script
We are replacing our Novell login script with a vbs script login script. I
am having trouble figuring out how to convert the following:
In Novell:
IF MEMBER OF ".PBAPPS.GROUPS.CHI.XXX" THEN
MAP N:=CHI13\VOL1:\APPS\PB32
MAP INS S9:=CHI13\VOL1:\APPS\PB32
END
In vbs I have so far:
If IsMember("CHIPBAppsUsers") Then
DriveMapper "N:", "\\chi13\vol1\apps\pb32" (this is fine)
Net Use * \\chi13\vol1\apps??? (Not sure how to do a map insert search
drive)
End If
Any help would be appreciated. Thanks Tag: How to desactivate an network interface Tag: 164166
Manipulating REG_NONE values with stdregprov or wshshell?
On a domain controller, the keys below are supposed to have identical
(default) REG_NONE values, and when they donâ??t, Kerberos is broken.
HKEY_LOCAL_MACHINE\SECURITY\Policy\PolAcDmN
HKEY_LOCAL_MACHINE\SECURITY\Policy\PolPrDmN
(to view anything under HKLM\Security, you need to give Administrators Full
Control to the permissions on the Security key)
Iâ??d like to write a script that compares those values and fixes them if
needed. But Iâ??ve yet to find a way to read or write a REG_NONE value with
vbscript or WMI.
Reg.exe handles REG_NONE values fine, but I donâ??t want to depend on it being
there since in 2000 reg.exe is in the support tools, not in the product like
XP/2003. And, those values almost never get mismatched in 2003, as there were
checks put in to verify they are consistent at boot.
Is there a way to manipulate REG_NONE values with stdregprov or wshshell? Tag: How to desactivate an network interface Tag: 164165
Using VBscript to Remove installed programs
I have never used vbscript so I thought I would start by asking if what I
want to accomplish is even possible.
I would like to use vbscript to uninstall programs automatically using
either Group policies or logon scripts. Most of the programs were not
installed using .msi files. Is there a way to do this with vbscript? Any
tips on how to do it?
Thanks in advance
Steve Tag: How to desactivate an network interface Tag: 164161
Pull product key
Does anyone have a vbScript to pull out the product key of a Win2k or Win2k3
server?
Thanks,
Troy Tag: How to desactivate an network interface Tag: 164156
How to run a Win32 console executable in hidden mode
Whenever I run a Win32 console application it invariable starts a CMD
prompt window eventhough this application is not a interactive
application it is a command line application but starts a CMD prompt
window.
Can somebody please give me a VB Script that I can use to run this Win
32 executable to hide the CMD window from appearing.
Thanks
Karen Tag: How to desactivate an network interface Tag: 164155
Using (MDE) Visual Interdev For VBS scripts (For Google archive only)
This post is not a request for help, the process below simply
describes how to setup Interdev for VBS scripting. Since Google will
archive this post, I can refer back to it later when I've forgotten
what to do!
Make the amendments described here:
http://support.microsoft.com/default.aspx?kbid=249024 (page copied
below)
But use this registry item, not the registry item described in the
link above:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSE\9.0\Editors\{C76D83F8-A489-11D0-8195-00A0C91BBEE3}\Extensions
Steps to Enable IntelliSense and Syntax Coloring
(corrected)============================================================
Using Microsoft Notepad, create a file that contains this:
<job>
<SCRIPT LANGUAGE="VBScript">
</SCRIPT>
</job>
Save the file as New Windows Script File.wsf in the
Common\IDE\IDE98\NewFileItems\ folder inside the Microsoft Visual
Studio installation directory.
Using Notepad, create a file named Wsedit.reg that contains: REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSE\9.0\Editors\{C76D83F8-A489-11D0-8195-00A0C91BBEE3}\Extensions]
"vbs"=dword:00000028
Run Wsedit.reg.
A Registry Editor dialog box will appear, asking you to confirm the
registry changes.
Click Yes.
You will then see a second dialog box acknowledging the change. Click
OK.
Start Visual InterDev.
Select Options from the Tools menu.
Click HTML in the tree control on the left side of the dialog box.
Click Start HTML pages in: Source under the Initial View section on
the right side of the dialog box.
Click OK to apply the change. Tag: How to desactivate an network interface Tag: 164150
Zip a file programatically
Help why doesn't this zip work it creates the .ZIP file but does not
copy the source to it?!??! No errors, I can drag files into the .zip
created with the script what gives?
Also tried different source and locations -thanks.
Option Explicit
Dim MySource, MyTarget, MyZipName, MyHex, MyBinary, i
Dim oShell, oApp, oFolder, oFileSys, oCTF
MySource = "C:\tmp"
MyZipName = "SinkFolder"
MyHex = Array(80, 75, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0)
For i = 0 To UBound(MyHex)
MyBinary = MyBinary & Chr(MyHex(i))
Next
Set oShell = CreateObject("WScript.Shell")
MyTarget = "C:\temp\" & MyZipName & ".zip"
Set oFileSys = CreateObject("Scripting.FileSystemObject")
Set oCTF = oFileSys.CreateTextFile(MyTarget, True)
oCTF.Write MyBinary
oCTF.Close
Set oCTF = Nothing
Set oFileSys = Nothing
Set oApp = CreateObject("Shell.Application")
Set oFolder = oApp.NameSpace(MySource)
oApp.NameSpace(MyTarget).CopyHere oFolder.Items Tag: How to desactivate an network interface Tag: 164144
Append to a Registry Value
Hi,
I am writing a script to update an annoying package that our company
is forced to use.
One of the things this script must do is to update the System Path
registry key for the Environmental variables.
It needs to append to the end of it but leave the rest of the path
alone. I need to roll this out to 400 machines, of which most have
different path variables so I cannot just blank it and insert a new
one with all the usual stuff + the bit I want to put in.
Can I write a VBS script to append to the end of the
hklm\system\currentcontrolset\control\session manager\environment\path
value?
Cheers
Andy Tag: How to desactivate an network interface Tag: 164143
create database with vbscript ?
Hi.
Sorry for the maybe silly question.
I am a newbe in vbscript. I have programmed with VB, VB .NET, PHP,
JavaScript, but never with databases.
Now I must to do some project where a database would be usefull.
But the hosting plan which is chossed by my company
doesn't include MySQL databases:(, so I cann't to use e.g. php for this
purpose.
So, the question is:
Can I myself (without contacting the hosting provider) create and use a
simple file on server, like "my.mdb", like a database, using vbscript?
If so, can You suggest a good site in order to get the beginning info?
Thanks for any info. Tag: How to desactivate an network interface Tag: 164142
VBscript not working after SP4 W2KPro
Hello, I have a vbscript the will not run as normal user but runs as administrator after I updated the system to SP4. Do you know what changes SP4 make to cause this ? or how to fix this problem.
Thanks in advance
**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources... Tag: How to desactivate an network interface Tag: 164141
MouseOver event on a listbox not working on Windows 2003
Within our product, we use dynamic HTML code. One part of the functionality
is to call a function on a MouseOver event on a listbox. This worked
correctly on Windows 2000 systems but on Windows 2003, the function does not
get called. The only workaround we have been able to find is to use the
"about:blank", as a trusted site, however we are concerned at the security
implications of implementing this workaround. Is there any configuration
option on Windows 2003 which would allow us to execute function calls for a
MouseOver event on a listbox? Tag: How to desactivate an network interface Tag: 164140
Calling Sub w/ Arguments
I have an HTML page that has an imbedded script. I want to call if from a
link and pass two values as arguments. The HTML document is being loaded
into a script-aware applicatoin. When I click the link, I get an error :
"Wrong number of arguments or invalid property assignment 'ZoomToOcr'".
I'm sure this is simple...but I'm fairly new to the HTML side. BTW, a couple
of side issues: 1) I am only running the script from the link so I am
holding the HREF="". 2) The "Set SW" line relates to the environment in
which the script is running and the html page is being loaded. I've used
this before and it works fine.
Here's my header w/ script...followed by my <A> link section:
<HTML>
<HEAD><META HTTP-EQUIV=""Content-Type"" CONTENT=""text/html;
charset=windows-1252""><META NAME=""Generator"" CONTENT=""Microsoft Word
97""></HEAD>
<TITLE>OCR Search on DB Search Results</TITLE><p><p>
<SCRIPT LANGUAGE="VBScript"
TYPE="text/VBScript">
Sub ZoomToOCR(DocID, Line)
Set SW=window.external
SW.ZoomToOCRDoc DocID, Line, ""
End Sub
</SCRIPT>
<A HREF="" ONCLICK=ZoomToOCR "BK000001", 21>BK000001</A>
If anyone has any ideas, please let me know. Thanks in advance.
Paul Tag: How to desactivate an network interface Tag: 164134
Syntax help using RunAs to issue a Shutdown.exe command.
Hi Everyone, I have a question regarding script syntax. I have numerous
examples of how to script WMI this way, but I'm bound and determined to
figure out why my script won't compile and run properly.
Here's the command prompt way of doing what I want:
C:\>runas /user:username "SHUTDOWN -R -F -M \\VCALDISP-1l -t 5" |
J:\SUPPORT\SANUR\SANUR password
This works perfectly.
Here's one version of the script I'm working on, but no matter how I format
the cCmd var, the script errors out:
(watch out for word wrapping)
Dim oShell
Set oShell = WScript.CreateObject ("WSCript.shell")
cCmd = "runas /user:username " & """ & "SHUTDOWN -R -F -M
\\VCALDISP-3S-VIS -t 5 " & """ & " | J:\SUPPORT\SANUR\SANUR password"
oShell.run cCmd
Set oShell = Nothing
Can anyone tell what's wrong?
Thanks.
--
William Fields
MCSD - Microsoft Visual FoxPro
MCP - Win2k Pro
US Bankruptcy Court
Phoenix, AZ
Bruce Lee was the man. Be water. Tag: How to desactivate an network interface Tag: 164131
How do you add a link to a site that uses a vbs script.....
How do you add a link to a website that fires off a vbs script on a local
server?
I need it for work and I'm not sure how to accomplish this.
Thx Tag: How to desactivate an network interface Tag: 164129
Scheduling task with other account rather than LOCALSYSTEM
Hello to all,
i´m developing a script using the clas Win32_ScheduledJob. The method create
of this class allow create Scheduled task in a machine, but, always under the
account LOCALSYSTEM adn also this Scheduled task cannot be modified later.
Can anyone help me??
Thanks in advanced Tag: How to desactivate an network interface Tag: 164125
How to Authenticate to Create Local User On Remote WorkGroup Computer?
Hi,
First let me start by saying I'm no vbscripter but I've been doing some
playing around and I'm trying to write a small vbscript that I can
execute with cscript to create a local user on a remote Standalone
machine.
I started by creating a simple script that allows me to enter the
computer name to create the account on along with the username and
password of the new user account that will be created. I was able to run
this script on my local machine without problems and I was also able to
supply a different computer and successfully created the account after
authenticating myself with net use \\remotepc /user:<Administrator>
<Password>
------
strComputer = InputBox("Enter Computer Name: ", "Computer Name")
strUserName = InputBox("Enter UserName: ", "User Information")
strPassword = InputBox("Enter Password: ", "Password")
Set Accounts = GetObject("WinNT://" & strComputer & ",computer")
Set objUser = Accounts.Create("user", strUserName)
objUser.SetPassword strPassword
objUser.Put "PasswordExpired", 1
objuser.Fullname = "Test User"
objuser.description = "Test Description"
objUser.SetInfo
------
So now my problem, after two days of reading, I haven't really been able
to figure out how I can avoid the net use procedure and have the script
authenticate and create the user on a remote standalone box. I've read
that it's farily easy to authenticate a user on Active Directory using
the LDAP Provider, I've been trying to do the same thing using the WinNT
provider. As you can see from some good I pieced together with sames on
the net.
As I said before, I'm not vbscripter and I'm not sure if I'm even going
in the right direction, but I hope that someone could give me some
suggestions or point me to a sample script that can authenticate as a
user on a remote box that isn't on the domain to perform administrative
tasks.
Thanks in Advance!
---
strComputer = InputBox("Please enter Computer Name: ", "Computer Name")
strUserName = InputBox("Please enter UserName: ", "User Information")
strPassword = InputBox("Please enter Password: ", "Password")
on error resume next
strADsPath = ("WinNT://" & strComputer)
if (not strADsPath= "") then
' bind to the ADSI object and authenticate Username and password
Dim oADsObject
Set oADsObject = GetObject(strADsPath)
WScript.Echo "Authenticating"
Dim strADsNamespace
Dim oADsNamespace
strADsNamespace = left(strADsPath, instr(strADsPath, ":"))
set oADsNamespace = GetObject(strADsNamespace)
Set oADsObject = oADsNamespace.OpenDSObject(strADsPath & "/" &
strUserName, strUserName, strPassword, 1)
' we're only bound if err.number = 0
if not (Err.number = 0) then
WScript.Echo "Failed to bind to object" ' & strADsPath
WScript.Echo err.description
WScript.Echo "Error number is " & err.number
else
WScript.Echo "USER AUTHENTICATED!"
WScript.Echo "Currently viewing object at " & oADsObject.ADsPath
WScript.Echo "Class is " & oADsObject.Class
end if
end if
--- Tag: How to desactivate an network interface Tag: 164124
How to grab text from an open console window?
Is it possible to grab the text being displayed by an open console
window? I understand that console windows don't expose a scriptable
object model, so you can't do something like:
Set objCMD = CreateObject( "Command.Application" )
strText = objCMD.Document.DocumentElement.Text
But are there other approaches? Can you work with the desktop, for
instance? Thanks in advance to all who respond.
Leslie Tag: How to desactivate an network interface Tag: 164123
Why xmlhttp detection fails?
I have following code to detect for xmlhttp object and it fails on default
security settings in IE6 Win XP, but works on IE6.0 Wn 2000
<SCRIPT language="VBScript">
Function DetectWinhttp()
On error resume next
DetectWinhttp = IsObject(CreateObject("Microsoft.XMLHTTP"))
end function
</SCRIPT> Tag: How to desactivate an network interface Tag: 164122
Set the default local printer LPT1 using script
Hi,
I'm very new with scripting and I have a very small network and I'm trying
to get spesific machines to default to LPT1 printer. Is this something I
could do with scripts or changing the win.ini? What should be the command to
use?
Thanks in advance. Tag: How to desactivate an network interface Tag: 164121
Programmatically change NICs Link Speed and Duplex
If someone could get me started in the right direction on this one I would
greatly appreciate it.
I want to have a script running from a scheduled task that will change the
link speed of machines it is run on:
Basically the scheduled task runs at 8am in the morning and changes the
machine link speed to 10Mb Full, then at 8pm at night the task runs with a
different set of variables and changes the link speed up to 100Mb Full (or
1Gb Full)...
I realize this could very since it is a rather hardware specific setting and
I am guessing it would be different from Intel to Netgear.
Any help is appreciated.
Joe Tag: How to desactivate an network interface Tag: 164120
VBScript to do FTP
I have some problems finding an easy way to do FTP in VBScript so I
put this script together to do what I needed. I initially thought it
would be a hassle but it turn out pretty managable. Here is a strip
down version of the script with comments for anyone who'd like to try
it out. Basically your just creating a FTPCommands file the is used
with a ftp -s: switch.
You may need to reformat this thing before using it, the Google post
isn't wide enough I think.
Here it is...
'****Script to FTP using VBScript (With Comments)
'****By Matthew Ososky
'****Happy FTP'n!
'****THESE ARE YOUR VARIABLES TO SET
DirectoryRoot = "C:\Scripts" 'PATH OF THE FOLDER YOUR RUNNING THIS
SCRIPT IN
LogsDir = "C:\Logs" 'PATH OF THE FILE YOU WANT TO TRANSFER
FTPFile = "server.log" 'FILE TO FTP
FTPSERVER = "ftp.iris.state.wy.us" 'YOUR FTP SERVER's NAME OR ADDRESS
set objFSO = CreateObject("Scripting.FileSystemObject")
'****CHECK TO SEE IF YOUR TARGET FILE EXISTS
'****IF YES GET INTO THE FTP EXECUTION
'****IF NOT, LOG IT AND END SCRIPT
if objFSO.FileExists(LogsDir & "\" & FTPFile ) then
'***GET A HANDLE ON YOUR TARGET FILE
'***COPY TARGET FILE TO THE DIRECTORYROOT
Set LogFile = objFSO.GetFile(LogsDir & "\" & FTPFile)
LogFile.copy DirectoryRoot & "\" & FTPFile , true
'****NOW CREATE OR RECREATE THE FTPCOMMANDS.TXT FILE
'****THIS FILE DETERMINES HOW FTP WILL EXECUTE
if CheckFTPCommands = TRUE then
DeleteFTPCommands()
CreateFTPCommands()
else
CreateFTPCommands()
end if
'****NOW WRITE THE COMMANDS TO HANDLE FTP
WRITELINE("anonymous") 'LOG IN
WRITELINE("ls") 'RETRIVE DIRECTORY (YOU NEED TOO)
WRITELINE("cd Logs") 'CHANGE TO THE DIRECTORY YOU WANT
'WRITELINE("cd Server1Logs) 'AS MANY TIMES AS YOU NEED
WRITELINE("put " & FTPFile) 'ONCE IN THE RIGHT DIR. PUT YOUR FILE IN
WRITELINE("Quit") 'THEN GET OUT
'****OK, NOW YOU NEED TO EXECUTE THE FTP SHELL COMMAND THAT DOES ALL
THIS
Set WshShell = CreateObject("WScript.Shell")
'****HERE'S THE SYNTAX STRING;
'****THE -s: flag calls our FTPCommands.txt file
'****Which is located at ~ DirectoryRoot & "\FTPCommands.txt
'****AFTER THAT YOU ENTER THE FTP SITE'S NAME OR ADDRESS
FTPString = "FTP -s:" & DirectoryRoot & "\FTPCommands.txt " &
FTPSERVER
'****EXECUTE THE SHELL COMMAND
'****LOG THE OPERATION
'****WAIT 2 SECONDS (you need to) THEN DELETE THE COPY OF THE FILE
YOU PUT IN DIRECTORYROOT
Set oExec = WshShell.Exec(FTPString)
LogStart 4, "The Server Log has finished FTP Transfer " & time()
wscript.sleep 2000
DeleteFTPFile(FTPFILE)
'****YOUR ALL DONE
'****YOU CAN CHANGE THE SCRIPT TO DO ANOTHER FILE,
'****OR EVEN GET FILES AND DO STUFF WITH THEM
else
LogStart 4, "Your target file does not exist." & time()
end if
'****These are the Subroutines
'****LOGSTART MAKES LOGS ENTRIES IN THE WINDOWS EVENT LOG (APPLICATION
under "WHS" - Windows script Host)
Sub LogStart (strEventType, strMessage)
Set objShell = CreateObject("Wscript.Shell")
objShell.LogEvent cint(intEventType), strMessage
Err.Clear
Exit Sub
End sub
Sub CreateFTPCommands()
set objFSO = CreateObject("Scripting.FileSystemObject")
Set FTPCommands = objFSO.CreateTextFile(DirectoryRoot &
"\FTPCommands.txt")
End Sub
Function CheckFTPCommands()
set objFSO = CreateObject("Scripting.FileSystemObject")
CheckFTPCommands = objFSO.FileExists(DirectoryRoot &
"\FTPCommands.txt")
End Function
Sub DeleteFTPCommands()
set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile(DirectoryRoot & "\FTPCommands.txt")
End Sub
Sub WRITELINE(strLINE)
set objFSO = CreateObject("Scripting.FileSystemObject")
set FTPCommands = objFSO.OpenTextFile(DirectoryRoot &
"\FTPCommands.txt",8,true)
FTPCommands.writeline strLINE
End Sub
Sub DeleteFTPFile(FILENAME1)
set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile(DirectoryRoot & "\" & FILENAME1)
End Sub Tag: How to desactivate an network interface Tag: 164117
ASP Page as a remote function call in JavaScript
Hello,
I've been playing with the idea of just how to use an ASP page to provide a
remote function call. In an ideal world this would be a web service but how
can you do it if restricted to ASP 3.0 ?
Idea 1 was to write an ASP page that accepted arguments using the classic
?X=1&Y=2 type of strings and have the page return an ADO disconnected record
set containing the results of the action. This is call very well, and works,
but you do have to allow the browser to create an ADODB.RecordSet in which
to place the results which goes against some security principles.
Idea 2 was to use an <IFRAME> and replace the src for this frame at run time
with the result from an ASP page, again using the ?X=1&Y=2 type of string to
pass in arguments. The results could then come back as a table and be
accessed via the DOM. The problem with this is that the client needs to wait
for the page to be loaded before it can be sure that the contents of the
table is valid and the browser does not seem to allow waits and does not
like busy waits.
Idea 3 - I'm still looking for this ! Does anyone have any ?
Many thanks
Martin Tag: How to desactivate an network interface Tag: 164111
Is it possible to restart a service so all the dependancies get restarted as
Is it possible to restart a service so all the dependancies get restarted as
well rather than stop and start one. The problem is the Cim agents and
snmp. I can't send a stop and start command via script since cim agents
depend on it.
Jason Tag: How to desactivate an network interface Tag: 164110
Someone know Why WMI actions d'ont work in to a IE form?
Firts sorry for my bad English (I'm Spanish) and sincerly thanks for read
this.
My problem is the next; this vbscript code work fine directly from a .vbs
file in Win2k Sp4 and VBS 5.6:
Dim objWMIService, objProcess, colProcessList, proceso
proceso = "notepad.exe"
Set objWMIService =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\tsystems1\root\cimv2"
)
Set colProcessList = objWMIService.ExecQuery ("Select * from Win32_Process
Where Name = 'notepad.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
msgbox "Proceso Parado"
But if it is integrated in to a IE form:
<html><head><title>Listando Procesos</title>
<SCRIPT LANGUAGE="VBScript">
Sub x1692
Dim objWMIService, objProcess, colProcessList, proceso
proceso = "notepad.exe"
Set objWMIService =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\equipo\root\cimv2")
Set colProcessList = objWMIService.ExecQuery ("Select * from Win32_Process
Where Name = 'notepad.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
msgbox "Proceso Parado"
End Sub
<tr><td width='20%'>notepad.exe</td><td width='10%'>1692</td><td
width='50%'>C:\WINNT\system32\notepad.exe</td>
<td width='20%'><FORM name="frmone"><INPUT TYPE="BUTTON" value="Parar"
NAME="x1692" onclick="x1692"></FORM></td></tr>
</table></body>
</html>
D'ont show errors and no msgs appears and I stay sure that the code is ok.
My questions are;
Have win2k any security patch that make impossible execute
this code in IE form?
Anyone know how will do for execute it whitout this
problem? Tag: How to desactivate an network interface Tag: 164106
Basic script help please
created a script to delete files ie) *.jpg files in folder and log entrys,
but must be missing something as it doesnt log
anything and doesnt delete anything anymore. It had it deleting at one stage,
but must have changed something and not sure what.
Any ideas clever people?
Path1 = "C:\Documents and Settings\REMOTEINSTALL\My Documents\My
Pictures\QuickCam\Album\Motion Images\Security Videos"
Dim objFSO 'File System Object - connection to file system
Dim oFolder 'holds path to image folder
Dim oFile 'variable for each file in folder
Dim logfile 'holds path to the log file
Dim objFile 'used by OpenTextFile command to allow writing to
file
Const ForWriting = 2
Const ForAppending = 8
logfile = "C:\Delete Files Script\log.txt"
Set objFSO = Createobject("Scripting.FileSystemObject")
Set oFolder = objFSO.GetFolder(Path1)
For Each oFile In oFolder.Files
If DateDiff("d", oFile.DateCreated,Now) > 14 Then
oFile.Delete
wscript.Echo "this file was deleted " & oFile.Name
If objFSO.FileExists(logfile) Then
Set objFile = objFSO.OpenTextFile(logfile, ForAppending)
objFile.Write oFile.Name
Else
Set objFile = objFSO.OpenTextFile(logfile, ForWriting)
objFile.Write oFile.Name
objFile.Close
'WScript.Echo "file " & oFile.Name
'objFile.WriteLine oFile.Name & Now 'Now command writes data/time
'objFile.Close
'WScript.Echo "Log file ammended"
End If
End If
Next Tag: How to desactivate an network interface Tag: 164103
Remove proxy addresses from AD
Hi
I am trying to remove some mail aliase from my users account i AD, here are
the script
set oOu = getobject("LDAP://ou=test,ou=people,dc=test,dc=local")
oOu.filter = array("user")
for each oUser in oOu
for each adr in oUser.proxyAddresses
if instr(adr,"test.no") then
oUser.putex 1, proxyAddresses, array(adr)
oUser.setinfo
end if
next
next
msgbox "Finish"
The line oUser.setinfo genrates the error "A constraint violation has
occoured"
Any suggestions ?? Tag: How to desactivate an network interface Tag: 164102
Service Pack version
Can anyone tell me if you can get the SP versions by scripting. I need the SP
versions for office? Tag: How to desactivate an network interface Tag: 164100
How to Block the Inherit permisson on new created folder by script
I have to create a lot of folder by the script.However,I also want to clear the
"Allow inherit permission from parent to propagate to this object" for each
new created folder automatically.Therefore,i would like to know how to do
this in the script.Thanks! Tag: How to desactivate an network interface Tag: 164095
Vbscript for database manipulation
Hi all,
Here is what I am trying to do, hope someone can help me implement
this.
Every hour, I would like a script that does the following (in vbscript
cause that's the only one I am even remotely comfortable with)
1- Extract from a secure database 4 query result tables and copy them
into a new unsecure database
2- Connect to the internet
3- Send the new unsecure database to our servers online
4- Close the internet connection
I think I have figured out how to do step number 3 through an ftp -s:
script and ftp command .txt file.
My problem is really step 1, so far, I have only been able to create a
new blank database, with the structures of the 4 tables receiving the
query results built. I am stuck here, I can't even transfer the query
results to the database, and I haven't even started looking at how to
unsecure the new database, and/or tables.
Does anyone know of any efficient, quick way of doing, the above?
I think I can manage with steps 2 and 4, Step 1 is really my problem
here.
I have so far the following code.
----BEGINNING OF CODE
'**********************************************************************************************
'**********************************************************************************************
'**********************************************************************************************
' DECLARE VARIABLES
'**********************************************************************************************
'**********************************************************************************************
'**********************************************************************************************
Dim appAccess, appAccess2, filesys, filedelete, db
Dim t1, t2, t3, t4, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12,
f13, f14, i1, i2, i3, i4
Const DB_TEXT = 10
Const DB_LONG = 4
Const DB_DATE = 8
Const DB_DOUBLE = 7
Const AcFormatXLS = "Microsoft Excel (*.xls)"
Const AcOutputTable = 0
Const AcOutputQuery = 1
Const et1 = "FastTrackOperation"
Const OldPath = "D:\Main\Design\FlashTest\Bck-Jun-10-04.mdb"
Const InterPath = "D:\db2.xls"
Const NewPath = "D:\db2.mdb"
'**********************************************************************************************
'**********************************************************************************************
'**********************************************************************************************
' DELETE DB2.MDB IF PRESENT
'**********************************************************************************************
'**********************************************************************************************
'**********************************************************************************************
Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FileExists(NewPath) Then
Set filedelete = filesys.GetFile(NewPath)
filedelete.Delete
Set filedelete = Nothing
End If
Set filesys = Nothing
'**********************************************************************************************
'**********************************************************************************************
'**********************************************************************************************
' CREATE BRAND NEW DATABASE
'**********************************************************************************************
'**********************************************************************************************
'**********************************************************************************************
Set appAccess = CreateObject("Access.Application.10")
appAccess.NewCurrentDatabase NewPath
Set db = appAccess.CurrentDb
'**********************************************************************************************
'**********************************************************************************************
' CREATE TABLE 1
'**********************************************************************************************
'**********************************************************************************************
Set t1 = db.CreateTableDef("t1")
Set f1 = t1.CreateField("f1", DB_LONG, 40)
f1.Required = -1
t1.Fields.Append f1
Set f2 = t1.CreateField("f2", DB_LONG, 40)
f2.Required = -1
t1.Fields.Append f2
Set f3 = t1.CreateField("f3", DB_TEXT, 40)
f3.Required = -1
t1.Fields.Append f3
Set f4 = t1.CreateField("f4", DB_TEXT, 40)
f4.Required = -1
t1.Fields.Append f4
Set f5 = t1.CreateField("f5", DB_DATE, 40)
f5.Required = -1
t1.Fields.Append f5
Set f6 = t1.CreateField("f6", DB_TEXT, 40)
f6.Required = -1
t1.Fields.Append f6
Set f7 = t1.CreateField("f7", DB_DATE, 40)
t1.Fields.Append f7
Set f8 = t1.CreateField("f8", DB_TEXT, 40)
t1.Fields.Append f8
Set f9 = t1.CreateField("f9", DB_TEXT, 40)
t1.Fields.Append f9
Set i1 = t1.CreateIndex("i1")
Set f1 = i1.CreateField("f1", DB_LONG, 40)
i1.Fields.Append f1
i1.Primary = -1
i1.Unique = -1
t1.Indexes.Append i1
Set i2 = t1.CreateIndex("i2")
Set f2 = i2.CreateField("f2", DB_LONG, 40)
i2.Fields.Append f2
i2.Primary = 0
i2.Unique = 0
t1.Indexes.Append i2
db.TableDefs.Append t1
'**********************************************************************************************
'**********************************************************************************************
' CREATE TABLE 2
'**********************************************************************************************
'**********************************************************************************************
Set t2 = db.CreateTableDef("t2")
Set f1 = t2.CreateField("f1", DB_LONG, 40)
f1.Required = -1
t2.Fields.Append f1
Set f2 = t2.CreateField("f2", DB_TEXT, 40)
f2.Required = -1
t2.Fields.Append f2
Set f3 = t2.CreateField("f3", DB_LONG, 40)
f3.Required = -1
t2.Fields.Append f3
Set f4 = t2.CreateField("f4", DB_TEXT, 40)
f4.Required = -1
t2.Fields.Append f4
Set f5 = t2.CreateField("f5", DB_TEXT, 40)
t2.Fields.Append f5
Set f6 = t2.CreateField("f6", DB_LONG, 40)
t2.Fields.Append f6
Set f7 = t2.CreateField("f7", DB_LONG, 40)
t2.Fields.Append f7
Set f8 = t2.CreateField("f8", DB_LONG, 40)
f8.Required = -1
t2.Fields.Append f8
Set i1 = t2.CreateIndex("i1")
Set f1 = i1.CreateField("f1", DB_LONG, 40)
i1.Fields.Append f1
i1.Primary = 0
i1.Unique = 0
t2.Indexes.Append i1
Set i2 = t2.CreateIndex("i2")
Set f2 = i2.CreateField("f2", DB_TEXT, 40)
i2.Fields.Append f2
i2.Primary = 0
i2.Unique = 0
t2.Indexes.Append i2
Set i3 = t2.CreateIndex("i3")
Set f8 = i3.CreateField("f8", DB_LONG, 40)
i3.Fields.Append f8
i3.Primary = -1
i3.Unique = -1
t2.Indexes.Append i3
db.TableDefs.Append t2
'**********************************************************************************************
'**********************************************************************************************
' CREATE TABLE 3
'**********************************************************************************************
'**********************************************************************************************
Set t3 = db.CreateTableDef("t3")
Set f1 = t3.CreateField("f1", DB_LONG, 40)
f1.Required = -1
t3.Fields.Append f1
Set f2 = t3.CreateField("f2", DB_DATE, 40)
f2.Required = -1
t3.Fields.Append f2
Set f3 = t3.CreateField("f3", DB_DATE, 40)
f3.Required = -1
t3.Fields.Append f3
Set f4 = t3.CreateField("f4", DB_LONG, 40)
t3.Fields.Append f4
Set f5 = t3.CreateField("f5", DB_TEXT, 40)
f5.Required = -1
t3.Fields.Append f5
Set f6 = t3.CreateField("f6", DB_TEXT, 40)
t3.Fields.Append f6
Set f7 = t3.CreateField("f7", DB_TEXT, 40)
t3.Fields.Append f7
Set i1 = t3.CreateIndex("i1")
Set f1 = i1.CreateField("f1", DB_LONG, 40)
i1.Fields.Append f1
Set f2 = i1.CreateField("f2", DB_DATE, 40)
i1.Fields.Append f2
Set f3 = i1.CreateField("f3", DB_DATE, 40)
i1.Fields.Append f3
i1.Primary = -1
i1.Unique = -1
t3.Indexes.Append i1
Set i2 = t3.CreateIndex("i2")
Set f5 = i2.CreateField("f5", DB_TEXT, 40)
i2.Fields.Append f5
i2.Primary = 0
i2.Unique = 0
t3.Indexes.Append i2
db.TableDefs.Append t3
'**********************************************************************************************
'**********************************************************************************************
' CREATE TABLE 4
'**********************************************************************************************
'**********************************************************************************************
Set t4 = db.CreateTableDef("t4")
Set f1 = t4.CreateField("f1", DB_LONG, 40)
t4.Fields.Append f1
Set f2 = t4.CreateField("f2", DB_TEXT, 40)
t4.Fields.Append f2
Set f3 = t4.CreateField("f3", DB_DATE, 40)
t4.Fields.Append f3
Set f4 = t4.CreateField("f4", DB_DOUBLE, 40)
t4.Fields.Append f4
Set f5 = t4.CreateField("f5", DB_DOUBLE, 40)
t4.Fields.Append f5
Set f6 = t4.CreateField("f6", DB_DOUBLE, 40)
t4.Fields.Append f6
Set f7 = t4.CreateField("f7", DB_DOUBLE, 40)
t4.Fields.Append f7
Set f8 = t4.CreateField("f8", DB_DOUBLE, 40)
t4.Fields.Append f8
Set f9 = t4.CreateField("f9", DB_DOUBLE, 40)
t4.Fields.Append f9
Set f10 = t4.CreateField("f10", DB_LONG, 40)
t4.Fields.Append f10
Set f11 = t4.CreateField("f11", DB_LONG, 40)
t4.Fields.Append f11
Set f12 = t4.CreateField("f12", DB_DOUBLE, 40)
t4.Fields.Append f12
Set f13 = t4.CreateField("f13", DB_DOUBLE, 40)
t4.Fields.Append f13
Set f14 = t4.CreateField("f14", DB_TEXT, 40)
t4.Fields.Append f14
db.TableDefs.Append t4
'**********************************************************************************************
'**********************************************************************************************
'**********************************************************************************************
' EXPORT ACCESS QUERIES TO EXCEL
'**********************************************************************************************
'**********************************************************************************************
'**********************************************************************************************
Set appAccess = Nothing
Set db = Nothing
Set appAccess2 = CreateObject("Access.Application.10")
appAccess2.OpenCurrentDatabase OldPath
'appAccess2.DoCmd.OutputTo acOutputTable, et1, acFormatXLS, InterPath
'appAccess2.DoCmd.TransferDatabase acExport, "Microsoft Access",
NewPath, AcOutputTable, et1, "[Test1]", False
appAccess2.DoCmd.CopyObject NewPath, , AcTable, et1
'NOTHING SEEMS TO WORK HERE _ GET VARIOUS ERRORS ACCROSS ALL THREE
TECHNIQUES
appAccess2.CloseCurrentDatabase
appAccess2.Quit
Set appAccess2 = Nothing
'**********************************************************************************************
'**********************************************************************************************
'**********************************************************************************************
' CLEAR ALL OBJECTS
'**********************************************************************************************
'**********************************************************************************************
'**********************************************************************************************
Set t1 = Nothing
Set t2 = Nothing
Set t3 = Nothing
Set t4 = Nothing
Set f1 = Nothing
Set f2 = Nothing
Set f3 = Nothing
Set f4 = Nothing
Set f5 = Nothing
Set f6 = Nothing
Set f7 = Nothing
Set f8 = Nothing
Set f9 = Nothing
Set f10 = Nothing
Set f11 = Nothing
Set f12 = Nothing
Set f13 = Nothing
Set f14 = Nothing
Set i1 = Nothing
Set i2 = Nothing
Set i3 = Nothing
Set i4 = Nothing
Set appAccess2 = Nothing
Set appAccess = Nothing
Set db = Nothing Tag: How to desactivate an network interface Tag: 164094
DHCPOBJS.DLL
I've been trying to use DHCPOBJS.DLL to populate a DHCP database however it
doesn't seem to have an option to set the value for the Supported Types -
defaults to "Both", i need "DHCP only". Is there any way of setting this
option from within vbscript (Using DHCPOBJS or another API) or do I need to
revert to a command script using Netsh?
Thanks in advance :)
--
Tez Tag: How to desactivate an network interface Tag: 164093
vbs script to create vpc and differencing disks
I have a need to automate the creation of many new Virtual PCs and their
differencing disks.
Ideally I would like the user to select one of 4 parent drives and have all
other vpc properties populated.
OS: Windows XP SP1
Virtual PC 2004
Does anyone have any insight into this dilema? Tag: How to desactivate an network interface Tag: 164090
Laptop Power Configurations
Hi
The power options for laptops in our organization has been set so that
the Advanced option "When I close the lid of my portable computer" is
set to "Hibernate". We need to change this to "Do Nothing". Is it
possible to midify these Power settings programatically using
VBSCripts, WMI or even VB6 ?
Any help is appreciated.
Thanks Tag: How to desactivate an network interface Tag: 164087
Add a local printer
I have a need to check if the local printer HP LaserJet 4 is already
installed on the local machine and quit if it is. If not the printer should
be installed on the local machine. I am fairly new to scripting and got this
example from another posting from Torgeir and have been trying to modify it
to work for me. I seem to be having a syntax issue in the WshShell.run
statement, but I am unsure how to correct the issue.
Set oPrnSet = GetObject( _
"winmgmts:{impersonationLevel=impersonate}!//localhost") _
.ExecQuery("select Name from Win32_Printer")
Set WshShell = WScript.CreateObject ("WScript.Shell")
For Each oPrn in oPrnSet
If Lcase(oPrn.Name) = LCase("HP LaserJet 4") Then
Wscript.Quit
Else
WshShell.run rundll32 printui.dll,PrintUIEntry /q /if /b "HP LaserJet 4" /f
%windir%\inf\ntprint.inf /r "lpt2:" /m "HP LaserJet 4"
End If
Next
If anyone could provide an explanation of what I'm doing wrong it will be
appreciated!!!
Joel Tag: How to desactivate an network interface Tag: 164083
ACCESS and ASP
Working on dynamically deleting a database entry. Below is the code I'm
running into an error with. There is a column in the database by the name of
"email".
Is it possible for the ASP code to define an ACCESS column as a Form?
<%
' Declaring variables
Dim email, con, data_source, sql_delete
email = Request.Form("email")
sql_delete = "delete email from users where email = '" & email & "'"
data_source = "Provider=Microsoft.Jet.OLEDB.4.0;
Data Source = " & _
Server.MapPath("mail.mdb")
Set con = Server.CreateObject("ADODB.Connection")
con.Open data_source
con.Execute sql_delete
con.Close
Set con = Nothing
Response.Write "Your email address " & email & _
" was successfully deleted from our database."
%> Tag: How to desactivate an network interface Tag: 164081
Adding MIME types via script to IIS
I am trying to update MIME types in an IIS virtual directory via code. It is
not adding any new type to the system. Any ideas? Is there a way to check if
the MIME types exists before attempting to add it?
CALL SetRequiredIISMimeTypes
'============================================
Sub SetRequiredIISMimeTypes
const strMIME_TYPE_EXT_1 = ".abc"
const strMIME_TYPE_DATA_1 = "text/plain"
const strMIME_TYPE_EXT_2= ".efg"
const strMIME_TYPE_DATA_2 = "application/octet-stream"
'Call procedure to set MIME types.
AddTypeToIIS strMIME_TYPE_EXT_1, strMIME_TYPE_DATA_1
AddTypeToIIS strMIME_TYPE_EXT_2, strMIME_TYPE_DATA_2
End Sub
Sub AddTypeToIIS(strExtension, strMimeType)
Dim objMimeMap
Dim objMimeMapList
Dim lngMimeMapListCount
Const ADS_PROPERTY_UPDATE = 2
' Specify the location in the IIS metabase for the 'MimeMap' node.
' Note: 'MimeMapObj' acts a 'container' object for the 'objMimeMapList'
object.
Set objMimeMap = GetObject("IIS://localhost/W3SVC")
' Use GetEx to retrieve an array of 'MimeMap' objects.
objMimeMapList = objMimeMap.GetEx("MimeMap")
' Create a new 'MimeMap' item in the array.
lngMimeMapListCount = UBound(objMimeMapList) + 1
ReDim Preserve objMimeMapList(lngMimeMapListCount)
Set objMimeMapList(lngMimeMapListCount) = CreateObject("MimeMap")
' Create our new 'MimeType'
objMimeMapList(lngMimeMapListCount).Extension = strExtension
objMimeMapList(lngMimeMapListCount).MimeType = strMimeType
' Use PutEx to UPDATE the MimeMap array with our new array.
objMimeMap.PutEx ADS_PROPERTY_UPDATE, "MimeMap", objMimeMapList
objMimeMap.SetInfo
End Sub
Any help would be appreciated!
--
Primetime
{Coding to the break of dawn} Tag: How to desactivate an network interface Tag: 164080
Change rights on C and D drives to read only
Where can I go to look up information on how to change the
rights one user has on his C and D drives. I want to
change the rights to read only so the user can't delete
anything.
I have looked in my VBScript Programmer's Reference,
Microsoft Windows 2000 Scripting Guide, and Microsoft
Windows Scripting Self-Paced Learning Guide.
Thanks,
Jeff Tag: How to desactivate an network interface Tag: 164079
Data field format problem
I am having a strange problem with ASP. Whenever I build an SQL query using a text field with text in it, I get and error "[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.". The underlying table uses a text field, and I have tried cStr thru various methods in the ASP page to no avail. AS long as numbers only are entered, it works. I am comparing data to a session variable. Can anyone help? Here is the initial code for one of the datasets.
Set rsCEMData = Server.CreateObject("ADODB.Recordset")
rsCEMData.ActiveConnection = MM_connApp_STRING
rsCEMData.Source = "SELECT * FROM tblCustResults WHERE fldSampNum = " + Replace(rsCEMData__MMColParam, "''", "''''") + " AND fldCN = " + Replace(rsCEMData__MMColParam2, "''", "''''") + " AND fldSerial = " + Replace (cStr(rsCEMData__MMColParam3), "''", "''''") + ""
rsCEMData.CursorType = 0
rsCEMData.CursorLocation = 2
rsCEMData.LockType = 1
rsCEMData.Open()
Here is how I set the variables:
Dim rsCEMData2__MMColParam3
rsCEMData2__MMColParam3 = "1"
If (Session("VarSerial") <> "") Then
rsCEMData2__MMColParam3 = Cstr(Session("VarSerial"))
Any help is greatly appreciated!!
-----------------------------
This message is posted by http://asp.forumszone.com Tag: How to desactivate an network interface Tag: 164070
Hi everybody,
I wish to desactivate an network interface via vds.