Can someone tell me why this code is not working
I am trying to implemented to the domain early tommorow
the error that i am getting is
Line 61
Char 1
Error: Object required: 'www'
Code 800A01a8
'=========================
==========
==========
==========
==========
=========
'
' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 2009
'
' NAME:
'
' AUTHOR: Erwin , Miranda Corp
' DATE : 2/28/2009
'
' COMMENT: Modifying a Registry Entry
'
'=========================
==========
==========
==========
==========
========
strServiceName = "W32Time"
Set objWMIService = GetObject("winmgmts:{imper
sonationLe
vel=impers
onate}!\\.
\root\cimv
2")
Set colListOfServices = objWMIService.ExecQuery("S
elect * from Win32_Service Where Name ='" & strServiceName & "'")
For Each objService in colListOfServices
objService.StopService()
Next
Set objFSO = CreateObject("Scripting.Fi
leSystemOb
ject")
Const intForReading = 1
strInputFile = "C:\Users\Erwin\Desktop\Sc
ripts1\Mod
_Registry\
ALL_COMPUT
ERS.txt"
Set objInputFile = objFSO.OpenTextFile(strInp
utFile, intForReading, False)
While Not objInputFile.AtEndOfStream
strComputer = objInputFile.ReadLine
If Ping(strComputer) = True Then
On Error Resume Next
Set objReg = GetObject("winmgmts:{imper
sonationLe
vel=impers
onate}!\\"
&_
strComputer & "\root\default:StdRegProv"
)
If Err.Number = 0 Then
On Error GoTo 0
objReg.SetDWORDValue constHKEY_LOCAL_MACHINE, strKeyPath & strDWORDValueName, strDWORDValue
WScript.Echo strDWORDValueName & " was set to " & strDWORDValue
Else
Err.Clear
On Error GoTo 0
WScript.Echo "There was an error connecting to the registry on " & strComputer
End If
Else
WScript.Echo strComputer & " could not be pinged."
End If
Wend
objInputFile.Close
Set objInputFile = Nothing
WScript.Echo "
www.google.com"
WScript.Echo "Done"
Function Ping(strComputer)
Dim objShell, boolCode
Set objShell = CreateObject("WScript.Shel
l")
boolCode = objShell.Run("Ping -n 4 -w 300 " & strComputer, 0, True)
If boolCode = 0 Then
Ping = True
Else
Ping = False
End If
End Function
Set objShell = WScript.CreateObject ("WScript.Shell")
arrValues = objShell.RegWrite_("HKLM\S
YSTEM\Curr
entControl
Set\Servic
es\W32Time
\Parameter
s\NtpServe
r",
www.google.com , "REG_SZ")
For Each srtValue In arrValues
WScript.Echo starValue
Next
strServiceName = "W32Time"
Set objWMIService = GetObject("winmgmts:{imper
sonationLe
vel=impers
onate}!\\.
\root\cimv
2")
Set colListOfServices = objWMIService.ExecQuery ("Select * from Win32_Service Where Name ='" & strServiceName & "'")
For Each objService in colListOfServices
objService.StartService()
Next