Login | |
|
 |
Re: Using variables to copy files - 4/8/2005 5:25:50 AM
|
|
 |
|
| |
mbouchard
Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
|
Would need a little bit more info first, but from what I can see, I would say no, it isn't. First, what do you anticipate getting from the inputbox? Second, you have extra " that are not needed, for instance, on each line you start with (""\\"..., you only need 1 set of " i.e. ("\\"... and you do not need the ending quote. Now to get the line encapsultated in quotes you can do a couple things, what I normally do is this, ("""" & "\\" & ..... & """") Third, from what I see, if the user typed in a server name, your check folder would not work. If you do a msgbox on any of the lines above this is what you would get. msgbox "\\" + client + "\" + Dest + smsremove would return; \\CLIENTINPUT\c:\SMSREMOVE to get to the remote PC, you would need C: to become C$
|
|
| |
|
|
|
 |
Re: Using variables to copy files - 4/8/2005 5:36:32 AM
|
|
 |
|
| |
holtitan
Posts: 26
Score: 0
Joined: 3/28/2005
From:
Status: offline
|
That worked for the folder created. I type UNC's all day from the run command. THe "C$" share should have clicked. My bad. Anyway, could I just stick the folder variable on the file copy to copy those four files to the remote machines? 'On error resume next Dim Fso, Folder, Message2, Client, Dest, smsRemove Set Fso = WScript.CreateObject("Scripting.FileSystemObject") 'Input Box allowing user to input client machine Client = InputBox ("Enter a clients name requiring SMS maintenance") smsRemove = smsRemove Dest = "c$\smsremove" If Fso.FolderExists("\\" & client & "\" & Dest) then Set Folder = Fso.getfolder("\\" & client & "\" & Dest) else Fso.CreateFolder("\\" & client & "\" & Dest) Set Folder = fso.getfolder("\\" & client & "\" & Dest) end if 'fso.Copyfile "\\shsms\smsrepo$\baseline\smsremove\hammer.exe", "c:\smsremove\" 'fso.Copyfile "\\shsms\smsrepo$\baseline\smsremove\kill.exe", "c:\smsremove\" 'fso.Copyfile "\\shsms\smsrepo$\baseline\smsremove\setevnt.exe", "c:\smsremove\" 'fso.Copyfile "\\shsms\smsrepo$\baseline\smsremove\20clicln.bat", "c:\smsremove\"
|
|
| |
|
|
|
 |
Re: Using variables to copy files - 4/8/2005 6:46:22 AM
|
|
 |
|
| |
mbouchard
Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
|
Glad to help
|
|
| |
|
|
|
 |
Re: Using variables to copy files - 4/8/2005 7:51:10 AM
|
|
 |
|
| |
holtitan
Posts: 26
Score: 0
Joined: 3/28/2005
From:
Status: offline
|
One more question. Everything is working up to the point where I'm trying to remotely execute a script called "ExecuteProgram.vbs" (This executes the 20clicln.bat to remove sms agent from a computer). When it gets to that point in the script I get a permission denied. Any clues?? 'On error resume next Dim Fso, Folder, File, Client, Dest, smsRemove, wshobject, Controller, RemoteScript set wshobject=wscript.createobject("wscript.shell") Set Fso = WScript.CreateObject("Scripting.FileSystemObject") Set Controller = WScript.CreateObject("WSHController") 'Input Box allowing user to input client machine Client = InputBox ("Enter a clients name requiring SMS maintenance") smsRemove = smsRemove Dest = "c$\smsremove\" If Fso.FolderExists("\\" & client & "\" & Dest) then Set Folder = Fso.getfolder("\\" & client & "\" & Dest) else Fso.CreateFolder("\\" & client & "\" & Dest) Set Folder = fso.getfolder("\\" & client & "\" & Dest) end if fso.Copyfile "\\shsms\smsrepo$\baseline\smsremove\hammer.exe", "\\" & client & "\" & Dest fso.Copyfile "\\shsms\smsrepo$\baseline\smsremove\kill.exe", "\\" & client & "\" & Dest fso.Copyfile "\\shsms\smsrepo$\baseline\smsremove\setevnt.exe", "\\" & client & "\" & Dest fso.Copyfile "\\shsms\smsrepo$\baseline\smsremove\20clicln.bat", "\\" & client & "\" & Dest Set RemoteScript = Controller.CreateScript("ExecuteProgram.vbs", client) RemoteScript.Execute Do While RemoteScript.Status <> 2 WScript.Sleep 100 Loop
|
|
| |
|
|
|
 |
Re: Using variables to copy files - 4/8/2005 8:36:26 AM
|
|
 |
|
| |
holtitan
Posts: 26
Score: 0
Joined: 3/28/2005
From:
Status: offline
|
Staging.vbs 'On error resume next Dim Fso, Folder, File, Client, Dest, smsRemove, wshobject, Controller, RemoteScript set wshobject=wscript.createobject("wscript.shell") Set Fso = WScript.CreateObject("Scripting.FileSystemObject") Set Controller = WScript.CreateObject("WSHController") 'Input Box allowing user to input client machine Client = InputBox ("Enter a clients name requiring SMS maintenance") smsRemove = smsRemove Dest = "c$\smsremove\" If Fso.FolderExists("\\" & client & "\" & Dest) then Set Folder = Fso.getfolder("\\" & client & "\" & Dest) else Fso.CreateFolder("\\" & client & "\" & Dest) Set Folder = fso.getfolder("\\" & client & "\" & Dest) end if fso.Copyfile "\\shsms\smsrepo$\baseline\smsremove\hammer.exe", "\\" & client & "\" & Dest fso.Copyfile "\\shsms\smsrepo$\baseline\smsremove\kill.exe", "\\" & client & "\" & Dest fso.Copyfile "\\shsms\smsrepo$\baseline\smsremove\setevnt.exe", "\\" & client & "\" & Dest fso.Copyfile "\\shsms\smsrepo$\baseline\smsremove\20clicln.bat", "\\" & client & "\" & Dest Set RemoteScript = Controller.CreateScript("ExecuteProgram.vbs", client) RemoteScript.Execute Do While RemoteScript.Status <> 2 WScript.Sleep 100 Loop Execute.vbs dim wshobject set wshobject=wscript.createobject("wscript.shell") wshobject.run ("C:\smsremove\20clicln.bat" /SCRUB) I got passed the permission problem. However, now I don't get any indication of an error but it doesn't appear that the "C:\smsremove\20clicln.bat" /SCRUB is executing on the remote machine. If you have time...
|
|
| |
|
|
|
|
|