I have taken this script from a website to do a silent install of the
microsoft antispyware software

The only problem is that it cant connect to the IP addresses that I specify
in the txt file - it works fine if I put the IP addres of my own PC in but
not anyone elses on the network??!!

any ideas - script below??

the files are on my PC hard-drive - we are all runnning XP professional SP2
on a windows 2003 server.

Cheers ears




'MSAS Install Script - ryan@overdose.net

admin_user = "someone"
admin_user_password = "something"

'ipFile = path to list of hosts
ipFile = "C:\scripts\installmsas\list.txt"

'execPath = path to executable file
execPath = "C:\scripts\installmsas\msantispy.msi"

'execCommand = command to execute, including path, switches, etc
execCommand = "msiexec.exe /i c:\msantispy.msi /qn INSTALLDIR=c:\MSAS\"
execCommand2 = "C:\msas\gcasDtServ.exe /regserver"

'fileName = filename of executable
fileName = "msantispy.msi"

'pathToLog = path to the logfile
pathToLog = "C:\scripts\installmsas\install_log.txt"

On Error Resume Next
Set oNet = CreateObject("WScript.Network")
Set oFS = CreateObject("Scripting.FileSystemObject")
Set oSvcLocal = GetObject("winmgmts:root\cimv2")
Set oIPFile = oFS.OpenTextFile(ipFile, 1, false)
Set oOutputFile = oFS.CreateTextFile(pathToLog, TRUE)


If (Err.Number <> 0) Then
WScript.Echo "Cannot open " & ipFile
WScript.Quit
End If


While Not oIPFile.atEndOfStream
ip = oipFile.ReadLine()
oOutputFile.WriteLine(vbCrLf & "Connecting to " & ip & "... ")
WScript.Echo vbCrLf & "Connecting to " & ip & "... "

Err.Clear
Set oSvcRemote = GetObject("winmgmts:\\" & ip & "\root\cimv2", _
admin_user, admin_user_password)

If (Err.Number <> 0) Then
oOutputFile.WriteLine("Failed to connect to " & ip & ".")
WScript.Echo "Failed to connect to " & ip & "."
Else
oNet.RemoveNetworkDrive "J:"
oNet.MapNetworkDrive "J:", "\\" & ip & "\C$"

