From: Robby on 21 Jun 2010 06:32 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 21 Jun 2010 07:23 "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 21 Jun 2010 08:55 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 21 Jun 2010 09:27 "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 21 Jun 2010 10:47 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. >> > >
|
Next
|
Last
Pages: 1 2 Prev: Server Check Health Script Needed Next: vbscript to get photos from ldap provider |