Change the way a file name is displayed (remove the c:\ and change to http)
What I would like to do in my script is change the c:\ to http:// before it
is written in my database, any help would be great, thanks!
' on error resume next
strComputer = "."
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adUseClient = 3
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery("Select * from CIM_DataFile where
Path = '\\small\\'")
For Each objFile in colFiles
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordset = CreateObject("ADODB.Recordset")
objConnection.Open "DSN=Filename;"
objRecordset.CursorLocation = adUseClient
objRecordset.Open "SELECT * FROM Filename" , objConnection, adOpenStatic,
adLockOptimistic
objRecordset.AddNew
objRecordset("Filename") = objFile.Name
objRecordset.Update
Next
objRecordset.Close
objConnection.Close Tag: Re: Unable to remove remembered drives Tag: 162918
How to Read From a Carriage Return File.
Hi Everybody,
I have a TextFile which has data some thing like below,
abc, 1
def, 1
ghi, 1
How do read line by Line using a FileSystem Object.
The above data is in a Text file and it has Carriage Returns.
Any help is Appreciated.
--
Santosh Tag: Re: Unable to remove remembered drives Tag: 162914
multiprocessors and hyperthreading
Hi
I am trying to find out if a multiprocessor system with say, 2 or 4
processors, is using Hyper-threading or not. Is there a way i can do
this programatically, preferably using VBScript or VB6?
Thanks. Tag: Re: Unable to remove remembered drives Tag: 162911
Open Access Table
Hi,
Can anyone give me the sample codes to open and manipulate the data in the
Access table with vbscript? I want to open the Access table and extract
cirtain information from it on a daily basics. The script is running
automatically in a scheduler. Thank you.
Fan Tag: Re: Unable to remove remembered drives Tag: 162909
Open an application using script
I'm using Win XP Home and have Microsoft Office Professional installed. I'm a complete
novice as far as VB Script is concerned and would be grateful if someone could tell me
whether you can use it to open an Access database (in MS Access)?. I tried setting up
an object variable using CreateObject and then called the OpenCurrentDatabase method
but this didn't work. Does the object variable go out of scope when the script finishes thus
closing Access even if it was opened momentarily?
I don't want to have to write a VB program to do the job because I want something simple
that doesn't require installation. The reason that I want a user to run code rather than simply
open the Access database is because I want to check that the latest version of the application
resides on the user's machine and if not replace it with the latest version copied from the server.
Any advice would be appreciated. Tag: Re: Unable to remove remembered drives Tag: 162907
The DIR function
Hi all,
Is there any way to have the DIR function in Visual Basic 6, return the
file list in Sorted Order? I could do it internally, but about twice a year
I could have upwards of 5000 files to sort.
--
Tim Tag: Re: Unable to remove remembered drives Tag: 162906
Use VBscript to read messages in inbox
I want to schedule a script to open a users inbox, check the messages and
perform a function (i.e. write a to the event log) based on wether or not it
finds an email with a particular subject.
The script will run on one of our Exchange 2000 servers.
Any ideas/examples? Tag: Re: Unable to remove remembered drives Tag: 162899
Get DHCP lease information
Hi
Does anyone know how to get a list of active leases from a
DHCp server using VBscript.
I have been looking about the web for ages, but the only
thing I have came across is DHCP Objects 1.0 from the
windows 2000 res kit, but there is little documentation on
how to extract the information that I want.
Can anyone Help??? Tag: Re: Unable to remove remembered drives Tag: 162898
replace a string
Hy
I need to replace a string in a large text BUT even occurrences are upper or
lower case
e.g. Museo Archeologico, Museo archeologico, museo archeologico with "Museo
Archeologico"
I can I do?
Thanks Tag: Re: Unable to remove remembered drives Tag: 162894
WMI provider is not capable of the attempted operation
Hi.
I have been looking all over the web for how to set values with the use of
WMI, but cannot find much information.
I am using the PUT_ method but it generates the following message "provider
is not capable of the attempted operation"
Can anyone tell me why I receive this message?? Or even better.. How to use
wmi to set values.
My script looks like this:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\citrix")
Set colapps = objWMIService.ExecQuery _
("Select * from MetaFrame_Application")
For Each objApp in colApps
'Display the metaframe application im trying to disable
Msgbox objApp.Name
'disable applic|ation
objApp.EnableApp = False
'Save the data
objApp.Put_
Next Tag: Re: Unable to remove remembered drives Tag: 162886
Future version(s) of VBS and strong typing
Hello everyone,
I've been using VB, VBA and VBS both as a Windows scripting tool and in a
few
ASP pages as well for a long time now. I've learned to deal with having only
the
variant data type, but that doesn't mean I don't despise it still. Now I am
curious
whether future version(s) will support typing or not. I already know about
.NET
and ASP.NET, where typing is allowed, but I'm talking about VBS as we know
and use it now.
Does anyone know of plans to "upgrade" the scripting language and support
strong typing at any time?
For that matter, does anyone know WHY it was not included in the first
place?
I mean, would it have been THAT hard to implement from the beginning? Sure,
you can accomplish quite a bit the way it is, just not EVERYTHING, and I've
personally had quite a few occasions when variable typing would have made my
job tons easier.
Just curious... Tag: Re: Unable to remove remembered drives Tag: 162884
function call
I'm having a problem declaring and calling a function.
I need to create a function that will return an array.
I get this error running the following code:
Error:
An exception of type "Microsoft VBScript runtime error: Type mismatch:
'RndArray'' was not handled.
RndDiamonds = RndArray( 2, RecCount) 'this line of code raises the
error
Function RndArray( size, RecCount)
ReDim aArray( size )
for i = 0 to size
aArray(i) = -1
next
RndArray = aArray
End Function Tag: Re: Unable to remove remembered drives Tag: 162881
Passing link text as session variable
Hi,
Is there a way to pass link text as a session variable to the linked page?
Here's what I'm trying to do :
The page has a list of groups. Each group name appears in a <A HREF> </A>
tag. The page has a binding to the group(s) and has the displayName &
distinguishedName of the group.
When a user clicks on the group name - which appears between the <A> </A>
tags and is a variable - the sAMAccountName or displayName of the group, the
corresponding distinguishedName should be passed to the next page as a
session variable.
(I can do it with a separate button and a hidden form value, but that
doesn't work for all names with a space.)
Thanks,
Bharat Tag: Re: Unable to remove remembered drives Tag: 162878
Vbs: How To Read Variables From An external File?
Thank you SO SO SO much :) it worked. thanks :)
Tom Lavedas wrote:
> *I believe you want a line like ...
>
> Execute Command
> ' To illustrate that this worked as you wanted ...
> wsh.echo "Today's date is", today, vbnewline, "Sec = ", Sec
>
> If you intend to use this within a method and want the results to be
> global
> use ExecuteGlobal, instead.
>
> Tom Lavedas
> ===========
> *
--
Saleh
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------ Tag: Re: Unable to remove remembered drives Tag: 162876
scripting word
I need to create labels in word xp using script only.
what I have so far.
set objLbls = create object("word.application")
objLbls.visible=true
in between these 2 lines I need to populate the label fields and set
the type of avery sheet as well.
is that even possible, if so is there a knowledge base for it?
else please someone provide a sample code.
thanks Tag: Re: Unable to remove remembered drives Tag: 162875
' messing up code
I am working in front page and connecting to a data base. I have a back end
function where people can enter data to show up in the website.
I have found that when they enter a word that has an apostrophe in it
example I have the word "let's" and it messes up the code. How do I get
around this? This is the error I get.
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in
query expression ''35th Annual MR/LD Tootsie Roll Drive - September 17-19,
2004Alternate Drive Dates - September 24-26, October 1-3, and October 8-10!
Tootsie Rolls are for Everyone. Help support the special children. Let's
make this year a record year. Volunteer and y'.
Thanks,
Dave Tag: Re: Unable to remove remembered drives Tag: 162853
How to sign a VBScript in a web page?
Maybe I am in the wrong place and doing this the wrong way... please
tell me if you think there is a better way.
I need to transfer some files from a server to the client workstation.
The transfer has to be initiated from a page served up by the web
server. This is easy enough to do with VBScript and the FSO but I
have to loosen up the browser security and my (military) employer will
not allow that. So, is there some way I can take this script and sign
it and the user can run it once the certificate is accepted?
I am not resigned to using VBScript, it just seemed to be the easiest
way and works well. If it makes more sense to make an exe with
something like cpp and sign it, that's OK too. Surely there are some
tutorials on the web on how to do this, but I can't find any, which
makes me fear that it can't be done.
I could use an HTA if there is a way to initiate the HTA from the web
page and to pass it a parameter (the folder with the files - it will
vary with each transfer).
FWIW, I can create a page with links to all the files and by clicking
on them cause the 'save as' dialog to come up and let the user save
them. Problem is, sometimes there will be lots of files and I don't
want the user to have to click and save each one individually.
Any help will be greatly appreciated... TIA
Steve Tag: Re: Unable to remove remembered drives Tag: 162852
Re: ADsDSOObject question?
Hi, Yevgen
Thank you very much for your time. I found why i failed before. It works
fine after I changed the format of strDomain in
(objCommand.CommandText = "Select CN,DistinguishedName from 'LDAP://" &
strDomain & _
"' where objectClass='user' and CN = '" & strEmpID & "'")
from "DC=MyDomain,DC=COM,DC=TW" to "mydomain.com.tw".
I think this is due to i use this script in a cross domain scenario.
Both"DC=MyDomain,DC=COM,DC=TW" to "mydomain.com.tw" works fine if i run this
script on a member server of same domain. Thank you very much for your time.
best regards,
Eric Wu
From: Yevgen Lazaryev
Date Posted: 9/3/2004 5:13:00 AM
"Eric Wu" <eric_wu@alphanetworks.com> a écrit dans le message de
news:euydtkJkEHA.324@TK2MSFTNGP11.phx.gbl...
| Hi All,
Or i can use another way to do same
| check? Any suggestion or feedback will be greatly appreciated. Thank you
for
| your time.
.... Maybe you try WinNT provider instead of LDAP for this check ...It's
more
simple ...One thing to keep in mind is that objUser.Name in WinNT
corresponds "userPrincipalName" or "sAMAccountName" in LDAP or logon name of
a user ....Then you can check the domain like this ...
strUser = "another"
strDomain = "domain.com"
UserExists = false
Set colUsers = GetObject("WinNT://" & strDomain & "")
colUsers.Filter = Array("user")
For Each objUser In colUsers
oldUser = objUser.Name
If oldUser = strUser Then
UserExists = true
End If
Next
If UserExists Then
'EnableUser()
Wscript.Echo "Here"
Else
'DSCreateUser()
Wscript.Echo "None"
End If
From: Eric Wu
Date Posted: 9/1/2004 9:13:00 PM
Hi All,
I wrote a script to check if user already existing before create
user account, if user exists, i use enable instead of create. This works
fine in my own domain, but it failed when i try to connect to another
domain. Due to
this script will runs on a standalone server, i must solve this problem. I
tried to found authentication method about ADsDSOObject on MSDN web site.
But all
failed. The command object returns nothing when connect to another domain.
Did anyone has any idea about this? Or i can use another way to do same
check? Any suggestion or feedback will be greatly appreciated. Thank you for
your time.
Best regards,
Eric Wu
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
'No error here, but not working
objConnection.Properties("User ID") = strUser
objConnection.Properties("Password") = strPassword
'objConnection.Properties("Encrypt Password") = True
objConnection.Properties("ADSI Flag") = 2
'No error here, but not working, too
objConnection.Open "Active Directory Provider",strUser,strPassword
Set objCommand = CreateObject("ADODB.Command")
Set objCOmmand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1500
'objCommand.Properties("Timeout") = 30
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = "Select CN,DistinguishedName from 'LDAP://" &
strDomain & _
"' where objectClass='user' and CN = '" & strEmpID & "'"
Set objRecordSet = objCommand.Execute
If objRecordSet.RecordCount = 1 Then
EnableUser()
Else
DSCreateUser()
End If Tag: Re: Unable to remove remembered drives Tag: 162846
ASP version or code problem?
Hi everyone,
I just resumed working with ASP after a year or so out of the loop and I
have this problem (using a simple html editor). Here's my code:
dim temp (5)
temp(1) = "blablabla"
ReDim Preseve (temp(10))
Response.Write temp(1)
when I run it I get an error
Error Type:
Microsoft VBScript runtime (0x800A0009)
Subscript out of range: '[number: 10]'
/index.asp, line 18
Code seems legit, but something else led me to believe it could be a problem
with the Personal Web Server version:
When I starting an ASP.NET Web Application with my Visual Studio.NET it told
me
"Visual Studio .NET has detected that the specified Web server is not
running ASP.NET version 1.1. You will be unable to run ASP.NET Web
Applications or services" and it does not start the project.
Has anyone encountered that before?
Appreciate any input.
Thanks,
Lev Tag: Re: Unable to remove remembered drives Tag: 162837
Convert Long array to Byte array
Hi,
Anyone know an efficient way to convert a long array to a byte array. Of
course you can do this by masking and dividing by 256 four times for each
long element, but is there anything built into VB to accomplish this faster?
Dave Tag: Re: Unable to remove remembered drives Tag: 162827
ADSI/ASP: How to pass distinguishedName as hidden form field?
[FOLLOW-UPS TO microsoft.public.scripting.vbscript]
Hi All,
I'm running into issues with passing the distinguishedName of a user as a
hidden form field in a form from one page to the result page.
Page 1: User enters user name in a form field
Page 2: Queries AD, gets distinguishedName, binds to the user.
Need to add more info to the user if attributes not present.
Relevant portion of FORM:
Response.Write("<B>ID: " & objUser.ID & "<Font color='Red'>not entered!
</font></B>" & _
"<FORM NAME='Form_Addid' ACTION='addid.asp' METHOD='post'>" & _
"<INPUT TYPE='text' NAME='inputId' SIZE=5 MAXLENGTH=6><br>" & _
"<INPUT TYPE='hidden' NAME='Username' value=" & objUser.sAMAccountName &
">" & _
"<INPUT TYPE='hidden' NAME='UserDN' value=" & objUser.distinguishedName &
">" & _
"<INPUT TYPE='submit' NAME='Submit_id' value='Add ID'></FORM>")
Page 3: Process form from prevoius page, populate attributes for the same
user.
Relevant portions of ASP code to get user's details from previous page.
<%
strUsername=Request.Form("Username")
strUserDN = Request.Form("UserDN")
Response.Write("Username: " & strUsername)
Response.Write("Distinguished Name" " & strUserDN)
%>
Questions:
i) Can the user bind on Page 2 be carried over to page 3 so there's no need
to search and bind to the user again?
ii) If not, can the distinguishedName be passed on to Page 3 (like I'm
trying to do) to eliminate the search portion and simply bind to the
distinguishedName?
When I try to pass the distinguishedName to Page 3 as a hidden form field,
and display the field using Response.Write - I only get a partial
distinguishedName - just the CN portion.
sAMAccountName seems to be passing without any issues (but then I'd need to
search and bind again based on that).
Thanks,
Bharat Suneja Tag: Re: Unable to remove remembered drives Tag: 162825
Displaying computer OU in ASP
I'm trying to display the OU (or the full ADSPath) in ASP using the
following code:
<%
Set con = CreateObject("ADODB.Connection")
con.Provider = "ADsDSOObject"
con.Open "Active Directory Provider"
Set ocommand = CreateObject("ADODB.Command")
ocommand.ActiveConnection = con
ocommand.CommandText =
"<LDAP://DC=MY,DC=DOMAIN>;(name=MYCOMPUTERNAME);adspath;subTree"
Set RS = ocommand.Execute
While not RS.EOF
Response.write RS.fields(0)
RS.MoveNext
Wend
%>
The script works, but it returns:
LDAP://DC=mycomputername,DC=my.domain,CN=MicrosoftDNS,CN=System,DC=my,DC
=domain
As you can see, there is no OU information listed. I've tried several
different methods of returning the ADSPath and I always get the above
output. The same script works perfectly as a VBScript.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! Tag: Re: Unable to remove remembered drives Tag: 162824
Reverse nslookup from file
I'm new to this, so I'm having a hard time with it. I need to have a VB
script read from a text file of IP addresses, and return their name (through
nslookup or other) and put it in another file. How do I do the iterations
and get nslookup in a VB script?
Any help would be appreciated.
Thank you,
KB Tag: Re: Unable to remove remembered drives Tag: 162819
FTP Upload
Hi
I have a problem with a script I wrote in VBS. I am trying to upload a file
through FTP to a server! I made follwing script but the script always hung!
Here is the script:
dim url,rdir,user,pass,fname
url="ftp://server.ch/"
rdir=""
fname="Stelle.xls"
user="User"
pass="Pass"
call Fdf(url,rdir,user,pass,fname)
Sub Fdf(url,rdir,user,pass,fname)
dim fso, ftpo
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
Set ftpo = WScript.CreateObject("InetCtls.Inet.1")
ftpo.URL = url
ftpo.UserName = user
ftpo.Password = pass
ftpo.Execute , "CD " & rdir
Do
WScript.Sleep 100
Loop while ftpo.StillExecuting
ftpo.Execute , "Put C:\" & fname& " " & fname
Do
WScript.Sleep 100
Loop while ftpo.StillExecuting
ftpo.Execute , "Close"
End Sub
The script always hung! Can someone help me with ftp-upload? Thanks alot
Nijazi Halimaji Tag: Re: Unable to remove remembered drives Tag: 162818
How to filter files based on format?
Hi,
How to filter files based on format?
In my log folder I want to select file names starts with C*.log. How to get
that?
Thanks
GTS Tag: Re: Unable to remove remembered drives Tag: 162816
WMI MSCluster_ClusterToQuorumResource
Is there a way to find out which node (server) in a cluster has (owns / is
running) the QuorumResource (Q: Drive) using WMI? The reason I ask is that I
would like to shut down the server (node) that has the QuorumResource last.
Words of wisdom wanted.
Scott Tag: Re: Unable to remove remembered drives Tag: 162814
Pause x seconds or until keypress
I'm looking for a way in a stand-alone vbscript, that will be run with
CScript, to pause for a certain amount of time OR until it is
interrupted with a keypress. When the pause is interrupted, it should
skip the remainder of the wait time and continue.
In old Basic there was something called INKEY$ that did this in a
loop. I'm looking for something similar for VBScript.
Your help is sincerely appreciated.
Eric Brander Tag: Re: Unable to remove remembered drives Tag: 162812
Unable to remove remembered drives
I've setup a VBScript that looks for an unused drive
letter and maps it to another server to allow me to
transfer some files.
The script is completely finished and works perfectly if I
double click on the .VBS file myself and run it. However
when I started the file from the scheduler (using the same
account and password that I used to logon to the server)
its all goes pear shaped.
When I started the script from the scheduler by right
clicking the task and selecting Run it hung. So I right
clicked again and terminated it. I then tried it again a
few more times with a few adjustments to the script.
It turned out that it couldn't map the drive for some
reason and was hanging. The error message was:
"An attempt was made to remember a device that had
previously been remembered"
It seems that while I was debugging my script I was
somehow mapping each free drive that was found (although
you cant see the mapping in My Computer). And it now
appears I cant remove these remembered drives, or map them
again... But only when the script is run from Task
Scheduler.
I've written a function to see whats mapped (see
viewMappings below), and this is what it showed:
d: = True as Data
e: = True as mapped_by_script
f: = True as mapped_by_script
g: = True as mapped_by_script
h: = True as mapped_by_script
i: = True as iApps
j: = True as mapped_by_script
k: = True as mapped_by_script
l: = True as Logs
m: = False
n: = False
o: = True as BACKUP
p: = False
q: = False
r: = False
s: = False
t: = False
u: = False
v: = False
w: = False
x: = False
y: = False
z: = True
All the drive marked as 'mapped_by_script' above have been
mapped by the script when it ran from Task Scheduler.
Looking on the net I've found some code that should remove
these drives, ie:
WshNetwork.RemoveNetworkDrive "E:", False,True
However if I try this with E: I get this error-
This network connection does not exist.
But this cant be True because if I try and map E: I get
this error-
The local device name is already in use.
What on earth is going on here? If I run the script
manually again (not from scheduler), it runs perfectly
again. And will even map drive E: if I tell it too.
Can anyone help? I've been looking at this all day and I
just cannot find a solution, and I dont know what to try
next!
TIA,
Colin
Function getNextFreeDrive()
Dim fso
Dim i
Set fso = Createobject("Scripting.FileSystemObject")
For i = Asc("d") To Asc("z")
If Not fso.driveexists(chr(i)) Then
freeDrive = Ucase(chr(i)) & ":"
Exit For
End If
Next
Set fso = Nothing
Set i = Nothing
End Function
Sub mapDrive()
On Error Resume Next
Dim WshNetwork
Set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.MapNetworkDrive freeDrive, ExportFolder
Set WshNetwork = Nothing
End Sub
Function viewMappings()
On Error Resume Next
Dim fso
Dim i
Dim driveListing
Set fso = Createobject("Scripting.FileSystemObject")
For i = Asc("d") To Asc("z")
driveListing = driveListing & Chr(i) & ": = " & _
fso.driveexists(chr(i))
If fso.driveexists(chr(i)) Then
driveListing = driveListing & " as " & _
fso.Drives(chr(i)).VolumeName
End If
driveListing = driveListing & vbcr
Next
SendCDOMail emailTo, emailFrom, "DRIVE LISTING",
driveListing
Set fso = Nothing
Set i = Nothing
End Function Tag: Re: Unable to remove remembered drives Tag: 162810
How to goto a particular line of a opened file
Hi,
How to goto a particualr line of a opened text file in vbscript ?
Thanks
GTS
--
<a href="www.arivial.net">www.arivial.net</a> Tag: Re: Unable to remove remembered drives Tag: 162806
File processing Open, Seek
Hi,
How to process a file using OPEN and SEEK?
I want to open a file in VBScript for processing. I could not found a
function simlar to seek in the file system object.
Is it possible to use the OPEN statement and seek statement in VBScript.
Thanks
GTS Tag: Re: Unable to remove remembered drives Tag: 162804
how to populate a multidimentional array in vbscript
Hi,
I'm back to a vbscript asp project after a couple of years doing php. I
used to be pretty good at vbscript, but i'm rusty.
I have a spreadsheet that figures shipping costs. the rows are weight
values. The columns are zones. The data is the cost to ship.
weight, z1, z2, etc.
1, 5, 8
2, 8, 10
etc.
I can't find any examples of how to actually populate the arrays in the
code. Everyone wants to put dynamic data into arrays, but I have all my
data, and I don't mind typing it all into the code.
help?
thanks
--
Joel Goldstick Tag: Re: Unable to remove remembered drives Tag: 162794
Nebbie question
I have an vbscript that I am trying to get the value (text) from a <select>
tag which has a number of enbeded <option> tags of course. I can't get the
selected text. My code is below. I am able to get the selected index. I
have searched all though the msdn site for some examples but can't find
anything.
Any help would be appreciated.
<script language="vbscript">
Sub btnGroup_OnClick()
dim strGroup
dim seletedGroup
selectedGroup = frmConfEdit.GroupID.selectedIndex
'alert selectedGroup
strGroup = frmConfEdit.GroupID.value
alert strGroup
end sub
</script>
<select name="GroupID" class="FormCell" id="GroupID" style="width:200"
onChange="UpdateList()">
<% if cint(rs.fields("GROUP_ID").value) > 0 then
response.Write(DBOptionList("SELECT ID,GROUP_ID FROM GROUPS ORDER BY
GROUP_ID","GROUP_ID","ID",rs.fields("GROUP_ID").value))
else
response.write(DBOptionList("SELECT ID,GROUP_ID FROM GROUPS ORDER BY
GROUP_ID","GROUP_ID","ID",SESSION("USER_GROUP_ID")))
end if%>
</select> Tag: Re: Unable to remove remembered drives Tag: 162793
Calling Scripts From Script
I run a bunch of scripts on my server. Each is scheduled individually with
the sceduling service.
I'm thinking of writing one script that calls each script in turn. That
way, I will only have one entry in scheduler.
Is this possible? Tag: Re: Unable to remove remembered drives Tag: 162791
Syntax Error ???
Hi All,
I've written a function in VBScript that runs as part of a web
application in IE. But, IE keeps telling me there's a syntax error.
But for the life of me I don't see it. I've marked the line
accordingly. Any help would be appreciated.
TIA.
Function EAAFOnSubmit( strAction )
addNew = 0
document.myForm.all("SALUTATION_ID").value =
document.SALUTATION_IDFrame.SALUTATION_ID.value
document.myForm.all("PRSN_TYP_CD").value =
document.PRSN_TYP_CDFrame.PRSN_TYP_CD.value
document.myForm.all("ARL_TITLE_ID").value =
document.ARL_TITLE_IDFrame.ARL_TITLE_ID.value
document.myForm.all("RANK_ID").value =
document.RANK_IDFrame.RANK_ID.value
document.myForm.all("myFormSubmitted").value = strAction
If StrComp( strAction, "Close", VBTextCompare ) <> 0 Then
If not EAAFValidate( strAction ) Then
Exit Function
End If
End If
If StrComp( strAction, "Update Record", VBTextCompare ) = 0 OR
StrComp( strAction, "Update and Close", VBTextCompare ) = 0 OR
StrComp( strAction, "Add New Record", VBTextCompare ) = 0 Then
document.myForm.submit
Exit Function
End If <<< ERROR IS HERE SUPPOSEDLY
If StrComp( strAction, "Close", VBTextCompare ) = 0 AND addNew = 1
Then
opener.document.location = document.myForm.all("capturedURL") &
"&onAddEmployee=CLOSEDELETE_" & document.myForm.all( "titleID" ).value
Else
opener.document.location = document.myForm.all("capturedURL") &
"&onAddEmployee=" & document.myForm.all( "titleID" ).value
End If
window.close
End Function Tag: Re: Unable to remove remembered drives Tag: 162782
Forwarding O.E.
How can I forward an email message without adding any header or initial
character (i.e. > sign) in the body text?
Thanks
Sandrobi Tag: Re: Unable to remove remembered drives Tag: 162781
Vbs: How To Read Variables From An external File?
hello
unfortunately i dont code in VBS nor any language from Microsoft, im
PHP , Perl programer, i know its verey easy to learn VBS, but i don
have much time to learn VBS, i manged to get a VBS code that execut
extrnel commands.
using this code i can code my scripts in PHP and run them from this VB
code (im forced to use VBS)
but the proplem is: i want the outpout that was created by PHP to b
available to VBS.
Example:
VBScript: test.vbs :
Code
-------------------
Option Explicit
Dim Command
Command = RunOutput( "%comspec% /C D:\bin\php\php.exe -f F:\DeskTop\test.php", 0)
MsgBox Command
'---------------------------------------------------------------------
'-- RunOutput Function ------------------------------------
'---------------------------------------------------------------------
Function RunOutput( cProgram, nWindowType )
'-- Obtain a Temporary File Name
Dim oFS
Set oFS = CreateObject("Scripting.FileSystemObject")
Dim cFile
cFile = oFS.GetSpecialFolder(2).Path & "\" & oFS.GetTempName
'-- Execute the command and redirect the output to the file
Dim oShell
Set oShell = CreateObject( "WScript.Shell" )
oShell.Run cProgram & " >" & cFile, nWindowType, True
Set oShell = Nothing
'-- Read output file and return
Dim oFile
Set oFile = oFS.OpenTextFile(cFile, 1, True)
RunOutput = oFile.ReadAll()
oFile.Close
'-- Delete Temporary File
oFS.DeleteFile cFile
Set oFS = Nothing
End Function
-------------------
PHPScript: test.php :
PHP code
-------------------
<?
$today = date("D M j G:i:s Y");
$Sec = md5("$today");
echo "
Dim today
today = \"$today\"
Dim Sec
Sec = \"$Sec\"
";
?>
-------------------
now when i run the file *test.vbs* i get this Msg Box:
[image: http://www.remal.com.sa/images/misc/VocieGuide_PHP_VBS.jpg]
what i want is to be able to access the two variables that was returne
by PHP "today and Sec" from the VBS script
-
Sale
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
----------------------------------------------------------------------- Tag: Re: Unable to remove remembered drives Tag: 162780
Net Share and VBScript
Hi all, this is my first time posting.
I've been away from VB programing for such a long time I seem to be
dumfounded when it comes to doing the easiest things.
Here's the situation:
Windows 2003 server and domain
I have loads of home directories on my school server.
With windows 9X's limitation of mapping to a share only the simple
thing to do is make a share out of the home directory. - (simple if
you like to right click a lot).
Rights are already assigned to the home folder when it was created.
I have a text file from Active Directory with the users name which
matches the users home folder (already created).
I would like to use this text file as a input file with a VBScript.
While in the Do loop I would like it to...
use the net share command to share the home folder as username + $ so
that all the shares are hidden (keeps it very clean this way)
That's it!
Very simple for the right person, which I am not.
Any help would be greatly appreaciated.
Michael Tag: Re: Unable to remove remembered drives Tag: 162777
Rename a computer and computer accout
Hi,
I'm having problem to rename all the PCs in company.
I found the sample script here
http://www.microsoft.com/technet/community/scriptcenter/compmgmt/scrcm36.mspx
but it works only on XP or 2003.
My clients are running on 2K Pro on 2K Domain.
Please help me, give sample on how to write the script, i totally have no
idea, plsssssss.
Thanks in Advance...JJ Tag: Re: Unable to remove remembered drives Tag: 162776
add user to group
Got this code to create user & add it to group. In the last part of
adding the user to a group I have a syntax problem. I want each
UserNo i created in the loop be added to a security group. cannot seem
to find the rihgt syntax.
please help.
TIA,
Ronen
Const ADS_PROPERTY_APPEND = 3
Set objRootDSE = GetObject("LDAP://rootDSE")
Set objContainer = GetObject("LDAP://OU=test,OU=Misc,OU=TAU," & _
objRootDSE.Get("defaultNamingContext"))
Set objGroup = GetObject _
("LDAP://CN=cn=Terminal Server User,OU=test,OU=Misc,OU=TAU")
For i = 1 To 5
Set objLeaf = objContainer.Create("User", "cn=UserNo" & i)
objLeaf.Put "sAMAccountName", "UserNo" & i
objLeaf.Put "userPrincipalName", "UserNo" & i
objLeaf.Put "givenName", "UserNo" & i
objLeaf.Put "displayName", "UserNo" & i
objLeaf.SetInfo
objLeaf.SetPassword "111111"
objLeaf.AccountDisabled = False
objLeaf.SetInfo
objGroup.PutEx ADS_PROPERTY_APPEND, _
"member", Array("cn=UserNo" & i "objContainer" )
objGroup.SetInfo
Next
WScript.Echo "5 Users created." Tag: Re: Unable to remove remembered drives Tag: 162773
How to write the WMI Asset Tag
Hi there!
the code snippet
---
strComputerName = "."
strWinMgt = "winmgmts://" & strComputerName & ""
Set compsysset = GetObject(strWinMgt).ExecQuery("select * from
Win32_SystemEnclosure")
For Each CompSys In compsysset
MsgBox CompSys.SMBIOSAssetTag
Next
---
gives me the WMI Asset Tag.
Is there a way to (over)write this value? As far as I see it is built in in
the computer by the manufacturer, but I would like to use it to store the
Asset Number of the PC from our Asset Management Database... Tag: Re: Unable to remove remembered drives Tag: 162771
Clearing cookies reloading?
Hi,
i am not into scripting at all, but i know VBA ok.
I' am trying to vote for my band on this web site:
http://www.bbc.co.uk/northamptonshire/content/articles/2004/08/04/weekender_chart_vote_feature.shtml
(the structure) -www.thestructure.co.uk!
each time i vote it set a cookie, and will not allow you to vote
agian.
what i need to do is write a script that will clear out my cookies,
relead the webpage.
If it could also vote aswell then theat would be ace, if this can be
done then i guess it can be looped.
Can this type of thing be done - anyone got some code of web ref
Many thanks,
Ross. Tag: Re: Unable to remove remembered drives Tag: 162769
ADO Reference
Hi everybody,
Maybe thats not the right newsgroup, but i need a complete reference of ADO.
Where do i find this?
Thanks Tag: Re: Unable to remove remembered drives Tag: 162758
a string within a string
Hi,
I need to use bcp, a command line utility installed with sqlserver, from my
script.
if I issue the following command at the command prompt it works:
bcp "SELECT * FROM pubs..authors" queryout c:\Authors.txt -c -T.
Note that the sql statment is quated.
I tried to use bcp in the same way as I do with other command lines programs
such as:
oShell.Run "cmd /C IPconfig/all > ........" I fell to do so as I do not
know how to address the fact that the sql statment is a string and the
entire parameter passed to the Run method is also a string so there is
actually a string inside a string.
Thanks,
Yaniv Tag: Re: Unable to remove remembered drives Tag: 162757
Scripting DSMOVE DSQUERY and DSMOD help! (EASY?)
Hi all,
Im trying to create a batch file/vbs or whatever script that allows me to
run these commands.
Objective of script:
To search the whole Active Directory for objects that are duplicated (search
condition $DUPLICATES*), mark them as disabled and move them to an OU.
If i put these following commands into command prompt one by one it works,
but not when i put it into .cmd or .bat (due to the for loop and the
variables)
for /F "usebackq delims=""" %i in (`dsquery * domainroot -filter
"(&(objectCategory=*)(objectClass=*) (sAMAccountName=$DUPLICATE*))"`) do
dsmod user %i -disabled yes
for /F "usebackq delims=""" %i in (`dsquery * domainroot -filter
"(&(objectCategory=*)(objectClass=*) (sAMAccountName=$DUPLICATE*))"`) do
dsmove %i -newparent ou=scheduled,dc=YOURDOMAIN,dc=com
if I use the default piping for dsquery and dsmod it works fine however if i
use dsquery piping with DSMOVE (if there are more than 1 objects to be
moved) it failed! (crap)
dsquery * domainroot -filter "(&(objectCategory=*)(objectClass=*)
(sAMAccountName=$DUPLICATE*))" | dsmod user -disabled yes
dsquery * domainroot -filter "(&(objectCategory=*)(objectClass=*)
(sAMAccountName=$DUPLICATE*))" | dsmove -newparent
ou=scheduled,dc=YOURDOMAIN,dc=com
Anyone kind enough to mod this? :)
Cheers!
Kind Regards,
Freddy Hartono Tag: Re: Unable to remove remembered drives Tag: 162750
Loading an image within an asp page
I have had a lot of trouble with this, and I was wondering if anyone
had any ideas as to where I am going wrong.
My asp is a simple image viewer, it lists all the photos in the
directory, (1 for each astff member), has the facility to search, and
when you click on the link corresponding to the staff member it should
load the image in that page. Here are the code snips of what I have so
far:
**** Code Removed for viewing ******
<form method="GET" name="SearchPicture" action="default.asp">
<p style="margin-left: 0in; margin-right: 0in; margin-top: 0in;
margin-bottom: .0001pt">
<input type="text" name="SearchString"
value="<%=Request("SearchString")%>" size="45%">
<input type="image" name="staffImage" style="visibility: hidden;
display: none" src="" border="0" align="right" width="32%"
height="32%"></p>
<p style="margin-left: 0in; margin-right: 0in; margin-top: 0in;
margin-bottom: .0001pt">
<input type="submit" value="Search" name="B1">
<input type="submit" value="List All Staff"
onclick="SearchString.value='';" name="B2">
<input type="button" value="Clear" onclick="SearchString.value='';"
name="B3"></p><!--webbot bot="SaveAsASP" CLIENTSIDE SuggestedExt="asp"
PREVIEW=" " startspan --><!--webbot bot="SaveAsASP" endspan -->
</form>
<%
Dim strPath 'Path of directory to show
Dim objFSO 'FileSystemObject variable
Dim objFolder 'Folder variable
Dim objItem 'Variable used to loop through the contents of the
folder
strPath = "../Photos/"
set objFSO = server.CreateObject("Scripting.FileSystemObject")
' Get a handle on our folder
Set objFolder = objFSO.GetFolder(Server.MapPath(strPath))
' Loop through the files!
For Each objItem In objFolder.Files
my_ex = objFSO.GetExtensionName(objItem)
my_name = objFSO.GetFileName(objItem)
If InStr(1, my_ex, "JPEG", 1) = 1 or InStr(1, my_ex, "jpg",1) = 1
Then
If InStr(1, my_name, Request("SearchString"), 1) > 0 Then
%>
<tr><TD vallign="left" width="30%" ><A href=""
onclick="ShowImage('my_name & my_ex')" ><%= left(my_name,len(my_name)
- len(my_ex) - 1) %></A></TD></tr>
<%
End If
End If
Next 'objItem
Sub ShowImage(fileName)
staffImage.src='strPath & fileName'
staffImage.style.visibility='visible'
End Sub
' All done! Kill off our object variables.
Set objItem = Nothing
Set objFolder = Nothing
Set objFSO = Nothing
Set my_name = Nothing
Set my_ex = Nothing
%>
</td>
</tr>
</table>
</div>
</p>
</body>
</html>
The problems appear to be with the ShowImage() sub, (passing variables
into it, as well as displaying the image. Thanks for any help you can
offer Tag: Re: Unable to remove remembered drives Tag: 162747
vb script to join domain
I am trying to write a script that will open the computer name changes
window in the system control panel. A friend gave the following:
Option Explicit
Dim oWS
Set oWS = WScript.CreateObject("WScript.Shell")
WScript.Sleep 5500
'Bring up the System Properties window
oWS.run "rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,1"
WScript.Sleep 1000
'Bring up the computer name changes window
oWS.SendKeys "%c"
WScript.Sleep 1000
oWS.SendKeys "%d"
WScript.Sleep 1000
oWS.SendKeys "{Tab}"
WScript.Sleep 500
oWS.SendKeys "test.local"
WScript.Sleep 500
oWS.SendKeys "{ENTER}"
Set oWS = nothing
The problem is the system properties window loses focus and the rest of the
commands don't register. Is there a way to directly bring up the computer
name changes window? Or is there a way to make the System Properties window
the focus?
Thanks,
Jason Tag: Re: Unable to remove remembered drives Tag: 162744
script to determine display mode
Is there a way for a script to determine whether or not the video
display is in clone mode? Tag: Re: Unable to remove remembered drives Tag: 162743
Changing IE Proxy Settings
Hi
Can anyone give me a sample script to change IE proxy settings from one IP
address to another which will apply to all users in XP and Win2k?
Gordon Tag: Re: Unable to remove remembered drives Tag: 162740
Unintentional ascii 0 (nulls) when creating file with FSO?
I'm creating files on an IIS 5.0 web server, and when I create files with
the FileSystemObject, it creates files that have ASCII 0's as every other
character.
For example, if I TextStream.Write("Hello"), the resulting file has:
(gibberish) H (null) e (null) l (null) l (null) o (null)
In a text editor, the output looks fine, like "Hello".
In a hex editor, the file looks like this:
FF FE 48 00 65 00 6C 00 6C 00 6F 00
Anyone have an idea what's going on? It's driving me nuts... I'm not sure
where the "FF FE" comes from either.
Thanks,
Dan
www.dantan.net Tag: Re: Unable to remove remembered drives Tag: 162739
Its a common error but...
Who are you running the scheduled task as?
Does the account have rights to the network resource?