' copy msas file to remote pc
Set oSourceFile = oSvcLocal.Get("cim_datafile=""" & replace(execPath,
"\", "\\") & """")
returnCode = oSourceFile.Copy("J:\\" & fileName)

If (returnCode <> 0 and returnCode <> 10) Then
' Failure detected and failure was not "file already exists."
oOutputFile.WriteLine("Failed copy " & fileName & " to " & ip & " - Error
Code: " & returnCode)
WScript.Echo "Failed copy " & fileName & " to " & ip & " - Error Code: "
& returnCode
oNet.RemoveNetworkDrive "J:"
Else
oOutputFile.WriteLine(fileName & " copied to " & ip)
WScript.Echo fileName & " copied to " & ip
Set oProcess = oSvcRemote.Get("win32_process")
returnCode = oProcess.Create(replace(execCommand, "\",
"\\"))
If (returnCode <> 0) Then
oOutputFile.WriteLine("Failed to start install on "
& ip & " Error Code: " & returnCode)
WScript.Echo "Failed to start install on " & ip & "
Error Code: " & returnCode
oNet.RemoveNetworkDrive "J:"
Else
Set oDestFile = oSvcLocal.Get("cim_datafile=""J:\\"
& fileName & """")
'Wait for the installation to complete.
For waitTime = 0 To 120 ' Lay and wait--up to
two minutes for the installation to complete.
WScript.Sleep 10000 ' Sleep
'Delete temporary file as soon as possible
after it is freed.
If (oDestFile.Delete() = 0) Then
Exit For
End If
Next ' Otherwise, loop again and keep waiting...
oOutputFile.WriteLine("Installation successful on
" & ip & ".")
WScript.Echo "Installation successful on " & ip &
"."

End If 'Create process succeeded.

'now register server
returnCode = oProcess.Create(replace(execCommand2, "\", "\\"))
If (returnCode <> 0) Then
oOutputFile.WriteLine("Failed to register server on
" & ip & " Error Code: " & returnCode)
WScript.Echo "Failed to register server on " & ip &
" Error Code: " & returnCode
Else
oOutputFile.WriteLine("Registration successful on "
& ip & ".")
WScript.Echo "Registration successful on " & ip &
"."
End If
End If
End If
WEnd
oOutputFile.Close

Re: silent install of Microsoft Antispyware by Steven

Steven
Wed May 25 11:53:56 CDT 2005

#1, I don't think Ryan's gonna like you posting his un-munged e-mail =
address in a spambot playing field ;o)
#2. What exactly is the error message you are getting?
#3. Just a suggestion but, you should consider making the actual main =
part of the path a Const or something, then using (for example)

Const sDirPath =3D "C:\scripts\installmsas\"

ipFile =3D sDirPath & "list.txt"

pathToLog =3D sDirPath & "install_log.txt"

This will save you having to faff around, should the paths ever change =
(or for example, when you want to use the script on a network thats not =
connected to yours).

--=20
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"PeterP" <me@here.co.uk> wrote in message =
news:OEygIaUYFHA.1384@TK2MSFTNGP09.phx.gbl...
> I have taken this script from a website to do a silent install of the=20
> microsoft antispyware software
>=20
> The only problem is that it cant connect to the IP addresses that I =
specify=20
> in the txt file - it works fine if I put the IP addres of my own PC in =
but=20
> not anyone elses on the network??!!
>=20
> any ideas - script below??
>=20
> the files are on my PC hard-drive - we are all runnning XP =
professional SP2=20
> on a windows 2003 server.
>=20
> Cheers ears
>=20
>=20
>=20
>=20
> 'MSAS Install Script - ryan@overdose.net
>=20
> admin_user =3D "someone"
> admin_user_password =3D "something"
>=20
> 'ipFile =3D path to list of hosts
> ipFile =3D "C:\scripts\installmsas\list.txt"
>=20
> 'execPath =3D path to executable file
> execPath =3D "C:\scripts\installmsas\msantispy.msi"
>=20
> 'execCommand =3D command to execute, including path, switches, etc
> execCommand =3D "msiexec.exe /i c:\msantispy.msi /qn =
INSTALLDIR=3Dc:\MSAS\"
> execCommand2 =3D "C:\msas\gcasDtServ.exe /regserver"
>=20
> 'fileName =3D filename of executable
> fileName =3D "msantispy.msi"
>=20
> 'pathToLog =3D path to the logfile
> pathToLog =3D "C:\scripts\installmsas\install_log.txt"
>=20
> On Error Resume Next
> Set oNet =3D CreateObject("WScript.Network")
> Set oFS =3D CreateObject("Scripting.FileSystemObject")
> Set oSvcLocal =3D GetObject("winmgmts:root\cimv2")
> Set oIPFile =3D oFS.OpenTextFile(ipFile, 1, false)
> Set oOutputFile =3D oFS.CreateTextFile(pathToLog, TRUE)
>=20
>=20
> If (Err.Number <> 0) Then
> WScript.Echo "Cannot open " & ipFile
> WScript.Quit
> End If
>=20
>=20
> While Not oIPFile.atEndOfStream
> ip =3D oipFile.ReadLine()
> oOutputFile.WriteLine(vbCrLf & "Connecting to " & ip & "... ")
> WScript.Echo vbCrLf & "Connecting to " & ip & "... "
>=20
> Err.Clear
> Set oSvcRemote =3D GetObject("winmgmts:\\" & ip & "\root\cimv2", =
_
> admin_user, admin_user_password)
>=20
> If (Err.Number <> 0) Then
> oOutputFile.WriteLine("Failed to connect to " & ip & ".")
> WScript.Echo "Failed to connect to " & ip & "."
> Else
> oNet.RemoveNetworkDrive "J:"
> oNet.MapNetworkDrive "J:", "\\" & ip & "\C$"
>=20
> ' copy msas file to remote pc
> Set oSourceFile =3D oSvcLocal.Get("cim_datafile=3D""" & =
replace(execPath,=20
> "\", "\\") & """")
> returnCode =3D oSourceFile.Copy("J:\\" & fileName)
>=20
> If (returnCode <> 0 and returnCode <> 10) Then
> ' Failure detected and failure was not "file already exists."
> oOutputFile.WriteLine("Failed copy " & fileName & " to " & ip & " - =
Error=20
> Code: " & returnCode)
> WScript.Echo "Failed copy " & fileName & " to " & ip & " - Error =
Code: "=20
> & returnCode
> oNet.RemoveNetworkDrive "J:"
> Else
> oOutputFile.WriteLine(fileName & " copied to " & ip)
> WScript.Echo fileName & " copied to " & ip
> Set oProcess =3D oSvcRemote.Get("win32_process")
> returnCode =3D oProcess.Create(replace(execCommand, =
"\",=20
> "\\"))
> If (returnCode <> 0) Then
> oOutputFile.WriteLine("Failed to start =
install on "=20
> & ip & " Error Code: " & returnCode)
> WScript.Echo "Failed to start install on " & =
ip & "=20
> Error Code: " & returnCode
> oNet.RemoveNetworkDrive "J:"
> Else
> Set oDestFile =3D =
oSvcLocal.Get("cim_datafile=3D""J:\\"=20
> & fileName & """")
> 'Wait for the installation to complete.
> For waitTime =3D 0 To 120 ' Lay and =
wait--up to=20
> two minutes for the installation to complete.
> WScript.Sleep 10000 ' Sleep
> 'Delete temporary file as soon as =
possible=20
> after it is freed.
> If (oDestFile.Delete() =3D 0) Then
> Exit For
> End If
> Next ' Otherwise, loop again and keep =
waiting...
> oOutputFile.WriteLine("Installation =
successful on=20
> " & ip & ".")
> WScript.Echo "Installation successful on " & =
ip &=20
> "."
>=20
> End If 'Create process succeeded.
>=20
> 'now register server
> returnCode =3D oProcess.Create(replace(execCommand2, "\", "\\"))
> If (returnCode <> 0) Then
> oOutputFile.WriteLine("Failed to register =
server on=20
> " & ip & " Error Code: " & returnCode)
> WScript.Echo "Failed to register server on " =
& ip &=20
> " Error Code: " & returnCode
> Else
> oOutputFile.WriteLine("Registration =
successful on "=20
> & ip & ".")
> WScript.Echo "Registration successful on " & =
ip &=20
> "."
> End If
> End If
> End If
> WEnd
> oOutputFile.Close
>=20
>=20


Re: silent install of Microsoft Antispyware by PeterP

PeterP
Wed May 25 12:15:31 CDT 2005

the error message is simply "failed to connect to X.X.X.X and the ip address
it was trying to connect to.

I can ping the IP fine



"Steven Burn" <somewhere@in-time.invalid> wrote in message
news:eDH6ypUYFHA.1092@tk2msftngp13.phx.gbl...
#1, I don't think Ryan's gonna like you posting his un-munged e-mail address
in a spambot playing field ;o)
#2. What exactly is the error message you are getting?
#3. Just a suggestion but, you should consider making the actual main part
of the path a Const or something, then using (for example)

Const sDirPath = "C:\scripts\installmsas\"

ipFile = sDirPath & "list.txt"

pathToLog = sDirPath & "install_log.txt"

This will save you having to faff around, should the paths ever change (or
for example, when you want to use the script on a network thats not
connected to yours).

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"PeterP" <me@here.co.uk> wrote in message
news:OEygIaUYFHA.1384@TK2MSFTNGP09.phx.gbl...
> I have taken this script from a website to do a silent install of the
> microsoft antispyware software
>
> The only problem is that it cant connect to the IP addresses that I
> specify
> in the txt file - it works fine if I put the IP addres of my own PC in but
> not anyone elses on the network??!!
>
> any ideas - script below??
>
> the files are on my PC hard-drive - we are all runnning XP professional
> SP2
> on a windows 2003 server.
>
> Cheers ears
>
>
>
>
> 'MSAS Install Script - ryan@overdose.net
>
> admin_user = "someone"
> admin_user_password = "something"
>
> 'ipFile = path to list of hosts
> ipFile = "C:\scripts\installmsas\list.txt"
>
> 'execPath = path to executable file
> execPath = "C:\scripts\installmsas\msantispy.msi"
>
> 'execCommand = command to execute, including path, switches, etc
> execCommand = "msiexec.exe /i c:\msantispy.msi /qn INSTALLDIR=c:\MSAS\"
> execCommand2 = "C:\msas\gcasDtServ.exe /regserver"
>
> 'fileName = filename of executable
> fileName = "msantispy.msi"
>
> 'pathToLog = path to the logfile
> pathToLog = "C:\scripts\installmsas\install_log.txt"
>
> On Error Resume Next
> Set oNet = CreateObject("WScript.Network")
> Set oFS = CreateObject("Scripting.FileSystemObject")
> Set oSvcLocal = GetObject("winmgmts:root\cimv2")
> Set oIPFile = oFS.OpenTextFile(ipFile, 1, false)
> Set oOutputFile = oFS.CreateTextFile(pathToLog, TRUE)
>
>
> If (Err.Number <> 0) Then
> WScript.Echo "Cannot open " & ipFile
> WScript.Quit
> End If
>
>
> While Not oIPFile.atEndOfStream
> ip = oipFile.ReadLine()
> oOutputFile.WriteLine(vbCrLf & "Connecting to " & ip & "... ")
> WScript.Echo vbCrLf & "Connecting to " & ip & "... "
>
> Err.Clear
> Set oSvcRemote = GetObject("winmgmts:\\" & ip & "\root\cimv2", _
> admin_user, admin_user_password)
>
> If (Err.Number <> 0) Then
> oOutputFile.WriteLine("Failed to connect to " & ip & ".")
> WScript.Echo "Failed to connect to " & ip & "."
> Else
> oNet.RemoveNetworkDrive "J:"
> oNet.MapNetworkDrive "J:", "\\" & ip & "\C$"
>
> ' copy msas file to remote pc
> Set oSourceFile = oSvcLocal.Get("cim_datafile=""" & replace(execPath,
> "\", "\\") & """")
> returnCode = oSourceFile.Copy("J:\\" & fileName)
>
> If (returnCode <> 0 and returnCode <> 10) Then
> ' Failure detected and failure was not "file already exists."
> oOutputFile.WriteLine("Failed copy " & fileName & " to " & ip & " -
> Error
> Code: " & returnCode)
> WScript.Echo "Failed copy " & fileName & " to " & ip & " - Error Code:
> "
> & returnCode
> oNet.RemoveNetworkDrive "J:"
> Else
> oOutputFile.WriteLine(fileName & " copied to " & ip)
> WScript.Echo fileName & " copied to " & ip
> Set oProcess = oSvcRemote.Get("win32_process")
> returnCode = oProcess.Create(replace(execCommand, "\",
> "\\"))
> If (returnCode <> 0) Then
> oOutputFile.WriteLine("Failed to start install on
> "
> & ip & " Error Code: " & returnCode)
> WScript.Echo "Failed to start install on " & ip &
> "
> Error Code: " & returnCode
> oNet.RemoveNetworkDrive "J:"
> Else
> Set oDestFile =
> oSvcLocal.Get("cim_datafile=""J:\\"
> & fileName & """")
> 'Wait for the installation to complete.
> For waitTime = 0 To 120 ' Lay and wait--up to
> two minutes for the installation to complete.
> WScript.Sleep 10000 ' Sleep
> 'Delete temporary file as soon as
> possible
> after it is freed.
> If (oDestFile.Delete() = 0) Then
> Exit For
> End If
> Next ' Otherwise, loop again and keep waiting...
> oOutputFile.WriteLine("Installation successful
> on
> " & ip & ".")
> WScript.Echo "Installation successful on " & ip
> &
> "."
>
> End If 'Create process succeeded.
>
> 'now register server
> returnCode = oProcess.Create(replace(execCommand2, "\", "\\"))
> If (returnCode <> 0) Then
> oOutputFile.WriteLine("Failed to register server
> on
> " & ip & " Error Code: " & returnCode)
> WScript.Echo "Failed to register server on " & ip
> &
> " Error Code: " & returnCode
> Else
> oOutputFile.WriteLine("Registration successful on
> "
> & ip & ".")
> WScript.Echo "Registration successful on " & ip &
> "."
> End If
> End If
> End If
> WEnd
> oOutputFile.Close
>
>



Re: silent install of Microsoft Antispyware by Steven

Steven
Wed May 25 12:33:43 CDT 2005

Try changing;

oOutputFile.WriteLine("Failed to connect to " & ip & ".")
WScript.Echo "Failed to connect to " & ip & "."

To;

oOutputFile.WriteLine("Failed to connect to " & ip & "." & vbCrlf & =
Err.Number & " - " & Err.Description)
WScript.Echo "Failed to connect to " & ip & "." & vbCrlf & Err.Number & =
" - " & Err.Description

That should atleast tell you what the error code associated with the =
failiure is.

--=20
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"PeterP" <me@here.co.uk> wrote in message =
news:OcbMp0UYFHA.2756@tk2msftngp13.phx.gbl...
> the error message is simply "failed to connect to X.X.X.X and the ip =
address=20
> it was trying to connect to.
>=20
> I can ping the IP fine
>=20
>=20
>=20
> "Steven Burn" <somewhere@in-time.invalid> wrote in message=20
> news:eDH6ypUYFHA.1092@tk2msftngp13.phx.gbl...
> #1, I don't think Ryan's gonna like you posting his un-munged e-mail =
address=20
> in a spambot playing field ;o)
> #2. What exactly is the error message you are getting?
> #3. Just a suggestion but, you should consider making the actual main =
part=20
> of the path a Const or something, then using (for example)
>=20
> Const sDirPath =3D "C:\scripts\installmsas\"
>=20
> ipFile =3D sDirPath & "list.txt"
>=20
> pathToLog =3D sDirPath & "install_log.txt"
>=20
> This will save you having to faff around, should the paths ever change =
(or=20
> for example, when you want to use the script on a network thats not=20
> connected to yours).
>=20
> --=20
> Regards
>=20
> Steven Burn
> Ur I.T. Mate Group
> www.it-mate.co.uk
>=20
> Keeping it FREE!
>=20
> "PeterP" <me@here.co.uk> wrote in message=20
> news:OEygIaUYFHA.1384@TK2MSFTNGP09.phx.gbl...
> > I have taken this script from a website to do a silent install of =
the
> > microsoft antispyware software
> >
> > The only problem is that it cant connect to the IP addresses that I=20
> > specify
> > in the txt file - it works fine if I put the IP addres of my own PC =
in but
> > not anyone elses on the network??!!
> >
> > any ideas - script below??
> >
> > the files are on my PC hard-drive - we are all runnning XP =
professional=20
> > SP2
> > on a windows 2003 server.
> >
> > Cheers ears
> >
> >
> >
> >
> > 'MSAS Install Script - ryan@overdose.net
> >
> > admin_user =3D "someone"
> > admin_user_password =3D "something"
> >
> > 'ipFile =3D path to list of hosts
> > ipFile =3D "C:\scripts\installmsas\list.txt"
> >
> > 'execPath =3D path to executable file
> > execPath =3D "C:\scripts\installmsas\msantispy.msi"
> >
> > 'execCommand =3D command to execute, including path, switches, etc
> > execCommand =3D "msiexec.exe /i c:\msantispy.msi /qn =
INSTALLDIR=3Dc:\MSAS\"
> > execCommand2 =3D "C:\msas\gcasDtServ.exe /regserver"
> >
> > 'fileName =3D filename of executable
> > fileName =3D "msantispy.msi"
> >
> > 'pathToLog =3D path to the logfile
> > pathToLog =3D "C:\scripts\installmsas\install_log.txt"
> >
> > On Error Resume Next
> > Set oNet =3D CreateObject("WScript.Network")
> > Set oFS =3D CreateObject("Scripting.FileSystemObject")
> > Set oSvcLocal =3D GetObject("winmgmts:root\cimv2")
> > Set oIPFile =3D oFS.OpenTextFile(ipFile, 1, false)
> > Set oOutputFile =3D oFS.CreateTextFile(pathToLog, TRUE)
> >
> >
> > If (Err.Number <> 0) Then
> > WScript.Echo "Cannot open " & ipFile
> > WScript.Quit
> > End If
> >
> >
> > While Not oIPFile.atEndOfStream
> > ip =3D oipFile.ReadLine()
> > oOutputFile.WriteLine(vbCrLf & "Connecting to " & ip & "... ")
> > WScript.Echo vbCrLf & "Connecting to " & ip & "... "
> >
> > Err.Clear
> > Set oSvcRemote =3D GetObject("winmgmts:\\" & ip & =
"\root\cimv2", _
> > admin_user, admin_user_password)
> >
> > If (Err.Number <> 0) Then
> > oOutputFile.WriteLine("Failed to connect to " & ip & ".")
> > WScript.Echo "Failed to connect to " & ip & "."
> > Else
> > oNet.RemoveNetworkDrive "J:"
> > oNet.MapNetworkDrive "J:", "\\" & ip & "\C$"
> >
> > ' copy msas file to remote pc
> > Set oSourceFile =3D oSvcLocal.Get("cim_datafile=3D""" & =
replace(execPath,
> > "\", "\\") & """")
> > returnCode =3D oSourceFile.Copy("J:\\" & fileName)
> >
> > If (returnCode <> 0 and returnCode <> 10) Then
> > ' Failure detected and failure was not "file already exists."
> > oOutputFile.WriteLine("Failed copy " & fileName & " to " & ip & " =
-=20
> > Error
> > Code: " & returnCode)
> > WScript.Echo "Failed copy " & fileName & " to " & ip & " - Error =
Code:=20
> > "
> > & returnCode
> > oNet.RemoveNetworkDrive "J:"
> > Else
> > oOutputFile.WriteLine(fileName & " copied to " & ip)
> > WScript.Echo fileName & " copied to " & ip
> > Set oProcess =3D oSvcRemote.Get("win32_process")
> > returnCode =3D oProcess.Create(replace(execCommand, =
"\",
> > "\\"))
> > If (returnCode <> 0) Then
> > oOutputFile.WriteLine("Failed to start =
install on=20
> > "
> > & ip & " Error Code: " & returnCode)
> > WScript.Echo "Failed to start install on " =
& ip &=20
> > "
> > Error Code: " & returnCode
> > oNet.RemoveNetworkDrive "J:"
> > Else
> > Set oDestFile =3D=20
> > oSvcLocal.Get("cim_datafile=3D""J:\\"
> > & fileName & """")
> > 'Wait for the installation to complete.
> > For waitTime =3D 0 To 120 ' Lay and =
wait--up to
> > two minutes for the installation to complete.
> > WScript.Sleep 10000 ' Sleep
> > 'Delete temporary file as soon as=20
> > possible
> > after it is freed.
> > If (oDestFile.Delete() =3D 0) Then
> > Exit For
> > End If
> > Next ' Otherwise, loop again and keep =
waiting...
> > oOutputFile.WriteLine("Installation =
successful=20
> > on
> > " & ip & ".")
> > WScript.Echo "Installation successful on " =
& ip=20
> > &
> > "."
> >
> > End If 'Create process succeeded.
> >
> > 'now register server
> > returnCode =3D oProcess.Create(replace(execCommand2, "\", "\\"))
> > If (returnCode <> 0) Then
> > oOutputFile.WriteLine("Failed to register =
server=20
> > on
> > " & ip & " Error Code: " & returnCode)
> > WScript.Echo "Failed to register server on =
" & ip=20
> > &
> > " Error Code: " & returnCode
> > Else
> > oOutputFile.WriteLine("Registration =
successful on=20
> > "
> > & ip & ".")
> > WScript.Echo "Registration successful on " =
& ip &
> > "."
> > End If
> > End If
> > End If
> > WEnd
> > oOutputFile.Close
> >
> >
>=20
>=20


Re: silent install of Microsoft Antispyware by PeterP

PeterP
Thu May 26 04:57:27 CDT 2005

Cheers for that

the error message is:

450 - wrong number of arguments or invalid property assignment




"Steven Burn" <somewhere@in-time.invalid> wrote in message
news:uxsmBAVYFHA.3132@TK2MSFTNGP09.phx.gbl...
Try changing;

oOutputFile.WriteLine("Failed to connect to " & ip & ".")
WScript.Echo "Failed to connect to " & ip & "."

To;

oOutputFile.WriteLine("Failed to connect to " & ip & "." & vbCrlf &
Err.Number & " - " & Err.Description)
WScript.Echo "Failed to connect to " & ip & "." & vbCrlf & Err.Number & " -
" & Err.Description

That should atleast tell you what the error code associated with the
failiure is.

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"PeterP" <me@here.co.uk> wrote in message
news:OcbMp0UYFHA.2756@tk2msftngp13.phx.gbl...
> the error message is simply "failed to connect to X.X.X.X and the ip
> address
> it was trying to connect to.
>
> I can ping the IP fine
>
>
>
> "Steven Burn" <somewhere@in-time.invalid> wrote in message
> news:eDH6ypUYFHA.1092@tk2msftngp13.phx.gbl...
> #1, I don't think Ryan's gonna like you posting his un-munged e-mail
> address
> in a spambot playing field ;o)
> #2. What exactly is the error message you are getting?
> #3. Just a suggestion but, you should consider making the actual main part
> of the path a Const or something, then using (for example)
>
> Const sDirPath = "C:\scripts\installmsas\"
>
> ipFile = sDirPath & "list.txt"
>
> pathToLog = sDirPath & "install_log.txt"
>
> This will save you having to faff around, should the paths ever change (or
> for example, when you want to use the script on a network thats not
> connected to yours).
>
> --
> Regards
>
> Steven Burn
> Ur I.T. Mate Group
> www.it-mate.co.uk
>
> Keeping it FREE!
>
> "PeterP" <me@here.co.uk> wrote in message
> news:OEygIaUYFHA.1384@TK2MSFTNGP09.phx.gbl...
> > I have taken this script from a website to do a silent install of the
> > microsoft antispyware software
> >
> > The only problem is that it cant connect to the IP addresses that I
> > specify
> > in the txt file - it works fine if I put the IP addres of my own PC in
> > but
> > not anyone elses on the network??!!
> >
> > any ideas - script below??
> >
> > the files are on my PC hard-drive - we are all runnning XP professional
> > SP2
> > on a windows 2003 server.
> >
> > Cheers ears
> >
> >
> >
> >
> > 'MSAS Install Script - ryan@overdose.net
> >
> > admin_user = "someone"
> > admin_user_password = "something"
> >
> > 'ipFile = path to list of hosts
> > ipFile = "C:\scripts\installmsas\list.txt"
> >
> > 'execPath = path to executable file
> > execPath = "C:\scripts\installmsas\msantispy.msi"
> >
> > 'execCommand = command to execute, including path, switches, etc
> > execCommand = "msiexec.exe /i c:\msantispy.msi /qn INSTALLDIR=c:\MSAS\"
> > execCommand2 = "C:\msas\gcasDtServ.exe /regserver"
> >
> > 'fileName = filename of executable
> > fileName = "msantispy.msi"
> >
> > 'pathToLog = path to the logfile
> > pathToLog = "C:\scripts\installmsas\install_log.txt"
> >
> > On Error Resume Next
> > Set oNet = CreateObject("WScript.Network")
> > Set oFS = CreateObject("Scripting.FileSystemObject")
> > Set oSvcLocal = GetObject("winmgmts:root\cimv2")
> > Set oIPFile = oFS.OpenTextFile(ipFile, 1, false)
> > Set oOutputFile = oFS.CreateTextFile(pathToLog, TRUE)
> >
> >
> > If (Err.Number <> 0) Then
> > WScript.Echo "Cannot open " & ipFile
> > WScript.Quit
> > End If
> >
> >
> > While Not oIPFile.atEndOfStream
> > ip = oipFile.ReadLine()
> > oOutputFile.WriteLine(vbCrLf & "Connecting to " & ip & "... ")
> > WScript.Echo vbCrLf & "Connecting to " & ip & "... "
> >
> > Err.Clear
> > Set oSvcRemote = GetObject("winmgmts:\\" & ip & "\root\cimv2", _
> > admin_user, admin_user_password)
> >
> > If (Err.Number <> 0) Then
> > oOutputFile.WriteLine("Failed to connect to " & ip & ".")
> > WScript.Echo "Failed to connect to " & ip & "."
> > Else
> > oNet.RemoveNetworkDrive "J:"
> > oNet.MapNetworkDrive "J:", "\\" & ip & "\C$"
> >
> > ' copy msas file to remote pc
> > Set oSourceFile = oSvcLocal.Get("cim_datafile=""" & replace(execPath,
> > "\", "\\") & """")
> > returnCode = oSourceFile.Copy("J:\\" & fileName)
> >
> > If (returnCode <> 0 and returnCode <> 10) Then
> > ' Failure detected and failure was not "file already exists."
> > oOutputFile.WriteLine("Failed copy " & fileName & " to " & ip & " -
> > Error
> > Code: " & returnCode)
> > WScript.Echo "Failed copy " & fileName & " to " & ip & " - Error
> > Code:
> > "
> > & returnCode
> > oNet.RemoveNetworkDrive "J:"
> > Else
> > oOutputFile.WriteLine(fileName & " copied to " & ip)
> > WScript.Echo fileName & " copied to " & ip
> > Set oProcess = oSvcRemote.Get("win32_process")
> > returnCode = oProcess.Create(replace(execCommand, "\",
> > "\\"))
> > If (returnCode <> 0) Then
> > oOutputFile.WriteLine("Failed to start install
> > on
> > "
> > & ip & " Error Code: " & returnCode)
> > WScript.Echo "Failed to start install on " & ip
> > &
> > "
> > Error Code: " & returnCode
> > oNet.RemoveNetworkDrive "J:"
> > Else
> > Set oDestFile =
> > oSvcLocal.Get("cim_datafile=""J:\\"
> > & fileName & """")
> > 'Wait for the installation to complete.
> > For waitTime = 0 To 120 ' Lay and wait--up
> > to
> > two minutes for the installation to complete.
> > WScript.Sleep 10000 ' Sleep
> > 'Delete temporary file as soon as
> > possible
> > after it is freed.
> > If (oDestFile.Delete() = 0) Then
> > Exit For
> > End If
> > Next ' Otherwise, loop again and keep
> > waiting...
> > oOutputFile.WriteLine("Installation successful
> > on
> > " & ip & ".")
> > WScript.Echo "Installation successful on " &
> > ip
> > &
> > "."
> >
> > End If 'Create process succeeded.
> >
> > 'now register server
> > returnCode = oProcess.Create(replace(execCommand2, "\", "\\"))
> > If (returnCode <> 0) Then
> > oOutputFile.WriteLine("Failed to register
> > server
> > on
> > " & ip & " Error Code: " & returnCode)
> > WScript.Echo "Failed to register server on " &
> > ip
> > &
> > " Error Code: " & returnCode
> > Else
> > oOutputFile.WriteLine("Registration successful
> > on
> > "
> > & ip & ".")
> > WScript.Echo "Registration successful on " & ip
> > &
> > "."
> > End If
> > End If
> > End If
> > WEnd
> > oOutputFile.Close
> >
> >
>
>