In the script below and all other scripts I have that I run against Win2k3
boxes I get an error. The error is:
Line: 33
Char: 1
Error: Permission denied:'GetObject'
Code: 800A0046
What am I doing wrong.
'--------------------------------------------------------------------
' This script looks for a CSV file in the same directory as this script to.
' pull server names from.
'--------------------------------------------------------------------
Dim fsoIn, fsoOut
Dim inFile, outFile
Dim arrComputerNames
Dim objUser
Dim strComputer
Dim ErrorOccurred
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const inFilename = "servers.csv"
Const outFilename = "STARTTelnet.log"
'On Error Resume Next
ErrorOccurred = False
' Open the input file and skip the header line
Set fsoIn = CreateObject("scripting.filesystemobject")
Set inFile = fsoIn.OpenTextFile(inFilename, ForReading, True)
inFile.Skipline
While Not inFile.AtEndOfStream
arrComputerNames = Split(inFile.Readline, vbTab, -1, 1)
' arrComputerNames(0) contains the computer name
strComputer = arrComputerNames(0)
'--------------------------------------------------------------------
'This section sets up the information.
'--------------------------------------------------------------------
'THIS IS LINE 32 the one below is the one I'm havin' trouble with!!!
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "C:\sp1\sp1.exe" , "\\" & strComputer & _
"\c$\SP1\sp1.exe", OverwriteExisting
'Next
Wend
Wscript.Echo "Done"