Re: Copy folder to a remoted Computer then run executeable
- From: "Chris A. Zanowick" <chris_zanowick@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 10 Oct 2005 15:14:05 -0700
Hi Pete,
Thanks so very much for your reply. I'll been struggling quite a bit with
this being fairly new to this scripting language.
After thinking about it, you ended up integrating the methodology that I
thought might accomplish the task. I have to take some time looking through
this to see if it will copy the folder from a server share to the desktop of
the remote workstation and then execute the batch file. Looks like it will
work. I'll let you know.
--
Thank you very much again,
Chris A. Zanowick
"Pete" wrote:
> I used the following to deploy service packs to win 2000 machines, it worked
> ok but doesn't return satisfactory error codes for the installation - ie
> 3010 - reboot required. It only returns a code for whether the command was
> sent ok. I resorted to using a modified version with psexec which gave
> accurate reporting.
>
> Pete
>
> strcomputer = InputBox("Enter the name of the Computer you wish to update."
> & VbCrLf &_
> VbCrLf & "Click OK, then select the file you wish to install.","Service
> Pack Installer")
>
> Set objDialog = CreateObject("UserAccounts.CommonDialog")
> objDialog.Filter = "All Files|*.*"
> objDialog.InitialDir = "C:\"
> intresult = objDialog.ShowOpen
> strSP = objDialog.FileName
>
> strSwitches = inputbox("Add any switches required", "Install Switches",
> " -N -O -Z -Q")
>
>
>
> Dim fso, oFile
> Set fso = CreateObject("Scripting.FileSystemObject")
>
> Set oFile = fso.CreateTextFile("c:\install.cmd", True)
> oFile.WriteLine(strSP & " " & strswitches)
> oFile.Close
>
> Set oFile = fso.CreateTextFile("c:\copyfiles.cmd", True)
> oFile.WriteLine("COPY " & strSP & " \\" & strcomputer & "\c$")
> oFile.WriteLine("COPY c:\install.cmd \\" & strcomputer & "\c$")
> oFile.Close
>
>
>
> Dim oShell
> Set oShell = WScript.CreateObject("WScript.Shell")
> copyreturn = oShell.Run("c:\copyfiles.cmd", 0, True)
>
> If copyresult = 0 Then
>
> Set process = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
> strcomputer & "\root\cimv2:Win32_Process")
> installreturn = process.Create("c:\install.cmd",Null,Null,processid)
> If installreturn = 0 Then
> If MsgBox("The install has started successfully." & vbcrlf & vbcrlf &_
> "Do you want to view the log file?", vbyesno + vbquestion,
> "Installation on: " & ucase(strcomputer)) = vbyes then
> Set oShell = CreateObject("WScript.Shell")
> Call oShell.Run("cmd /c \\" & strcomputer &
> "\c$\winnt\svcpack.log",0,True)
> End If
> Else
> If MsgBox("The install command failed to start." & vbcrlf & vbcrlf &_
> "Do you want to view the log file?", vbyesno + vbquestion,
> "Installation on: " & ucase(strcomputer)) = vbyes then
> wscript.sleep 150000
> Set oShell = CreateObject("WScript.Shell")
> Call oShell.Run("cmd /c \\" & strcomputer &
> "\c$\winnt\svcpack.log",0,True)
> End If
> End If
>
> Else
> wscript.echo strcomputer & "File Copy Failed"
> End If
>
>
>
> "Chris A. Zanowick" <chris_zanowick@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
> message news:0BE8DBB1-7068-4FA6-BA15-7647C512D6DC@xxxxxxxxxxxxxxxx
> > Hi Everyone,
> >
> > Has anyone out there attempted to write a WSH script to do the following?
> >
> > Display an input box to enter a remote computer in a domain on which to
> > run
> > the script remotely.
> >
> > Then copy a folder and it's contents from "\\server\installs\NAV" to the
> > remote computer's "c:\documents and settings\userprofile\desktop"
> > directory.
> >
> > Then I want to run the batch file in the NAV folder after the copying?
> > --
> > Thank you,
> > Chris A. Zanowick
>
>
>
.
- Follow-Ups:
- Re: Copy folder to a remoted Computer then run executable
- From: Chris A. Zanowick
- Re: Copy folder to a remoted Computer then run executable
- References:
- Prev by Date: Launching interactive apps remotely
- Next by Date: RE: WSH MsgrObject.CreateUser Security
- Previous by thread: Re: Copy folder to a remoted Computer then run executeable
- Next by thread: Re: Copy folder to a remoted Computer then run executable
- Index(es):
Relevant Pages
|