It says the error is in line 27. Here is line 27.
oReg.SetValue(HKEY_USERS, strkeypath, "SCRNSAVE.EXE", REG_EXPAND_SZ, "%SystemRoot%\System32\ITEP SS_UTI Version.scr"
Thank you so much for your assistance by the way! Do i actually need to change the "strikeypath" or do i leave that there?
Code: ... i changed file names and the test computer.
Sub SetKeysForMachine(Byval MachineName)
const HKEY_USERS = &H80000003
strComputer = MachineName
Set StdOut = WScript.StdOut
stdout.WriteLine "Connecting to " & machineName
'Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
'MachineName & "\root\default:StdRegProv")
set oReg = GetObject("WinMgmts:{impersonationLevel=impersonate}!//" & strComputer & "/root/default:stdRegProv")
strKeyPath = ""
oReg.EnumKey HKEY_USERS, strKeyPath, arrSubKeys
'REG ADD "\\timscomputer\HKCU\Control Panel\Desktop" /V SCRNSAVE.EXE /T REG_SZ /F /D "%SystemRoot%\System32\ITEP SS_UTI Version.scr"
'REG ADD "\\timscomputer\HKCU\Control Panel\Desktop" /V ScreenSaveActive /T REG_SZ /F /D 1
For Each subkey In arrSubKeys
'StdOut.WriteLine subkey
'save subkey\Control Panel\Desktop value, screensaveactive.
strKeyPath = subkey & "\Control Panel\Desktop"
strValueName = "ScreenSaveActive"
strValue = "1"
oReg.SetStringValue HKEY_USERS,strKeyPath,strValueName,strValue
oReg.SetValue(HKEY_USERS, strkeypath, "SCRNSAVE.EXE", REG_EXPAND_SZ, "%SystemRoot%\System32\ITEP SS_UTI Version.scr"
Next
End Sub
Dim mmachineNames()
Const NumMachines =1
redim mmachinenames(NumMachines-1)
'Change this portion, to reflect the actual number of machines (the above constant) as well as their names.
'mmachinenames(0) = "." 'this reflects the local machine. This was for my testing, change it :P
mmachinenames(0) = "u1jbennett"
on error resume next
Dim I ,X
'for each machine in mmachinenames
For I = 0 to ubound(mmachinenames)
SetKeysForMachine mmachinenames(I)
if err <> 0 then
wScript.stdOut.WriteLine "Error processing machine, " & mmachinenames(I)
Else
X=X+1
end if
next
wScript.stdOut.WriteLine "Script finished. Successfully processed " & X & " of " & ubound(mmachinenames)+1 & " Machines."