Re: Copying and running processes on remote machines
From: Torgeir Bakken \(MVP\) (Torgeir.Bakken-spam_at_hydro.com)
Date: 02/15/05
- Next message: Amit M.: "Re: Copying and running processes on remote machines"
- Previous message: Torgeir Bakken \(MVP\): "Re: WMI .NET Classes & ports"
- In reply to: Amit M.: "Copying and running processes on remote machines"
- Next in thread: Amit M.: "Re: Copying and running processes on remote machines"
- Reply: Amit M.: "Re: Copying and running processes on remote machines"
- Reply: Amit M.: "Re: Copying and running processes on remote machines"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 15 Feb 2005 11:49:07 +0100
Amit M. wrote:
> First off, there is nothing sinister here...I am trying to create
> a basic remote installer, and I need to know how to do 2 things:
>
> 1. Copy files to a remote machine (on the same domain). I know I
> can do something like use scripting to copy to c$..but I was
> wondering if there is a better way.
That's the best way if you want to do it remotely.
If this is AD domain computers I personally would have installed in a
startup script (with a GPO) that runs as part of the boot up process
(before the user logs in). It runs under the system context and has
admin rights.
Something like this with a VBScript based startup script:
'--------------------8<----------------------
' MDAC silent install, no reboot/reboot prompt
sCommand = "\\server\share\inst\mdac_typ.exe /q:a /c:""dasetup /q /n"""
Set oShell = CreateObject("WScript.Shell")
oShell.Run sCommand, 1, True
'--------------------8<----------------------
To be able to access files over the network from the computer startup
script, you could put the file(s) on a network share and grant read
access for the AD group "Domain Computers" to the share.
Alternatively, from the startup script, you could map a drive on
the fly, like this:
sDomainUser = "arp.corp\computer_fix"
sPswd = "something"
Set oNetwork = CreateObject("Wscript.Network")
oNetwork.MapNetworkDrive _
"Y:", "\\server\netlogon\some folder",, sDomainUser, sPswd
To avoid reinstalling MDAC at every computer startup, check if same
or newer version is already installed and only install if not.:
WScript.Echo GetAdoVersion
Function GetAdoVersion()
' Will return 0 if oADO.Version "fails"
GetAdoVersion = 0
On Error Resume Next
Set oADO = CreateObject("ADODB.Connection")
GetAdoVersion = oADO.Version
End Function
For other ways to detect the ADO version, take a look here at this ADO FAQ:
Q20) How do I determine, through code, what version of MDAC is
installed on a computer???
http://www.able-consulting.com/ADO_Faq.htm#Q20
> 2. Execute an exe on a remote machine. Basically, when I copy
> the files I need to the remote pc, I need to execute some exe's
> (in this case, the MDAC installer).
'--------------------8<----------------------
' create a process with WMI on local or remote computer
sComputer = "." ' use "." for local computer
sCommand = "c:\inst\mdac_typ.exe /q:a /c:""dasetup /q /n"""
Set oWMI = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& sComputer & "\root\cimv2")
iRC = oWMI.Get("Win32_Process").Create(sCommand, Null, Null, iProcessID)
' iRC will indicate if the app was successfully launched or not
If iRC = 0 Then
WScript.Echo "Application started"
Else
WScript.Echo "Could not start application!"
End If
'--------------------8<----------------------
Silent install, no reboot/reboot prompt:
mdac_typ.exe /q:a /c:"dasetup /q /n"
Frequently asked questions about MDAC 2.6 Setup and about MDAC 2.7
Setup (goes for MDAC 2.8 as well)
http://support.microsoft.com/default.aspx?scid=kb;en-us;842193
HOWTO: Invoke Silent MDAC or DA SDK 2.0 Redistribution
http://support.microsoft.com/default.aspx?scid=KB;en-us;192009
-- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: http://www.microsoft.com/technet/scriptcenter/default.mspx
- Next message: Amit M.: "Re: Copying and running processes on remote machines"
- Previous message: Torgeir Bakken \(MVP\): "Re: WMI .NET Classes & ports"
- In reply to: Amit M.: "Copying and running processes on remote machines"
- Next in thread: Amit M.: "Re: Copying and running processes on remote machines"
- Reply: Amit M.: "Re: Copying and running processes on remote machines"
- Reply: Amit M.: "Re: Copying and running processes on remote machines"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|