From: Robby on
Hi,
i would like to create script VBS, which search an file in remote computer.
This is my script, but doesn't work:
Set objFSO = CreateObject("Scripting.FileSystemObject")
strComputer = pcremote
if objFSO.FileExists("\\" & strComputer &"D:\H4PDF\toto2.txt") Then
MsgBox "Fichier toto OK", vbExclamation
Else
MsgBox "Fichier toto KO", vbExclamation
End If
Loop
Best Regards,
Robby


From: Pegasus [MVP] on


"Robby" <fabrice(a)discussions.microsoft.com> wrote in message
news:uh3ch0SELHA.5736(a)TK2MSFTNGP02.phx.gbl...
> Hi,
> i would like to create script VBS, which search an file in remote
> computer. This is my script, but doesn't work:
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> strComputer = pcremote
> if objFSO.FileExists("\\" & strComputer &"D:\H4PDF\toto2.txt") Then
> MsgBox "Fichier toto OK", vbExclamation
> Else
> MsgBox "Fichier toto KO", vbExclamation
> End If
> Loop
> Best Regards,
> Robby

Instead of writing
if objFSO.FileExists("\\" & strComputer &"D:\H4PDF\toto2.txt")
you need to write
if objFSO.FileExists("\\" & strComputer &"\D$\H4PDF\toto2.txt")

The code assumes that the administrative share D$ is enabled. If it is not
then you must enable it or else create your own share that points to D:\ at
the remotre machine.

From: Robby on
Thank for your reply,
But i have changed D: with D$ and it doesn't work because
i had msgbox "toto KO" which open, then that my file "toto2.txt" exists
well.
with the net share is ok, i tried to set on my C$, but it is same problem.

"Pegasus [MVP]" <news(a)microsoft.com> a �crit dans le message de news:
uS84sQTELHA.3732(a)TK2MSFTNGP02.phx.gbl...
>
>
> "Robby" <fabrice(a)discussions.microsoft.com> wrote in message
> news:uh3ch0SELHA.5736(a)TK2MSFTNGP02.phx.gbl...
>> Hi,
>> i would like to create script VBS, which search an file in remote
>> computer. This is my script, but doesn't work:
>> Set objFSO = CreateObject("Scripting.FileSystemObject")
>> strComputer = pcremote
>> if objFSO.FileExists("\\" & strComputer &"D:\H4PDF\toto2.txt") Then
>> MsgBox "Fichier toto OK", vbExclamation
>> Else
>> MsgBox "Fichier toto KO", vbExclamation
>> End If
>> Loop
>> Best Regards,
>> Robby
>
> Instead of writing
> if objFSO.FileExists("\\" & strComputer &"D:\H4PDF\toto2.txt")
> you need to write
> if objFSO.FileExists("\\" & strComputer &"\D$\H4PDF\toto2.txt")
>
> The code assumes that the administrative share D$ is enabled. If it is not
> then you must enable it or else create your own share that points to D:\
> at the remotre machine.
>


From: James Whitlow on
"Robby" <fabrice(a)discussions.microsoft.com> wrote in message
news:eNhlUEUELHA.1316(a)TK2MSFTNGP02.phx.gbl...
> Thank for your reply,
> But i have changed D: with D$ and it doesn't work because
> i had msgbox "toto KO" which open, then that my file "toto2.txt" exists
> well.
> with the net share is ok, i tried to set on my C$, but it is same problem.

Do you have administrative rights on the box you are querying? If you open
a command prompt and type:

dir \\pcremote\d$

....do you get a listing of files, an access denied error or a path not found
error?


From: Pegasus [MVP] on
When your script does not work then you must check your basic assumptions.
In this particular case you must find out if you have access to the
administrative shares from a Command Prompt. James Whitlow's reply shows you
how it is done. Only then can you attempt to do the same with scripts.

"Robby" <fabrice(a)discussions.microsoft.com> wrote in message
news:eNhlUEUELHA.1316(a)TK2MSFTNGP02.phx.gbl...
> Thank for your reply,
> But i have changed D: with D$ and it doesn't work because
> i had msgbox "toto KO" which open, then that my file "toto2.txt" exists
> well.
> with the net share is ok, i tried to set on my C$, but it is same problem.
>
> "Pegasus [MVP]" <news(a)microsoft.com> a �crit dans le message de news:
> uS84sQTELHA.3732(a)TK2MSFTNGP02.phx.gbl...
>>
>>
>> "Robby" <fabrice(a)discussions.microsoft.com> wrote in message
>> news:uh3ch0SELHA.5736(a)TK2MSFTNGP02.phx.gbl...
>>> Hi,
>>> i would like to create script VBS, which search an file in remote
>>> computer. This is my script, but doesn't work:
>>> Set objFSO = CreateObject("Scripting.FileSystemObject")
>>> strComputer = pcremote
>>> if objFSO.FileExists("\\" & strComputer &"D:\H4PDF\toto2.txt") Then
>>> MsgBox "Fichier toto OK", vbExclamation
>>> Else
>>> MsgBox "Fichier toto KO", vbExclamation
>>> End If
>>> Loop
>>> Best Regards,
>>> Robby
>>
>> Instead of writing
>> if objFSO.FileExists("\\" & strComputer &"D:\H4PDF\toto2.txt")
>> you need to write
>> if objFSO.FileExists("\\" & strComputer &"\D$\H4PDF\toto2.txt")
>>
>> The code assumes that the administrative share D$ is enabled. If it is
>> not then you must enable it or else create your own share that points to
>> D:\ at the remotre machine.
>>
>
>