Prev: BUY FAKE PASSPORTS OF CANADA,FAKE CANADIAN PASSPORTS FOR SALE! FAK
Next: Specify open file with Excel 2007
From: Tom Lavedas on 25 May 2010 14:05 On May 25, 1:14 pm, Sear S <Se...(a)discussions.microsoft.com> wrote: > Hi Tom, > > Thanks, however 2 questions about sdestination and slogpath > Is Sdestination as target machine (s) destination path? I'm not certain what you mean be the word 'target', so I'll just try expanding on my intention. It is the place where you want the log file(s) to be copied TO. That is the destination for the copied files. > Is sLogname path the path from where the log file that needs to be copied > from? Not quite. It is the name of the log file to be copied (the destination name is the same, except prefaced with the name of the server it came from), but the actual source PATH is contained in sLogPath (built from the server's name and the sharepoint name). Finally, realize that I meant this as an example from which you could craft your final solution. It may or may not suit your needs as written. I don't have a comprehensive understanding of what your environment is or of what you want to accomplish, exactly. HTH, _____________________ Tom Lavedas
From: Sear S on 27 May 2010 15:57 Hi Tom, Ok let me explain in details what I exactly want to accomplish: I need a script that I can use to gather a log file from a number of workstations...in total 40 workstations The log file is located on C:\logfilename of each one of those workstations... I have full admin access to those PCs therefore permissions won't be an issue! Once I ran the script, I would like it to copy all those log files from those machines and put them somewhere on a shared drive for me... I hope that clarifies a little bit my point Thanks Sam .. "Tom Lavedas" wrote: > On May 25, 1:14 pm, Sear S <Se...(a)discussions.microsoft.com> wrote: > > Hi Tom, > > > > Thanks, however 2 questions about sdestination and slogpath > > Is Sdestination as target machine (s) destination path? > > I'm not certain what you mean be the word 'target', so I'll just try > expanding on my intention. > > It is the place where you want the log file(s) to be copied TO. That > is the destination for the copied files. > > > Is sLogname path the path from where the log file that needs to be copied > > from? > > Not quite. It is the name of the log file to be copied (the > destination name is the same, except prefaced with the name of the > server it came from), but the actual source PATH is contained in > sLogPath (built from the server's name and the sharepoint name). > > Finally, realize that I meant this as an example from which you could > craft your final solution. It may or may not suit your needs as > written. I don't have a comprehensive understanding of what your > environment is or of what you want to accomplish, exactly. > > HTH, > _____________________ > Tom Lavedas > . >
From: Tom Lavedas on 27 May 2010 17:00 On May 27, 3:57 pm, Sear S <Se...(a)discussions.microsoft.com> wrote: > Hi Tom, > > Ok let me explain in details what I exactly want to accomplish: > > I need a script that I can use to gather a log file from a number of > workstations...in total 40 workstations > The log file is located on C:\logfilename of each one of those workstations... > I have full admin access to those PCs therefore permissions won't be an issue! > Once I ran the script, I would like it to copy all those log files from > those machines and put them somewhere on a shared drive for me... > I hope that clarifies a little bit my point > > Thanks > > Sam OK, from what you said, you just need to change the value of sLogName to be "logfilename" and the sDestination content to be "\ \Storageservername\locationfoldername\" and complete the list of server names. sServerNames = "server1,server2,server3,etc" sLogName = "logfilename" sDestination = "\\Storageservername\locationfoldername\" with createobject("scripting.filesystemobject") for each server in split(sServerNames, ",") sLogPath = "\\" & server & "\C$\" & sLogName if .fileExists(sLogPath) then .copyfile slogpath, sDestination & server & sLogName end if next end with Of course, 40 server names would be a problem in the SET statement, so a file list (one name per line) would be better, something like this ... sServerNameFile = "c:\some\local\folder\Servernames.txt" sLogName = "logfilename" sDestination = "\\Storageservername\locationfoldername\" with createobject("scripting.filesystemobject") sServerNames = .OpenTextFile(sServerNameFile, 1).ReadAll for each server in split(sServerNames, vbNewLine) sLogPath = "\\" & server & "\C$\" & sLogName if .fileExists(sLogPath) then .copyfile slogpath, sDestination & server & "_" & sLogName end if next end with It should create one file for each server in the specified location. _____________________ Tom Lavedas
From: Sear S on 28 May 2010 10:30 HI Tom, A BIG THANK YOu this works perfectly!! If the file name on some servers is different than the one mentioned in the Slogname section then can I add more file names as below? sServerNameFile = "c:\some\local\folder\Servernames.txt" > sLogName = "logfilename,logfilename2, etc..." > sDestination = "\\Storageservername\locationfoldername\" > with createobject("scripting.filesystemobject") > sServerNames = .OpenTextFile(sServerNameFile, 1).ReadAll > for each server in split(sServerNames, vbNewLine) > sLogPath = "\\" & server & "\C$\" & sLogName > if .fileExists(sLogPath) then > .copyfile slogpath, sDestination & server & "_" & sLogName > end if > next > end with "Tom Lavedas" wrote: > On May 27, 3:57 pm, Sear S <Se...(a)discussions.microsoft.com> wrote: > > Hi Tom, > > > > Ok let me explain in details what I exactly want to accomplish: > > > > I need a script that I can use to gather a log file from a number of > > workstations...in total 40 workstations > > The log file is located on C:\logfilename of each one of those workstations... > > I have full admin access to those PCs therefore permissions won't be an issue! > > Once I ran the script, I would like it to copy all those log files from > > those machines and put them somewhere on a shared drive for me... > > I hope that clarifies a little bit my point > > > > Thanks > > > > Sam > > OK, from what you said, you just need to change the value of sLogName > to be "logfilename" and the sDestination content to be "\ > \Storageservername\locationfoldername\" and complete the list of > server names. > > sServerNames = "server1,server2,server3,etc" > sLogName = "logfilename" > sDestination = "\\Storageservername\locationfoldername\" > with createobject("scripting.filesystemobject") > for each server in split(sServerNames, ",") > sLogPath = "\\" & server & "\C$\" & sLogName > if .fileExists(sLogPath) then > .copyfile slogpath, sDestination & server & sLogName > end if > next > end with > > Of course, 40 server names would be a problem in the SET statement, so > a file list (one name per line) would be better, something like > this ... > > sServerNameFile = "c:\some\local\folder\Servernames.txt" > sLogName = "logfilename" > sDestination = "\\Storageservername\locationfoldername\" > with createobject("scripting.filesystemobject") > sServerNames = .OpenTextFile(sServerNameFile, 1).ReadAll > for each server in split(sServerNames, vbNewLine) > sLogPath = "\\" & server & "\C$\" & sLogName > if .fileExists(sLogPath) then > .copyfile slogpath, sDestination & server & "_" & sLogName > end if > next > end with > > It should create one file for each server in the specified location. > _____________________ > Tom Lavedas > . >
From: Tom Lavedas on 28 May 2010 11:03 On May 28, 10:30 am, Sear S <Se...(a)discussions.microsoft.com> wrote: > HI Tom, > > A BIG THANK YOu this works perfectly!! > If the file name on some servers is different than the one mentioned in the > Slogname section then can I add more file names as below? > > sServerNameFile = "c:\some\local\folder\Servernames.txt" > > > sLogName = "logfilename,logfilename2, etc..." > > sDestination = "\\Storageservername\locationfoldername\" > > with createobject("scripting.filesystemobject") > > sServerNames = .OpenTextFile(sServerNameFile, 1).ReadAll > > for each server in split(sServerNames, vbNewLine) > > sLogPath = "\\" & server & "\C$\" & sLogName > > if .fileExists(sLogPath) then > > .copyfile slogpath, sDestination & server & "_" & sLogName > > end if > > next > > end with > "Tom Lavedas" wrote: > > On May 27, 3:57 pm, Sear S <Se...(a)discussions.microsoft.com> wrote: > > > Hi Tom, > > > > Ok let me explain in details what I exactly want to accomplish: > > > > I need a script that I can use to gather a log file from a number of > > > workstations...in total 40 workstations > > > The log file is located on C:\logfilename of each one of those workstations... > > > I have full admin access to those PCs therefore permissions won't be an issue! > > > Once I ran the script, I would like it to copy all those log files from > > > those machines and put them somewhere on a shared drive for me... > > > I hope that clarifies a little bit my point > > > > Thanks > > > > Sam > > > OK, from what you said, you just need to change the value of sLogName > > to be "logfilename" and the sDestination content to be "\ > > \Storageservername\locationfoldername\" and complete the list of > > server names. > > > sServerNames = "server1,server2,server3,etc" > > sLogName = "logfilename" > > sDestination = "\\Storageservername\locationfoldername\" > > with createobject("scripting.filesystemobject") > > for each server in split(sServerNames, ",") > > sLogPath = "\\" & server & "\C$\" & sLogName > > if .fileExists(sLogPath) then > > .copyfile slogpath, sDestination & server & sLogName > > end if > > next > > end with > > > Of course, 40 server names would be a problem in the SET statement, so > > a file list (one name per line) would be better, something like > > this ... > > > sServerNameFile = "c:\some\local\folder\Servernames.txt" > > sLogName = "logfilename" > > sDestination = "\\Storageservername\locationfoldername\" > > with createobject("scripting.filesystemobject") > > sServerNames = .OpenTextFile(sServerNameFile, 1).ReadAll > > for each server in split(sServerNames, vbNewLine) > > sLogPath = "\\" & server & "\C$\" & sLogName > > if .fileExists(sLogPath) then > > .copyfile slogpath, sDestination & server & "_" & sLogName > > end if > > next > > end with > > > It should create one file for each server in the specified location. > > _____________________ > > Tom Lavedas > > . If there are just a few differences, that could be handled as Select Case in place of the simpler "IF .FileExists(...)" statement, something like this ... Select Case True case .fileExists(sLogPath1) .copyfile slogpath, sDestination & server & sLogName1 case .fileExists(sLogPath2) .copyfile slogpath, sDestination & server & sLogName2 case .fileExists(sLogPath3) .copyfile slogpath, sDestination & server & sLogName3 end if Of course, the three file name variables would need to be defined earlier in the script. If there are many different names, it might be easier to add them as part of the ServerNames text file, on lofgilename per server, as in ... server1, logfilename.log server2 anothername.txt server3 etc. To simplify things a bit, a blank for the name could be used to indicate the use of a default name. Then the code might look like this ... sServerNameFile = "c:\some\local\folder\Servernames.txt" sDefaultLogName = "logfilename" sDestination = "\\Storageservername\locationfoldername\" with createobject("scripting.filesystemobject") sServerNames = .OpenTextFile(sServerNameFile, 1).ReadAll for each sLine in split(sServerNames, vbNewLine) sLine = trim(sLine) if not (sLine) = "" then aTemp = split(sLine & " " & sDefaultLogName) server = aTemp(0) sLogName = aTemp(1) sLogPath = "\\" & server & "\C$\" & sLogName if .fileExists(sLogPath) then .copyfile slogpath, sDestination & server & "_" & sLogName end if end if next end with _____________________ Tom Lavedas
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: BUY FAKE PASSPORTS OF CANADA,FAKE CANADIAN PASSPORTS FOR SALE! FAK Next: Specify open file with Excel 2007 |