Joshua
Mon Sep 13 13:13:31 CDT 2004
When I use the new code I get,
http://small\image.jpg instead of
http://small/image.jgp
Any ideas why, here is my NEW code with your changes, again 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") = Replace(objFile.Name, "c:\", "
http://", 1, -1,
vbTextCompare)
objRecordset.Update
Next
objRecordset.Close
objConnection.Close
"Joshua C. Clark" <Josh@NetworkMedics.Com> wrote in message
news:ePkRN$amEHA.828@TK2MSFTNGP10.phx.gbl...
> Thats it, works beutifully, thank you!
>
>
> "Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
> news:%23iNW0vamEHA.1904@TK2MSFTNGP09.phx.gbl...
> > Joshua C. Clark wrote:
> >
> > > 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
> > Hi
> >
> > Replace the line above with this and see if it gives you what you want:
> >
> > objRecordset("Filename") = _
> > Replace(objFile.Name, "c:\", "
http://", 1, -1, vbTextCompare)
> >
> >
> > --
> > torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> > Administration scripting examples and an ONLINE version of
> > the 1328 page Scripting Guide:
> >
http://www.microsoft.com/technet/scriptcenter/default.mspx
>
>