chanman525
IS-IT--Management
Hello all. I'm very new to scripting and I need some help figuring out what I'm doing wrong with my array. Basically my goal is to find out if Remote Desktop is enabled on all of the machines at our site. The script works for my machine, but I've tried to add the array and the list of "echo's" and now I'm getting nothing returned into my notepad. Just curious if someone could help me fix what I'm doing wrong.
Sidenote: Some of the stuff in this script might not have anything to do with the script. I got some of this from Sciptomatic so my apologies if it comes off pretty unorthodox. Like I said, I'm pretty new and I'm not entirely sure what all of this is doing quite yet.
Sidenote: Some of the stuff in this script might not have anything to do with the script. I got some of this from Sciptomatic so my apologies if it comes off pretty unorthodox. Like I said, I'm pretty new and I'm not entirely sure what all of this is doing quite yet.
Code:
On Error Resume Next
'Sets Constants
const HKEY_CURRENT_USER = &H80000001
const HKEY_LOCAL_MACHINE = &H80000002
arrComputers = Array("computer 1","computer 2")
For Each strComputer In arrComputers
WScript.Echo
WScript.Echo "=========================================="
WScript.Echo "Computer: " & strComputer
WScript.Echo "=========================================="
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SYSTEM\CurrentControlSet\Control\Terminal Server"
strValueName = "DeleteTempDirsonExit"
oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
StdOut.WriteLine "Remote Desktop Set to " & dwValue
strKeyPath = "SYSTEM\CurrentControlSet\Control\Terminal Server"
strValueName = "InstanceID"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
StdOut.WriteLine "Remot Desktop Set to: " & strValue
Next
end Function